Pre-Renaming & Optimizing

This commit is contained in:
Flamefire committed 2013-04-30 19:29:15 +02:00
1 parent 600d5cf751
commit 2029f0cbef
2 files changed
+10 -8

No files matched your search

+6 -4
View File
@@ -32,11 +32,13 @@ namespace Vocaluxe.Base.Font
private FontFamily _Family; private FontFamily _Family;
private readonly float _Sizeh; private readonly float _Sizeh;
public readonly string FilePath; private readonly string _FilePath;
private Font _LastFont;
public CFont(string file) public CFont(string file)
{ {
FilePath = file; _FilePath = file;
_Glyphs = new Dictionary<char, CGlyph>(); _Glyphs = new Dictionary<char, CGlyph>();
@@ -70,12 +72,12 @@ namespace Vocaluxe.Base.Font
_Fonts = new PrivateFontCollection(); _Fonts = new PrivateFontCollection();
try try
{ {
_Fonts.AddFontFile(FilePath); _Fonts.AddFontFile(_FilePath);
_Family = _Fonts.Families[0]; _Family = _Fonts.Families[0];
} }
catch (Exception e) catch (Exception e)
{ {
CLog.LogError("Error opening font file " + FilePath + ": " + e.Message); CLog.LogError("Error opening font file " + _FilePath + ": " + e.Message);
} }
} }
+4 -4
View File
@@ -180,8 +180,8 @@ namespace Vocaluxe.Base.Font
//find left //find left
for (int x = 0; x < minX && !found; x++) for (int x = 0; x < minX && !found; x++)
{ {
index = x; index = x + minY * bmp.Width;
for (int y = 0; y < bmp.Height; y++) for (int y = minY; y < bmp.Height; y++)
{ {
if (rgbValues[index] != 0) if (rgbValues[index] != 0)
{ {
@@ -196,8 +196,8 @@ namespace Vocaluxe.Base.Font
//find right //find right
for (int x = bmp.Width - 1; x > maxX && !found; x--) for (int x = bmp.Width - 1; x > maxX && !found; x--)
{ {
index = x; index = x + minY * bmp.Width;
for (int y = 0; y < bmp.Height; y++) for (int y = minY; y < bmp.Height; y++)
{ {
if (rgbValues[index] != 0) if (rgbValues[index] != 0)
{ {