From 740604a2a73061a8a6d8c15b3f327fd6abdbd1ed Mon Sep 17 00:00:00 2001 From: RKrom Date: Thu, 4 Dec 2014 17:07:04 +0100 Subject: [PATCH] Fix font size changes when rotating the canvas. --- Greenshot/Drawing/TextContainer.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Greenshot/Drawing/TextContainer.cs b/Greenshot/Drawing/TextContainer.cs index 77b860f48..965a9f28d 100644 --- a/Greenshot/Drawing/TextContainer.cs +++ b/Greenshot/Drawing/TextContainer.cs @@ -253,16 +253,14 @@ namespace Greenshot.Drawing { /// public override void Transform(Matrix matrix) { Rectangle rect = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height); - int widthBefore = rect.Width; - int heightBefore = rect.Height; + int pixelsBefore = rect.Width * rect.Height; // Transform this container base.Transform(matrix); rect = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height); - int widthAfter = rect.Width; - int heightAfter = rect.Height; - float factor = (((float)widthAfter / widthBefore) + ((float)heightAfter / heightBefore)) / 2; + int pixelsAfter = rect.Width * rect.Height; + float factor = pixelsAfter / pixelsBefore; float fontSize = GetFieldValueAsFloat(FieldType.FONT_SIZE); fontSize *= factor;