From 5f42f40d85c0a01378d319ac7239613f466f9124 Mon Sep 17 00:00:00 2001 From: Geert van Horrik Date: Wed, 16 Oct 2024 23:58:00 +0200 Subject: [PATCH] Add constant for default font size --- src/Orc.Theming/Markup/FontSize.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Orc.Theming/Markup/FontSize.cs b/src/Orc.Theming/Markup/FontSize.cs index b98f937..f9167f0 100644 --- a/src/Orc.Theming/Markup/FontSize.cs +++ b/src/Orc.Theming/Markup/FontSize.cs @@ -15,6 +15,8 @@ /// public class FontSize : UpdatableMarkupExtension { + private const double DefaultFontSize = 12d; + private static readonly ILog Log = LogManager.GetCurrentClassLogger(); private static readonly Stopwatch LastUpdatedTextBlockFontSizeStopwatch = Stopwatch.StartNew(); @@ -75,7 +77,7 @@ public FontSize() protected override object? ProvideDynamicValue(IServiceProvider? serviceProvider) { - var defaultFontSize = 12d; + var defaultFontSize = DefaultFontSize; switch (Mode) { @@ -104,7 +106,7 @@ public FontSize() if (Absolute is not null) { // Return immediately, always use 12d as base font - var factor = Absolute.Value / 12d; + var factor = Absolute.Value / DefaultFontSize; finalFontSize = defaultFontSize * factor; return finalFontSize; } @@ -135,7 +137,7 @@ private double GetFontSizeFromTextBlockMetadata() private double GetFontSizeFromParent() { - var defaultFontSize = 12d; + var defaultFontSize = DefaultFontSize; if (TargetObject is DependencyObject dependencyObject) {