From 9920fea90013fab8bca7226f0382b15ccda21a0f Mon Sep 17 00:00:00 2001 From: mars Date: Mon, 5 Dec 2022 19:59:46 -0700 Subject: [PATCH] Better ID handling in Font + TextLayout --- crates/script/src/api/mod.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/script/src/api/mod.rs b/crates/script/src/api/mod.rs index 0df721e..47944cd 100644 --- a/crates/script/src/api/mod.rs +++ b/crates/script/src/api/mod.rs @@ -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 {