From c05b71c4ee02df06fda6fe264914f49e2f827ade Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 4 Nov 2020 17:00:14 +0100 Subject: [PATCH] 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. --- sixtyfps_runtime/corelib/items.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sixtyfps_runtime/corelib/items.rs b/sixtyfps_runtime/corelib/items.rs index 721f0cb8c..bf61f216c 100644 --- a/sixtyfps_runtime/corelib/items.rs +++ b/sixtyfps_runtime/corelib/items.rs @@ -389,6 +389,8 @@ impl Default for TextVerticalAlignment { } } +const DEFAULT_FONT_SIZE: f32 = 12.; + /// The implementation of the `Text` element #[repr(C)] #[derive(FieldOffsets, Default, BuiltinItem)] @@ -495,7 +497,7 @@ impl Text { fn font_pixel_size(self: Pin<&Self>, window: &ComponentWindow) -> f32 { let font_size = Self::FIELD_OFFSETS.font_size.apply_pin(self).get(); if font_size == 0.0 { - 16. * window.scale_factor() + DEFAULT_FONT_SIZE * window.scale_factor() } else { font_size } @@ -1180,7 +1182,7 @@ impl TextInput { fn font_pixel_size(self: Pin<&Self>, window: &ComponentWindow) -> f32 { let font_size = Self::FIELD_OFFSETS.font_size.apply_pin(self).get(); if font_size == 0.0 { - 16. * window.scale_factor() + DEFAULT_FONT_SIZE * window.scale_factor() } else { font_size }