diff --git a/Vocaluxe/Base/CFont.cs b/Vocaluxe/Base/CFont.cs index ab6e7157..96807202 100644 --- a/Vocaluxe/Base/CFont.cs +++ b/Vocaluxe/Base/CFont.cs @@ -12,6 +12,7 @@ using System.Xml; using System.Xml.XPath; using Vocaluxe.Lib.Draw; +using Vocaluxe.Menu; namespace Vocaluxe.Base { @@ -551,7 +552,18 @@ namespace Vocaluxe.Base } } } - + + public static RectangleF GetTextBounds(CText text) + { + return GetTextBounds(text, text.Height); + } + + public static RectangleF GetTextBounds(CText text, float height) + { + Height = height; + return new RectangleF(text.X, text.Y, GetTextWidth(CLanguage.Translate(text.Text)), GetTextHeight(CLanguage.Translate(text.Text))); + } + public static float GetTextWidth(string text) { float dx = 0; diff --git a/Vocaluxe/Lib/Draw/COpenGL.cs b/Vocaluxe/Lib/Draw/COpenGL.cs index 18896f52..06a9709b 100644 --- a/Vocaluxe/Lib/Draw/COpenGL.cs +++ b/Vocaluxe/Lib/Draw/COpenGL.cs @@ -511,7 +511,7 @@ namespace Vocaluxe.Lib.Draw CFonts.Height = Height; CFonts.SetFont(text.Fon); CFonts.Style = text.Style; - return new RectangleF(text.X, text.Y, CFonts.GetTextWidth(CLanguage.Translate(text.Text)), CFonts.GetTextHeight(text.Text)); + return new RectangleF(text.X, text.Y, CFonts.GetTextWidth(CLanguage.Translate(text.Text)), CFonts.GetTextHeight(CLanguage.Translate(text.Text))); } #region Basic Draw Methods diff --git a/Vocaluxe/Menu/CText.cs b/Vocaluxe/Menu/CText.cs index c0c95948..a9cf369c 100644 --- a/Vocaluxe/Menu/CText.cs +++ b/Vocaluxe/Menu/CText.cs @@ -394,15 +394,18 @@ namespace Vocaluxe.Menu if (!ForceDraw && !Visible && CSettings.GameState != EGameState.EditTheme) return; + CFonts.SetFont(Fon); + CFonts.Style = Style; + float h = Height; float y = Y; - RectangleF bounds = CDraw.GetTextBounds(this); + RectangleF bounds = CFonts.GetTextBounds(this); while (bounds.Width > Bounds.W) { h -= 0.2f; y += 0.1f; - bounds = CDraw.GetTextBounds(this, h); + bounds = CFonts.GetTextBounds(this, h); } float x = X; @@ -424,8 +427,7 @@ namespace Vocaluxe.Menu SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha); - CFonts.SetFont(Fon); - CFonts.Style = Style; + CFonts.DrawText(CLanguage.Translate(Text), h, x, y, Z, color); if (Reflection) @@ -437,9 +439,6 @@ namespace Vocaluxe.Menu { CDraw.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f * CGraphics.GlobalAlpha), new SRectF(x, y, bounds.Width, bounds.Height, Z)); } - - CFonts.SetFont("Normal"); - CFonts.Style = EStyle.Normal; } public void Draw(float begin, float end) @@ -478,9 +477,6 @@ namespace Vocaluxe.Menu { CDraw.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(x, Y, bounds.Width, bounds.Height, Z)); } - - CFonts.SetFont("Normal"); - CFonts.Style = EStyle.Normal; } public void DrawRelative(float x, float y) @@ -542,9 +538,6 @@ namespace Vocaluxe.Menu { CDraw.DrawColor(new SColorF(0.5f, 1f, 0.5f, 0.5f * CGraphics.GlobalAlpha), new SRectF(x, y, bounds.Width, bounds.Height, Z)); } - - CFonts.SetFont("Normal"); - CFonts.Style = EStyle.Normal; } public void UnloadTextures() diff --git a/Vocaluxe/Screens/CScreenMain.cs b/Vocaluxe/Screens/CScreenMain.cs index 14c0840c..e558cf24 100644 --- a/Vocaluxe/Screens/CScreenMain.cs +++ b/Vocaluxe/Screens/CScreenMain.cs @@ -140,7 +140,11 @@ namespace Vocaluxe.Screens base.DrawFG(); if (CSettings.VersionRevision != ERevision.Release) + { + CFonts.SetFont("Normal"); + CFonts.Style = EStyle.Normal; CDraw.DrawText(CSettings.GetFullVersionText(), 10, 680, 40); + } return true; }