aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-04-24 14:15:35 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-04-24 14:15:35 +0000
commitae8022d7ddf4c222e77447de46a5bf3f97c86493 (patch)
tree66d43cb366d2e2df1a42a9490844a71e19053703
parenta7b3c7ecceb15b3b987ab4e69944c6efb42a8849 (diff)
downloadusdx-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
-rwxr-xr-xgame/fonts/fonts.ini2
-rw-r--r--src/base/TextGL.pas22
2 files changed, 14 insertions, 10 deletions
diff --git a/game/fonts/fonts.ini b/game/fonts/fonts.ini
index 739fa7c9..bd811782 100755
--- a/game/fonts/fonts.ini
+++ b/game/fonts/fonts.ini
@@ -49,7 +49,7 @@ Outline=0.06
[Font_Outline2]
File=FreeSans/FreeSansBold.ttf
-Outline=0.08
+Outline=0.06
[Fallbacks]
File1=wqy-zenhei/wqy-zenhei.ttc
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;