From ae8022d7ddf4c222e77447de46a5bf3f97c86493 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 24 Apr 2010 14:15:35 +0000 Subject: - wrong section names in TextGL fixed - TODO: loading fallbacks for each font takes a lot of time (white screen on start), maybe load them once for all fonts. - reduced outline of Outline2 font git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2298 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/TextGL.pas | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/base/TextGL.pas b/src/base/TextGL.pas index 0f4159d6..7ee574c3 100644 --- a/src/base/TextGL.pas +++ b/src/base/TextGL.pas @@ -129,28 +129,32 @@ var Outline: single; Embolden: single; OutlineFont: TFTScalableOutlineFont; + SectionName: string; begin ActFont := 0; SetLength(Fonts, Length(FONT_NAMES)); + FontIni := TMemIniFile.Create(FontPath.Append('fonts.ini').ToNative); try for I := 0 to High(FONT_NAMES) do begin - FontFile := FindFontFile(FontIni.ReadString('Font_'+FONT_NAMES[I], 'File', '')); + SectionName := 'Font_'+FONT_NAMES[I]; + + FontFile := FindFontFile(FontIni.ReadString(SectionName , 'File', '')); // create either outlined or normal font - Outline := FontIni.ReadFloat(FONT_NAMES[I], 'Outline', 0.0); + Outline := FontIni.ReadFloat(SectionName, 'Outline', 0.0); if (Outline > 0.0) then begin // outlined font OutlineFont := TFTScalableOutlineFont.Create(FontFile, 64, Outline); OutlineFont.SetOutlineColor( - FontIni.ReadFloat(FONT_NAMES[I], 'OutlineColorR', 0.0), - FontIni.ReadFloat(FONT_NAMES[I], 'OutlineColorG', 0.0), - FontIni.ReadFloat(FONT_NAMES[I], 'OutlineColorB', 0.0), - FontIni.ReadFloat(FONT_NAMES[I], 'OutlineColorA', -1.0) + FontIni.ReadFloat(SectionName, 'OutlineColorR', 0.0), + FontIni.ReadFloat(SectionName, 'OutlineColorG', 0.0), + FontIni.ReadFloat(SectionName, 'OutlineColorB', 0.0), + FontIni.ReadFloat(SectionName, 'OutlineColorA', -1.0) ); Fonts[I].Font := OutlineFont; Fonts[I].Outlined := true; @@ -158,13 +162,13 @@ begin else begin // normal font - Embolden := FontIni.ReadFloat(FONT_NAMES[I], 'Embolden', 0.0); + Embolden := FontIni.ReadFloat(SectionName, 'Embolden', 0.0); Fonts[I].Font := TFTScalableFont.Create(FontFile, 64, Embolden); Fonts[I].Outlined := false; end; - Fonts[I].Font.GlyphSpacing := FontIni.ReadFloat(FONT_NAMES[I], 'GlyphSpacing', 0.0); - Fonts[I].Font.Stretch := FontIni.ReadFloat(FONT_NAMES[I], 'Stretch', 1.0); + Fonts[I].Font.GlyphSpacing := FontIni.ReadFloat(SectionName, 'GlyphSpacing', 0.0); + Fonts[I].Font.Stretch := FontIni.ReadFloat(SectionName, 'Stretch', 1.0); AddFontFallbacks(FontIni, Fonts[I].Font); end; -- cgit v1.2.3