mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
When instantiating a CTFont, store the bytes that were used to create it.
This commit is contained in:
parent
8ecc1a80a7
commit
1e743a7ed6
2 changed files with 29 additions and 18 deletions
|
@ -523,16 +523,10 @@ impl<'a> CanvasData<'a> {
|
|||
.first(font_context)
|
||||
.expect("couldn't find font");
|
||||
let font = font.borrow_mut();
|
||||
// Retrieving bytes from font template seems to panic for some core text fonts.
|
||||
// This check avoids having to obtain bytes from the font template data if they
|
||||
// are not already in the memory.
|
||||
if let Some(bytes) = font.handle.template().bytes_if_in_memory() {
|
||||
Font::from_bytes(Arc::new(bytes), 0)
|
||||
.ok()
|
||||
.or_else(|| load_system_font_from_style(Some(style)))
|
||||
} else {
|
||||
load_system_font_from_style(Some(style))
|
||||
}
|
||||
let template = font.handle.template();
|
||||
Font::from_bytes(Arc::new(template.bytes()), 0)
|
||||
.ok()
|
||||
.or_else(|| load_system_font_from_style(Some(style)))
|
||||
})
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue