Skip to content

Commit

Permalink
feat(core-text): make a temp font descriptor get font index func
Browse files Browse the repository at this point in the history
  • Loading branch information
7sDream committed May 25, 2020
1 parent 0586616 commit 2f85c9b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/font/matcher/ct/font_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ pub struct FontInfo<'fs> {
pub(super) desc: ItemRef<'fs, CTFontDescriptor>,
}

impl<'fs> FontInfo<'fs> {
// TODO: Figure out how to get font face index in file from FontDescriptor
#[allow(clippy::unused_self)]
fn font_face_index(&self) -> Option<usize> {
Some(0)
}
}

impl<'fi> TryFrom<FontInfo<'fi>> for Font<'fi> {
type Error = ();

Expand All @@ -34,7 +42,7 @@ impl<'fi> TryFrom<FontInfo<'fi>> for Font<'fi> {
let path = Cow::from(
font_info.desc.font_path().ok_or(())?.into_os_string().into_string().map_err(|_| ())?,
);
let index = 0;
let index = font_info.font_face_index().ok_or(())?;
Ok(Font { family_name, fullname, path, index })
}
}

0 comments on commit 2f85c9b

Please sign in to comment.