Better ID handling in Font + TextLayout

This commit is contained in:
mars 2022-12-05 19:59:46 -07:00
parent feec4de657
commit 9920fea900
1 changed files with 7 additions and 1 deletions

View File

@ -101,16 +101,22 @@ impl Panel {
}
#[repr(transparent)]
#[derive(Copy, Clone)]
#[derive(Copy, Clone, Debug)]
pub struct Font(u32);
impl Font {
pub fn new(family: &str) -> Self {
unsafe { Self(font_load(family.as_ptr() as u32, family.len() as u32)) }
}
/// Retrieves the script-local identifier of this font.
pub fn get_id(&self) -> u32 {
self.0
}
}
#[repr(transparent)]
#[derive(Debug)]
pub struct TextLayout(u32);
impl TextLayout {