From 2029f0cbef428d7897381b82e60e3fcfbb67ad1d Mon Sep 17 00:00:00 2001 From: Flamefire Date: Tue, 30 Apr 2013 19:29:15 +0200 Subject: [PATCH] Pre-Renaming & Optimizing --- Vocaluxe/Base/Font/CFont.cs | 10 ++++++---- Vocaluxe/Base/Font/CGlyph.cs | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Vocaluxe/Base/Font/CFont.cs b/Vocaluxe/Base/Font/CFont.cs index 39ecd7c9..80d6a2a6 100644 --- a/Vocaluxe/Base/Font/CFont.cs +++ b/Vocaluxe/Base/Font/CFont.cs @@ -32,11 +32,13 @@ namespace Vocaluxe.Base.Font private FontFamily _Family; private readonly float _Sizeh; - public readonly string FilePath; + private readonly string _FilePath; + + private Font _LastFont; public CFont(string file) { - FilePath = file; + _FilePath = file; _Glyphs = new Dictionary(); @@ -70,12 +72,12 @@ namespace Vocaluxe.Base.Font _Fonts = new PrivateFontCollection(); try { - _Fonts.AddFontFile(FilePath); + _Fonts.AddFontFile(_FilePath); _Family = _Fonts.Families[0]; } catch (Exception e) { - CLog.LogError("Error opening font file " + FilePath + ": " + e.Message); + CLog.LogError("Error opening font file " + _FilePath + ": " + e.Message); } } diff --git a/Vocaluxe/Base/Font/CGlyph.cs b/Vocaluxe/Base/Font/CGlyph.cs index a14d6fd1..915a56bf 100644 --- a/Vocaluxe/Base/Font/CGlyph.cs +++ b/Vocaluxe/Base/Font/CGlyph.cs @@ -180,8 +180,8 @@ namespace Vocaluxe.Base.Font //find left for (int x = 0; x < minX && !found; x++) { - index = x; - for (int y = 0; y < bmp.Height; y++) + index = x + minY * bmp.Width; + for (int y = minY; y < bmp.Height; y++) { if (rgbValues[index] != 0) { @@ -196,8 +196,8 @@ namespace Vocaluxe.Base.Font //find right for (int x = bmp.Width - 1; x > maxX && !found; x--) { - index = x; - for (int y = 0; y < bmp.Height; y++) + index = x + minY * bmp.Width; + for (int y = minY; y < bmp.Height; y++) { if (rgbValues[index] != 0) {