diff --git a/libse/TextDraw.cs b/libse/TextDraw.cs index 68b16587f..c67a5e62c 100644 --- a/libse/TextDraw.cs +++ b/libse/TextDraw.cs @@ -7,9 +7,9 @@ namespace Nikse.SubtitleEdit.Core public static class TextDraw { - public static double GetFontSizeFactor(double fontSize) + public static double GetFontSize(double fontSize) { - return fontSize / (1.614 * fontSize - 10.3); + return fontSize * 0.895d; // font rendered in video players like vlc/mpv are a little smaller than .net, so we adjust font size a bit down } public static void DrawText(Font font, StringFormat sf, GraphicsPath path, StringBuilder sb, bool isItalic, bool isBold, bool isUnderline, float left, float top, ref bool newLine, float leftMargin, ref int pathPointsStart) @@ -45,7 +45,7 @@ namespace Nikse.SubtitleEdit.Core if (isUnderline) fontStyle |= FontStyle.Underline; - var fontSize = (float) (font.Size * GetFontSizeFactor(font.Size)); + var fontSize = (float) GetFontSize(font.Size); try { path.AddString(sb.ToString(), font.FontFamily, (int)fontStyle, fontSize, next, sf); diff --git a/src/Forms/ExportPngXml.cs b/src/Forms/ExportPngXml.cs index cf09a3061..168eb2a45 100644 --- a/src/Forms/ExportPngXml.cs +++ b/src/Forms/ExportPngXml.cs @@ -2580,7 +2580,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + surface.InterpolationMode = InterpolationMode.Default; surface.SmoothingMode = SmoothingMode.HighSpeed; surface.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; - var newFontSize = (float)(0.439 * font.Size + 6.23); // make simple rendering close to same size as normal renderer + var newFontSize = (float)(font.Size * 0.7); // make simple rendering close to same size as normal renderer using (var newFont = new Font(font.FontFamily, newFontSize, font.Style)) { for (int j = 0; j < parameter.BorderWidth; j++) @@ -3719,7 +3719,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + SubtitleFontSize = style.FontSize, SubtitleFontBold = style.Bold }; - var fontSize = (float)(mbp.SubtitleFontSize * TextDraw.GetFontSizeFactor(mbp.SubtitleFontSize)); + var fontSize = (float) TextDraw.GetFontSize(mbp.SubtitleFontSize); Font font = SetFont(mbp, fontSize); SizeF textSize = g.MeasureString("Hj!", font); int lineHeight = (int)Math.Round(textSize.Height * 0.64f); @@ -4019,7 +4019,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + SubtitleFontBold = checkBoxBold.Checked }; - var fontSize = (float)(mbp.SubtitleFontSize * TextDraw.GetFontSizeFactor(mbp.SubtitleFontSize)); + var fontSize = (float)TextDraw.GetFontSize(mbp.SubtitleFontSize); Font font = SetFont(mbp, fontSize); SizeF textSize = g.MeasureString("Hj!", font); int lineHeight = (int)Math.Round(textSize.Height * 0.64f); @@ -4325,7 +4325,7 @@ $DROP=[DROPVALUE]" + Environment.NewLine + Environment.NewLine + SubtitleFontSize = float.Parse(comboBoxSubtitleFontSize.SelectedItem.ToString()), SubtitleFontBold = _subtitleFontBold }; - var fontSize = (float)(mbp.SubtitleFontSize * TextDraw.GetFontSizeFactor(mbp.SubtitleFontSize)); + var fontSize = (float)TextDraw.GetFontSize(mbp.SubtitleFontSize); Font font = SetFont(mbp, fontSize); SizeF textSize = g.MeasureString("Hj!", font);