gfx: font_list: Fix OpenHarmony build (#32466)

Adapt changes from 1c9120c293
to the OpenHarmony font_list.rs.
This commit is contained in:
Jonathan Schwender 2024-06-10 09:34:31 +02:00 committed by GitHub
parent a91faa7207
commit 712f751d48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,16 +4,16 @@
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
use std::path::{Path, PathBuf}; use std::path::Path;
use base::text::{is_cjk, UnicodeBlock, UnicodeBlockMethod}; use base::text::{is_cjk, UnicodeBlock, UnicodeBlockMethod};
use log::warn; use log::warn;
use malloc_size_of_derive::MallocSizeOf;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use style::values::computed::{ use style::values::computed::{
FontStretch as StyleFontStretch, FontStyle as StyleFontStyle, FontWeight as StyleFontWeight, FontStretch as StyleFontStretch, FontStyle as StyleFontStyle, FontWeight as StyleFontWeight,
}; };
use style::Atom; use style::Atom;
use webrender_api::NativeFontHandle;
use crate::font_template::{FontTemplate, FontTemplateDescriptor}; use crate::font_template::{FontTemplate, FontTemplateDescriptor};
use crate::text::FallbackFontSelectionOptions; use crate::text::FallbackFontSelectionOptions;
@ -23,7 +23,7 @@ lazy_static::lazy_static! {
} }
/// An identifier for a local font on OpenHarmony systems. /// An identifier for a local font on OpenHarmony systems.
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] #[derive(Clone, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
pub struct LocalFontIdentifier { pub struct LocalFontIdentifier {
/// The path to the font. /// The path to the font.
pub path: Atom, pub path: Atom,
@ -153,11 +153,7 @@ where
}, },
None => StyleFontStyle::NORMAL, None => StyleFontStyle::NORMAL,
}; };
let descriptor = FontTemplateDescriptor { let descriptor = FontTemplateDescriptor::new(weight, stretch, style);
weight,
stretch,
style,
};
callback(FontTemplate::new_for_local_font( callback(FontTemplate::new_for_local_font(
local_font_identifier, local_font_identifier,
descriptor, descriptor,