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

@ -0,0 +1,13 @@
// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
export component Foo inherits Rectangle {
Text {
font-metrics: 42;
// ^error{Cannot assign to output property 'font-metrics'}
// ^^error{Cannot convert float to slint::private_api::FontMetrics}
}
property <length> font-metrics: 100px;
}