Attempt to fix glyph resizing on texture limitation

This commit is contained in:
Flamefire committed 2013-05-02 01:17:30 +02:00
1 parent 507df651c0
commit 9021a444b5
2 files changed
+10 -7

No files matched your search

+9 -6
View File
@@ -110,13 +110,16 @@ namespace Vocaluxe.Base.Fonts
g.FillPath(Brushes.White, path); g.FillPath(Brushes.White, path);
} }
} }
Rectangle realBounds = _GetRealBounds(bmp); _DrawBounding = _GetRealBounds(bmp);
_DrawBounding = realBounds; using (Bitmap bmpCropped = bmp.Clone(_DrawBounding, PixelFormat.Format32bppArgb))
float dx = (fullSize.Width - boundingSize.Width - 1) / 2;
_DrawBounding.X -= dx;
using (Bitmap bmpCropped = bmp.Clone(realBounds, PixelFormat.Format32bppArgb))
{ {
float dx = (fullSize.Width - boundingSize.Width - 1) / 2;
_DrawBounding.X -= dx;
_Texture = CDraw.AddTexture(bmpCropped); _Texture = CDraw.AddTexture(bmpCropped);
_DrawBounding.X *= _Texture.Width / _DrawBounding.Width;
_DrawBounding.Y *= _Texture.Width / _DrawBounding.Width;
_DrawBounding.Width = _Texture.Width;
_DrawBounding.Height = _Texture.Height;
if (false) if (false)
{ {
if (outline > 0) if (outline > 0)
@@ -146,8 +149,8 @@ namespace Vocaluxe.Base.Fonts
float factor = _GetFactor(); float factor = _GetFactor();
x += _DrawBounding.X * factor; x += _DrawBounding.X * factor;
y += _DrawBounding.Y * factor; y += _DrawBounding.Y * factor;
float w = _DrawBounding.Width * factor;
float h = _DrawBounding.Height * factor; float h = _DrawBounding.Height * factor;
float w = _DrawBounding.Width * factor;
rect = new SRectF(x, y, w, h, z); rect = new SRectF(x, y, w, h, z);
} }
+1 -1
View File
@@ -51,7 +51,7 @@ namespace Vocaluxe.Screens
_AddText(text); _AddText(text);
text = new CText(10, 210, 1, 32, 0, EAlignment.Left, EStyle.Bold, "Outline", color, "Bold Text" + test, -1, 26, 0); text = new CText(10, 210, 1, 32, 0, EAlignment.Left, EStyle.Bold, "Outline", color, "Bold Text" + test, -1, 26, 0);
_AddText(text); _AddText(text);
text = new CText(10, 250, 1, 32, 0, EAlignment.Left, EStyle.Italic, "Outline", color, "Italic Text" + test, -1, 26, 0); text = new CText(10, 250, 1, 400, 0, EAlignment.Left, EStyle.Italic, "Outline", color, "Italic Text" + test, -1, 26, 0);
_AddText(text); _AddText(text);
} }