mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
WR update: APIs update
This commit is contained in:
parent
ecc11826d2
commit
a20455fd6b
6 changed files with 43 additions and 20 deletions
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::platform::windows::font_list::{descriptor_from_atom, font_from_atom};
|
||||
use crate::platform::windows::font_list::font_from_atom;
|
||||
use servo_atoms::Atom;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
|
@ -59,10 +59,16 @@ impl FontTemplateData {
|
|||
}
|
||||
|
||||
pub fn native_font(&self) -> Option<NativeFontHandle> {
|
||||
if self.bytes.is_none() {
|
||||
Some(descriptor_from_atom(&self.identifier))
|
||||
} else {
|
||||
None
|
||||
if self.bytes.is_some() {
|
||||
return None;
|
||||
}
|
||||
let font = font_from_atom(&self.identifier);
|
||||
let face = font.create_font_face();
|
||||
let files = face.get_files();
|
||||
let path = files.iter().next()?.get_font_file_path()?;
|
||||
Some(NativeFontHandle {
|
||||
path,
|
||||
index: face.get_index(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue