mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 22:54:36 +00:00
Fix default text font size
16 points is a lot, 12 is a lot closer to default system sizes. We can also pull this out of the style in the future.
This commit is contained in:
parent
68c411e860
commit
c05b71c4ee
1 changed files with 4 additions and 2 deletions
|
@ -389,6 +389,8 @@ impl Default for TextVerticalAlignment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DEFAULT_FONT_SIZE: f32 = 12.;
|
||||||
|
|
||||||
/// The implementation of the `Text` element
|
/// The implementation of the `Text` element
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[derive(FieldOffsets, Default, BuiltinItem)]
|
#[derive(FieldOffsets, Default, BuiltinItem)]
|
||||||
|
@ -495,7 +497,7 @@ impl Text {
|
||||||
fn font_pixel_size(self: Pin<&Self>, window: &ComponentWindow) -> f32 {
|
fn font_pixel_size(self: Pin<&Self>, window: &ComponentWindow) -> f32 {
|
||||||
let font_size = Self::FIELD_OFFSETS.font_size.apply_pin(self).get();
|
let font_size = Self::FIELD_OFFSETS.font_size.apply_pin(self).get();
|
||||||
if font_size == 0.0 {
|
if font_size == 0.0 {
|
||||||
16. * window.scale_factor()
|
DEFAULT_FONT_SIZE * window.scale_factor()
|
||||||
} else {
|
} else {
|
||||||
font_size
|
font_size
|
||||||
}
|
}
|
||||||
|
@ -1180,7 +1182,7 @@ impl TextInput {
|
||||||
fn font_pixel_size(self: Pin<&Self>, window: &ComponentWindow) -> f32 {
|
fn font_pixel_size(self: Pin<&Self>, window: &ComponentWindow) -> f32 {
|
||||||
let font_size = Self::FIELD_OFFSETS.font_size.apply_pin(self).get();
|
let font_size = Self::FIELD_OFFSETS.font_size.apply_pin(self).get();
|
||||||
if font_size == 0.0 {
|
if font_size == 0.0 {
|
||||||
16. * window.scale_factor()
|
DEFAULT_FONT_SIZE * window.scale_factor()
|
||||||
} else {
|
} else {
|
||||||
font_size
|
font_size
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue