From 1e6b3bfbee7c6a207ab2b6d98260688921abc07e Mon Sep 17 00:00:00 2001 From: feos Date: Sat, 6 Aug 2016 15:45:07 +0300 Subject: [PATCH] lua text: display trailing spaces --- .../tools/Lua/Libraries/EmuLuaLibrary.Gui.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs index 1b9711dcf7..ef94b53dc5 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Gui.cs @@ -584,8 +584,12 @@ namespace BizHawk.Client.EmuHawk } } + StringFormat f = new StringFormat(StringFormat.GenericTypographic) + { + FormatFlags = StringFormatFlags.MeasureTrailingSpaces + }; var font = new Font(family, fontsize ?? 12, fstyle, GraphicsUnit.Pixel); - Size sizeOfText = g.MeasureString(message, font).ToSize(); + Size sizeOfText = g.MeasureString(message, font, 0, f).ToSize(); Rectangle rect = new Rectangle(new Point(x, y), sizeOfText); g.FillRectangle(GetBrush(backcolor ?? DefaultTextBackground.Value), rect); g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit; @@ -636,8 +640,12 @@ namespace BizHawk.Client.EmuHawk return; } } + StringFormat f = new StringFormat(StringFormat.GenericTypographic) + { + FormatFlags = StringFormatFlags.MeasureTrailingSpaces + }; var font = new Font(GlobalWin.DisplayManager.CustomFonts.Families[index], 8, FontStyle.Regular, GraphicsUnit.Pixel); - Size sizeOfText = g.MeasureString(message, font, 0, StringFormat.GenericTypographic).ToSize(); + Size sizeOfText = g.MeasureString(message, font, 0, f).ToSize(); Rectangle rect = new Rectangle(new Point(x, y), sizeOfText + new Size(1, 0)); g.FillRectangle(GetBrush(backcolor ?? DefaultTextBackground.Value), rect); g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;