mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
Move the fonts out of the Backend trait (#1438)
and remove the `'static`
This commit is contained in:
parent
793974ce9f
commit
8c70cd7f57
17 changed files with 167 additions and 251 deletions
|
@ -2039,7 +2039,8 @@ fn compile_builtin_function_call(
|
|||
}
|
||||
BuiltinFunction::RegisterCustomFontByPath => {
|
||||
if let [Expression::StringLiteral(path)] = arguments {
|
||||
quote!(slint::register_font_from_path(&std::path::PathBuf::from(#path));)
|
||||
let window_tokens = access_window_field(ctx);
|
||||
quote!(#window_tokens.renderer().register_font_from_path(&std::path::PathBuf::from(#path));)
|
||||
} else {
|
||||
panic!("internal error: invalid args to RegisterCustomFontByPath {:?}", arguments)
|
||||
}
|
||||
|
@ -2048,7 +2049,8 @@ fn compile_builtin_function_call(
|
|||
if let [Expression::NumberLiteral(resource_id)] = &arguments {
|
||||
let resource_id: usize = *resource_id as _;
|
||||
let symbol = format_ident!("SLINT_EMBEDDED_RESOURCE_{}", resource_id);
|
||||
quote!(slint::register_font_from_memory(#symbol.into());)
|
||||
let window_tokens = access_window_field(ctx);
|
||||
quote!(#window_tokens.renderer().register_font_from_memory(#symbol.into());)
|
||||
} else {
|
||||
panic!("internal error: invalid args to RegisterCustomFontByMemory {:?}", arguments)
|
||||
}
|
||||
|
@ -2057,7 +2059,8 @@ fn compile_builtin_function_call(
|
|||
if let [Expression::NumberLiteral(resource_id)] = &arguments {
|
||||
let resource_id: usize = *resource_id as _;
|
||||
let symbol = format_ident!("SLINT_EMBEDDED_RESOURCE_{}", resource_id);
|
||||
quote!(slint::internal::register_bitmap_font(&#symbol);)
|
||||
let window_tokens = access_window_field(ctx);
|
||||
quote!(#window_tokens.renderer().register_bitmap_font(&#symbol);)
|
||||
} else {
|
||||
panic!("internal error: invalid args to RegisterBitmapFont must be a number")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue