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::io::Read;
use std::path::{Path, PathBuf};
use std::path::Path;
use base::text::{is_cjk, UnicodeBlock, UnicodeBlockMethod};
use log::warn;
use malloc_size_of_derive::MallocSizeOf;
use serde::{Deserialize, Serialize};
use style::values::computed::{
FontStretch as StyleFontStretch, FontStyle as StyleFontStyle, FontWeight as StyleFontWeight,
};
use style::Atom;
use webrender_api::NativeFontHandle;
use crate::font_template::{FontTemplate, FontTemplateDescriptor};
use crate::text::FallbackFontSelectionOptions;
@ -23,7 +23,7 @@ lazy_static::lazy_static! {
}
/// 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 {
/// The path to the font.
pub path: Atom,
@ -153,11 +153,7 @@ where
},
None => StyleFontStyle::NORMAL,
};
let descriptor = FontTemplateDescriptor {
weight,
stretch,
style,
};
let descriptor = FontTemplateDescriptor::new(weight, stretch, style);
callback(FontTemplate::new_for_local_font(
local_font_identifier,
descriptor,