Simplify FontHandle and rename it to PlatformFont (#32101)

* Simplify `FontHandle` and rename it to `PlatformFont`

Rename it to `PlatformFont` and move the `FontTemplate` member to
`Font`, because it's shared by all platforms.

* Update components/gfx/platform/freetype/font.rs

Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com>

* Fix build for MacOS and Windows

---------

Co-authored-by: Mukilan Thiyagarajan <mukilanthiagarajan@gmail.com>
This commit is contained in:
Martin Robinson 2024-04-17 19:44:34 +02:00 committed by GitHub
parent e9e46f4c0b
commit 5393d30a8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 71 additions and 80 deletions

View file

@ -16,9 +16,9 @@ use style::properties::style_structs::Font as FontStyleStruct;
use style::values::computed::font::FontWeight;
use webrender_api::NativeFontHandle;
use crate::font::FontHandleMethods;
use crate::font::PlatformFontMethods;
use crate::font_cache_thread::FontIdentifier;
use crate::platform::font::FontHandle;
use crate::platform::font::PlatformFont;
/// A reference to a [`FontTemplate`] with shared ownership and mutability.
pub(crate) type FontTemplateRef = Rc<RefCell<FontTemplate>>;
@ -191,10 +191,10 @@ impl FontTemplateRefMethods for FontTemplateRef {
return Err("Invalid font template");
}
let handle = FontHandleMethods::new_from_template(self.clone(), None);
let handle = PlatformFontMethods::new_from_template(self.clone(), None);
let mut template = self.borrow_mut();
template.is_valid = handle.is_ok();
let handle: FontHandle = handle?;
let handle: PlatformFont = handle?;
template.descriptor = Some(FontTemplateDescriptor::new(
handle.boldness(),
handle.stretchiness(),