prevent negative fontsize

This commit is contained in:
Christian Schulz 2022-02-18 21:15:37 +01:00
commit 183f28f523

View file

@ -204,7 +204,7 @@ namespace Greenshot.Editor.Drawing
EllipseContainer.DrawEllipse(rect, graphics, rm, 0, Color.Transparent, fillColor, false);
}
float fontSize = Math.Min(Width, Height) / 1.4f;
float fontSize = Math.Min(Math.Abs(Width), Math.Abs(Height)) / 1.4f;
using FontFamily fam = new FontFamily(FontFamily.GenericSansSerif.Name);
using Font font = new Font(fam, fontSize, FontStyle.Bold, GraphicsUnit.Pixel);
TextContainer.DrawText(graphics, rect, 0, lineColor, false, _stringFormat, text, font);