Add support for a font-metrics property to Text/TextInput. (#6452)

The struct held provides access to the design metrics of the font scaled
to the font pixel size used by the element.

ChangeLog: Slint Language: Added font-metrics property to `Text` and `TextInput`.

Closes #6047
This commit is contained in:
Simon Hausmann 2024-10-05 17:00:46 +02:00 committed by GitHub
parent b41b389e55
commit 0b028bfb6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 742 additions and 55 deletions

View file

@ -11,7 +11,8 @@ use std::rc::Rc;
use crate::expression_tree::{BuiltinFunction, Expression};
use crate::langtype::{
BuiltinElement, BuiltinPropertyInfo, DefaultSizeBinding, ElementType, NativeClass, Type,
BuiltinElement, BuiltinPropertyDefault, BuiltinPropertyInfo, DefaultSizeBinding, ElementType,
NativeClass, Type,
};
use crate::object_tree::{self, *};
use crate::parser::{identifier_text, syntax_nodes, SyntaxKind, SyntaxNode};
@ -93,7 +94,7 @@ pub(crate) fn load_builtins(register: &mut TypeRegister) {
if let Some(e) = p.BindingExpression() {
let ty = info.ty.clone();
info.default_value = Some(compiled(e, register, ty));
info.default_value = BuiltinPropertyDefault::Expr(compiled(e, register, ty));
}
(prop_name, info)