From 712f751d48ee7ec49f61484f5682a575ec49c402 Mon Sep 17 00:00:00 2001 From: Jonathan Schwender <55576758+jschwe@users.noreply.github.com> Date: Mon, 10 Jun 2024 09:34:31 +0200 Subject: [PATCH] gfx: font_list: Fix OpenHarmony build (#32466) Adapt changes from 1c9120c293cc16c11637feb6003117d4093642b5 to the OpenHarmony font_list.rs. --- components/gfx/platform/freetype/ohos/font_list.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/components/gfx/platform/freetype/ohos/font_list.rs b/components/gfx/platform/freetype/ohos/font_list.rs index 119646285f6..a1717629ad5 100644 --- a/components/gfx/platform/freetype/ohos/font_list.rs +++ b/components/gfx/platform/freetype/ohos/font_list.rs @@ -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,