desktop: Support device font with a non-zero index
This commit is contained in:
parent
5f123c3c01
commit
e0f5b8906d
|
@ -22,6 +22,7 @@ pub enum FontDefinition<'a> {
|
|||
is_bold: bool,
|
||||
is_italic: bool,
|
||||
data: Vec<u8>,
|
||||
index: u32,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -562,9 +562,11 @@ impl<'gc> Library<'gc> {
|
|||
is_bold,
|
||||
is_italic,
|
||||
data,
|
||||
index,
|
||||
} => {
|
||||
let descriptor = FontDescriptor::from_parts(&name, is_bold, is_italic);
|
||||
if let Ok(font) = Font::from_font_file(gc_context, descriptor, Cow::Owned(data), 0)
|
||||
if let Ok(font) =
|
||||
Font::from_font_file(gc_context, descriptor, Cow::Owned(data), index)
|
||||
{
|
||||
let name = font.descriptor().name().to_owned();
|
||||
info!("Loaded new device font \"{name}\" from file");
|
||||
|
|
|
@ -288,6 +288,7 @@ impl UiBackend for DesktopUiBackend {
|
|||
is_bold,
|
||||
is_italic,
|
||||
data: bytes,
|
||||
index: face.index,
|
||||
}),
|
||||
Err(e) => error!("Couldn't read font file at {path:?}: {e}"),
|
||||
},
|
||||
|
@ -297,6 +298,7 @@ impl UiBackend for DesktopUiBackend {
|
|||
is_bold,
|
||||
is_italic,
|
||||
data: bin.as_ref().as_ref().to_vec(),
|
||||
index: face.index,
|
||||
})
|
||||
}
|
||||
};
|
||||
|
|
|
@ -142,6 +142,7 @@ impl UiBackend for TestUiBackend {
|
|||
is_bold,
|
||||
is_italic,
|
||||
data: font.bytes.clone(),
|
||||
index: 0,
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue