mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
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.
This commit is contained in:
parent
689c144714
commit
6b2fa91357
19 changed files with 394 additions and 600 deletions
|
@ -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)))
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue