From 55a466559b895796495b4c890da525e4c4b4e461 Mon Sep 17 00:00:00 2001 From: Flamefire Date: Thu, 2 May 2013 14:32:30 +0200 Subject: [PATCH] Better sizes (with outline Style) Fix of ScreenOptionsRecord for new font sizes. Other have to follow! --- .../Ambient/Screens/ScreenOptionsRecord.xml | 36 +++++++++---------- Vocaluxe/Base/Fonts/CGlyph.cs | 15 ++++---- Vocaluxe/Screens/CScreenTest.cs | 8 ++--- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml b/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml index 9362f766..1ca9f3fa 100644 --- a/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml +++ b/Output/Themes/Ambient/Screens/ScreenOptionsRecord.xml @@ -160,11 +160,11 @@ 640 - 48 + 53 0,00 - 32 + 27 @@ -189,11 +189,11 @@ 75 - 105 + 104 0,00 - 32 + 27 @@ -222,7 +222,7 @@ 0,00 - 32 + 27 @@ -251,7 +251,7 @@ 0,00 - 32 + 27 @@ -280,7 +280,7 @@ 0,00 - 32 + 27 @@ -309,7 +309,7 @@ 0,00 - 32 + 27 970 @@ -339,7 +339,7 @@ -1,00 - 32 + 27 @@ -368,7 +368,7 @@ -1,00 - 32 + 27 @@ -410,9 +410,9 @@ 75 - 10 + 14 - 32 + 27 142 @@ -467,9 +467,9 @@ 75 - 10 + 14 - 32 + 27 142 @@ -559,7 +559,7 @@ TextSColor - 32,00 + 27 @@ -626,7 +626,7 @@ TextSColor - 32,00 + 27 @@ -693,7 +693,7 @@ TextSColor - 32,00 + 27 @@ -760,7 +760,7 @@ TextSColor - 32,00 + 27 diff --git a/Vocaluxe/Base/Fonts/CGlyph.cs b/Vocaluxe/Base/Fonts/CGlyph.cs index 863b4322..453301ad 100644 --- a/Vocaluxe/Base/Fonts/CGlyph.cs +++ b/Vocaluxe/Base/Fonts/CGlyph.cs @@ -52,29 +52,30 @@ namespace Vocaluxe.Base.Fonts float outlineSize = outline * maxHeight; string chrString = chr.ToString(); - CFonts.Height = maxHeight; // *factor; - //float factor = _GetFactor(chr, flags); + CFonts.Height = maxHeight; Font fo = CFonts.GetFont(); SizeF fullSize; Size bmpSize; using (Graphics g = Graphics.FromHwnd(IntPtr.Zero)) { fullSize = g.MeasureString(chrString, fo); - fullSize.Width += outlineSize; if (chr != ' ') { //Gets exact height and width for drawing more than 1 char. But width is to small to draw char on bitmap as e.g. italic chars will get cropped _BoundingBox = g.MeasureString(chrString, fo, -1, new StringFormat(StringFormat.GenericTypographic)); - _BoundingBox.Width += outlineSize; // ReSharper disable CompareOfFloatsByEqualityOperator if (_BoundingBox.Height == 0) // ReSharper restore CompareOfFloatsByEqualityOperator - _BoundingBox.Height = fullSize.Height - outlineSize; + _BoundingBox.Height = fullSize.Height; + _BoundingBox.Width += outlineSize / 2; + _BoundingBox.Height += outlineSize; + fullSize.Width += outlineSize; bmpSize = new Size((int)fullSize.Width, (int)Math.Round(_BoundingBox.Height)); } else { _BoundingBox = fullSize; + _BoundingBox.Height += outlineSize; bmpSize = new Size(1, 1); } } @@ -86,7 +87,7 @@ namespace Vocaluxe.Base.Fonts if (chr == ' ') { _Texture = CDraw.AddTexture(bmp); - _DrawBounding = new RectangleF(0, 0, 1, 1); + _DrawBounding = new RectangleF(0, 0, 0, 0); } else { @@ -119,6 +120,7 @@ namespace Vocaluxe.Base.Fonts _DrawBounding.Y *= _Texture.Width / _DrawBounding.Width; _DrawBounding.Width = _Texture.Width; _DrawBounding.Height = _Texture.Height;*/ +#pragma warning disable 162 if (false) { if (outline > 0) @@ -126,6 +128,7 @@ namespace Vocaluxe.Base.Fonts else bmpCropped.Save("font/" + chr + CFonts.Style + "2.png", ImageFormat.Png); } +#pragma warning restore 162 } } } diff --git a/Vocaluxe/Screens/CScreenTest.cs b/Vocaluxe/Screens/CScreenTest.cs index c9239af9..7783f39b 100644 --- a/Vocaluxe/Screens/CScreenTest.cs +++ b/Vocaluxe/Screens/CScreenTest.cs @@ -39,7 +39,7 @@ namespace Vocaluxe.Screens public override void Init() { base.Init(); - const string test = " ÖÄÜabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890"; + const string test = "Ö ÄÜabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPGRSTUVWGXZ1234567890"; SColorF color = new SColorF(1, 0, 0, 1); CText text = new CText(10, 50, 1, 32, 0, EAlignment.Left, EStyle.Normal, "Normal", color, "jÄNormal Text" + test, -1, 26, 0); _AddText(text); @@ -47,11 +47,11 @@ namespace Vocaluxe.Screens _AddText(text); text = new CText(10, 130, 1, 32, 0, EAlignment.Left, EStyle.Italic, "Normal", color, "jÄItalic Text" + test, -1, 26, 0); _AddText(text); - text = new CText(10, 170, 1, 100, 0, EAlignment.Left, EStyle.Normal, "Outline", color, "jÄNormal Text" + test, -1, 50, 0); + text = new CText(10, 170, 1, 32, 0, EAlignment.Left, EStyle.Normal, "Outline", color, "jÄNormal Text" + test, -1, 50, 0); _AddText(text); - text = new CText(10, 210, 1, 200, 0, EAlignment.Left, EStyle.Bold, "Outline", color, "jÄBold Text" + test, -1, 100, 0); + text = new CText(10, 210, 1, 32, 0, EAlignment.Left, EStyle.Bold, "Outline", color, "jÄBold Text" + test, -1, 100, 0); _AddText(text); - text = new CText(10, 250, 1, 300, 0, EAlignment.Left, EStyle.Italic, "Outline", color, "jÄItalic Text" + test, -1, 150, 0); + text = new CText(10, 250, 1, 32, 0, EAlignment.Left, EStyle.Italic, "Outline", color, "jÄItalic Text" + test, -1, 150, 0); _AddText(text); }