From 4d917daccb4ed08762a30bef234d41479a356046 Mon Sep 17 00:00:00 2001 From: MXI Date: Mon, 11 May 2020 00:05:19 +0300 Subject: [PATCH] Font size field type fix (#190) * Font size field type fix Font size value is used as a float. Wrong type here causes exceptions. * Fix for converters --- .../Drawing/Fields/Binding/DecimalFloatConverter.cs | 4 ++-- .../Drawing/Fields/Binding/DecimalIntConverter.cs | 4 ++-- src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalFloatConverter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalFloatConverter.cs index 892a14efc..fab083389 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalFloatConverter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalFloatConverter.cs @@ -1,4 +1,4 @@ -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -37,7 +37,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding protected override float Convert(decimal o) { - return System.Convert.ToInt16(o); + return System.Convert.ToSingle(o); } public static DecimalFloatConverter GetInstance() diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalIntConverter.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalIntConverter.cs index 784b5ca88..f7e72e172 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalIntConverter.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/Binding/DecimalIntConverter.cs @@ -1,4 +1,4 @@ -// Greenshot - a free and open source screenshot tool +// Greenshot - a free and open source screenshot tool // Copyright (C) 2007-2020 Thomas Braun, Jens Klingen, Robin Krom // // For more information see: http://getgreenshot.org/ @@ -37,7 +37,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields.Binding protected override int Convert(decimal o) { - return System.Convert.ToInt16(o); + return System.Convert.ToInt32(o); } public static DecimalIntConverter GetInstance() diff --git a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs index 8eb35d87e..50c31af54 100644 --- a/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs +++ b/src/Greenshot.Addon.LegacyEditor/Drawing/Fields/FieldTypes.cs @@ -59,7 +59,7 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields /// /// This field specifies the font size /// - public static readonly IFieldType FONT_SIZE = new FieldType("FONT_SIZE"); + public static readonly IFieldType FONT_SIZE = new FieldType("FONT_SIZE"); /// /// This field specifies the horizontal text alignment /// @@ -113,4 +113,4 @@ namespace Greenshot.Addon.LegacyEditor.Drawing.Fields ARROWHEADS, BLUR_RADIUS, BRIGHTNESS, FILL_COLOR, FONT_BOLD, FONT_FAMILY, FONT_ITALIC, FONT_SIZE, TEXT_HORIZONTAL_ALIGNMENT, TEXT_VERTICAL_ALIGNMENT, HIGHLIGHT_COLOR, LINE_COLOR, LINE_THICKNESS, MAGNIFICATION_FACTOR, PIXEL_SIZE, SHADOW, PREPARED_FILTER_OBFUSCATE, PREPARED_FILTER_HIGHLIGHT, FLAGS }; } -} \ No newline at end of file +}