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,8 +16,7 @@ use unicode_bidi as bidi;
use webrender_api::FontInstanceKey;
use xi_unicode::LineBreakLeafIter;
use crate::font::{Font, FontHandleMethods, FontMetrics, RunMetrics, ShapingFlags, ShapingOptions};
use crate::font_template::FontTemplateRefMethods;
use crate::font::{Font, FontMetrics, RunMetrics, ShapingFlags, ShapingOptions};
use crate::text::glyph::{ByteIndex, GlyphStore};
thread_local! {
@ -30,8 +29,6 @@ thread_local! {
pub struct TextRun {
/// The UTF-8 string represented by this text run.
pub text: Arc<String>,
/// This ensures the data stays alive as long as this TextRun is using this font.
font_data: Arc<Vec<u8>>,
pub pt_size: Au,
pub font_metrics: FontMetrics,
pub font_key: FontInstanceKey,
@ -194,7 +191,6 @@ impl<'a> TextRun {
TextRun {
text: Arc::new(text),
font_metrics: font.metrics.clone(),
font_data: font.handle.template().data(),
font_key: font.font_key,
pt_size: font.descriptor.pt_size,
glyphs: Arc::new(glyphs),