Skip to content

Commit

Permalink
Add constant for default font size
Browse files Browse the repository at this point in the history
  • Loading branch information
GeertvanHorrik committed Oct 16, 2024
1 parent 2051ba0 commit 5f42f40
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Orc.Theming/Markup/FontSize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
/// </summary>
public class FontSize : UpdatableMarkupExtension
{
private const double DefaultFontSize = 12d;

private static readonly ILog Log = LogManager.GetCurrentClassLogger();

private static readonly Stopwatch LastUpdatedTextBlockFontSizeStopwatch = Stopwatch.StartNew();
Expand Down Expand Up @@ -75,7 +77,7 @@ public FontSize()

protected override object? ProvideDynamicValue(IServiceProvider? serviceProvider)
{
var defaultFontSize = 12d;
var defaultFontSize = DefaultFontSize;

switch (Mode)
{
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -135,7 +137,7 @@ private double GetFontSizeFromTextBlockMetadata()

private double GetFontSizeFromParent()
{
var defaultFontSize = 12d;
var defaultFontSize = DefaultFontSize;

if (TargetObject is DependencyObject dependencyObject)
{
Expand Down

0 comments on commit 5f42f40

Please sign in to comment.