mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
Introduce a rem
unit in the type system
This allows specifying font sizes relative to the Window's default-font-size, similar to CSS rem.
This commit is contained in:
parent
75ccd897ed
commit
d8a1f2cf01
22 changed files with 232 additions and 58 deletions
|
@ -314,6 +314,7 @@ impl CppType for Type {
|
|||
Type::Angle => Some("float".to_owned()),
|
||||
Type::PhysicalLength => Some("float".to_owned()),
|
||||
Type::LogicalLength => Some("float".to_owned()),
|
||||
Type::Rem => Some("float".to_owned()),
|
||||
Type::Percent => Some("float".to_owned()),
|
||||
Type::Bool => Some("bool".to_owned()),
|
||||
Type::Struct { name: Some(name), node: Some(_), .. } => Some(ident(name)),
|
||||
|
@ -2395,6 +2396,10 @@ fn compile_builtin_function_call(
|
|||
let window = access_window_field(ctx);
|
||||
format!("{}.scale_factor()", window)
|
||||
}
|
||||
BuiltinFunction::GetWindowDefaultFontSize => {
|
||||
let window_item_name = ident(&ctx.public_component.item_tree.root.items[0].name);
|
||||
format!("{}->{}.default_font_size.get()", ctx.generator_state, window_item_name)
|
||||
}
|
||||
BuiltinFunction::AnimationTick => "slint::cbindgen_private::slint_animation_tick()".into(),
|
||||
BuiltinFunction::Debug => {
|
||||
format!("std::cout << {} << std::endl;", a.join("<<"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue