diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-04-16 19:50:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-16 17:50:50 +0000 |
commit | 6b2fa91357ea289d03e206018389c43ffd836047 (patch) | |
tree | 164367ab35aa156bd944f58a1e6e9f9fa9a967b0 /components/canvas/canvas_data.rs | |
parent | 689c14471430bb331ff0d46d5be7e16b81a1de54 (diff) | |
download | servo-6b2fa91357ea289d03e206018389c43ffd836047.tar.gz servo-6b2fa91357ea289d03e206018389c43ffd836047.zip |
gfx: Remove `FontTemplateData` (#32034)
Now that `FontTemplateData` is more or less the same on all platforms,
it can be removed. This is a preparatory change for a full refactor of
the font system on Servo. The major changes here are:
- Remove `FontTemplateData` and move its members into `FontTemplate`
- Make `FontTemplate` have full interior mutability instead of only
the `FontTemplateData` member. This is preparation for having these
data types `Send` and `Sync` with locking.
- Remove the strong/weak reference concept for font data. In practice,
all font data references were strong, so this was never fully
complete. Instead of using this approach, the new font system will
use a central font data cache with references associated to layouts.
- The `CTFont` cache is now a global cache, so `CTFont`s can be shared
between threads. The cache is cleared when clearing font caches.
A benefit of this change (apart from `CTFont` sharing) is that font data
loading is platform-independent now.
Diffstat (limited to 'components/canvas/canvas_data.rs')
-rw-r--r-- | components/canvas/canvas_data.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/components/canvas/canvas_data.rs b/components/canvas/canvas_data.rs index 85e25d8dfb3..8b62a183733 100644 --- a/components/canvas/canvas_data.rs +++ b/components/canvas/canvas_data.rs @@ -17,6 +17,7 @@ use font_kit::source::SystemSource; use gfx::font::FontHandleMethods; use gfx::font_cache_thread::FontCacheThread; use gfx::font_context::FontContext; +use gfx::font_template::FontTemplateRefMethods; use ipc_channel::ipc::{IpcSender, IpcSharedMemory}; use log::{debug, error, warn}; use num_traits::ToPrimitive; @@ -501,7 +502,7 @@ impl<'a> CanvasData<'a> { .first(font_context) .expect("couldn't find font"); let font = font.borrow_mut(); - Font::from_bytes(font.handle.template().bytes(), 0) + Font::from_bytes(font.handle.template().data(), 0) .ok() .or_else(|| load_system_font_from_style(Some(style))) }) |