diff options
author | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-04-24 14:15:35 +0000 |
---|---|---|
committer | tobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2010-04-24 14:15:35 +0000 |
commit | ae8022d7ddf4c222e77447de46a5bf3f97c86493 (patch) | |
tree | 66d43cb366d2e2df1a42a9490844a71e19053703 /src | |
parent | a7b3c7ecceb15b3b987ab4e69944c6efb42a8849 (diff) | |
download | usdx-ae8022d7ddf4c222e77447de46a5bf3f97c86493.tar.gz usdx-ae8022d7ddf4c222e77447de46a5bf3f97c86493.tar.xz usdx-ae8022d7ddf4c222e77447de46a5bf3f97c86493.zip |
- 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
Diffstat (limited to 'src')
-rw-r--r-- | src/base/TextGL.pas | 22 |
1 files changed, 13 insertions, 9 deletions
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; |