From ca6ccc5830b9db18ecdf09bc31a2dcb37b5e1fd3 Mon Sep 17 00:00:00 2001 From: Asval Date: Sat, 22 Jun 2019 21:43:24 +0200 Subject: [PATCH] auto resize item display name if needed --- FModel/Methods/IconGenerator/DrawText.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/FModel/Methods/IconGenerator/DrawText.cs b/FModel/Methods/IconGenerator/DrawText.cs index 61d3a1ea..e5c34b64 100644 --- a/FModel/Methods/IconGenerator/DrawText.cs +++ b/FModel/Methods/IconGenerator/DrawText.cs @@ -248,8 +248,12 @@ namespace FModel { if (theItem.DisplayName != null) { + //myGraphic.DrawRectangle(new Pen(new SolidBrush(Color.Red)), new Rectangle(5, 395, 512, 49)); + string text = SearchResource.getTextByKey(theItem.DisplayName.Key, theItem.DisplayName.SourceString); - myGraphic.DrawString(text, new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[0], 35), new SolidBrush(Color.White), new Point(522 / 2, 395), FontUtilities.centeredString); + + Font goodFont = FontUtilities.FindFont(myGraphic, text, new Rectangle(5, 395, 512, 49).Size, new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[0], 35)); + myGraphic.DrawString(text, goodFont, new SolidBrush(Color.White), new Point(522 / 2, 395), FontUtilities.centeredString); } }