mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-03 07:04:34 +00:00
Add the ability to load application fonts by path
The viewer command line tool also gains the ability to specify them via `--app-font=/path/to/font.ttf` , which can be specified multiple times.
This commit is contained in:
parent
09ea6572e4
commit
45fe6c3e8d
7 changed files with 84 additions and 0 deletions
|
@ -178,6 +178,15 @@ pub fn register_application_font_from_memory(
|
|||
sixtyfps_rendering_backend_default::backend().register_application_font_from_memory(data)
|
||||
}
|
||||
|
||||
/// This function can be used to register a custom TrueType font with SixtyFPS,
|
||||
/// for use with the `font-family` property. The provided path must refer to a valid TrueType
|
||||
/// font.
|
||||
pub fn register_application_font_from_path<P: AsRef<std::path::Path>>(
|
||||
path: P,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
sixtyfps_rendering_backend_default::backend().register_application_font_from_path(path.as_ref())
|
||||
}
|
||||
|
||||
// FIXME: this should not be in this namespace
|
||||
// but the name is `sixtyfps::StateInfo` in builtin.60
|
||||
#[doc(hidden)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue