mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
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:
parent
b41b389e55
commit
0b028bfb6f
36 changed files with 742 additions and 55 deletions
|
@ -899,6 +899,8 @@ fn embed_resource(
|
|||
units_per_em,
|
||||
ascent,
|
||||
descent,
|
||||
x_height,
|
||||
cap_height,
|
||||
glyphs,
|
||||
weight,
|
||||
italic,
|
||||
|
@ -998,6 +1000,8 @@ fn embed_resource(
|
|||
.units_per_em = {units_per_em},
|
||||
.ascent = {ascent},
|
||||
.descent = {descent},
|
||||
.x_height = {x_height},
|
||||
.cap_height = {cap_height},
|
||||
.glyphs = slint::cbindgen_private::Slice<slint::cbindgen_private::BitmapGlyphs>{{ {glyphsets_var}, {glyphsets_size} }},
|
||||
.weight = {weight},
|
||||
.italic = {italic},
|
||||
|
@ -3542,6 +3546,15 @@ fn compile_builtin_function_call(
|
|||
panic!("internal error: invalid args to ItemMemberFunction {:?}", arguments)
|
||||
}
|
||||
}
|
||||
BuiltinFunction::ItemFontMetrics => {
|
||||
if let [llr::Expression::PropertyReference(pr)] = arguments {
|
||||
let item_rc = access_item_rc(pr, ctx);
|
||||
let window = access_window_field(ctx);
|
||||
format!("slint_cpp_text_item_fontmetrics(&{window}.handle(), &{item_rc})")
|
||||
} else {
|
||||
panic!("internal error: invalid args to ItemFontMetrics {:?}", arguments)
|
||||
}
|
||||
}
|
||||
BuiltinFunction::ItemAbsolutePosition => {
|
||||
if let [llr::Expression::PropertyReference(pr)] = arguments {
|
||||
let item_rc = access_item_rc(pr, ctx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue