Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

font: moved the zerospace detection from a config option to a fonts.2…

…da column
  • Loading branch information...
commit cd1f81f53f230e92ec9155e86c926635493569af 1 parent 9279f41
@lynxlynxlynx lynxlynxlynx authored
View
1  gemrb/core/Font.cpp
@@ -43,6 +43,7 @@ Font::Font()
name[0] = '\0';
multibyte = false;
utf8 = false;
+ zeroSpace = false;
// TODO: list incomplete
// maybe want to externalize this
// list compiled form wiki: http://www.gemrb.org/wiki/doku.php?id=engine:encodings
View
2  gemrb/core/Font.h
@@ -70,6 +70,7 @@ class GEM_EXPORT Font {
bool multibyte;
bool utf8;
+ bool zeroSpace;
public:
int maxHeight;
@@ -89,6 +90,7 @@ class GEM_EXPORT Font {
virtual ieWord GetPointSize() const {return 0;};
virtual FontStyle GetStyle() const {return NORMAL;};
+ void SetIgnoreSpaceWidth(bool ignore) { zeroSpace = ignore; };
Palette* GetPalette() const;
void SetPalette(Palette* pal);
View
6 gemrb/core/Interface.cpp
@@ -259,7 +259,6 @@ Interface::Interface()
SpecialSpells = NULL;
Encoding = "default";
TLKEncoding = "ISO-8859-1";
- ZeroSpace = false;
gamedata = new GameData();
}
@@ -1351,11 +1350,13 @@ int Interface::LoadSprites()
const char* font_name;
unsigned short font_size = 0;
FontStyle font_style = NORMAL;
+ bool zero_space = false;
if (CustomFontPath[0]) {
font_name = tab->QueryField( rowName, "FONT_NAME" );// map a font alternative to the BAM ResRef since CHUs contain hardcoded refrences.
font_size = atoi( tab->QueryField( rowName, "PT_SIZE" ) );// not available in BAM fonts.
font_style = (FontStyle)atoi( tab->QueryField( rowName, "STYLE" ) );// not available in BAM fonts.
+ zero_space = (bool)atoi( tab->QueryField( rowName, "ZEROSPACE" ) );
}else{
font_name = ResRef;
}
@@ -1412,6 +1413,7 @@ int Interface::LoadSprites()
fnt->AddResRef(ResRef);
fnt->SetName(font_name);
+ fnt->SetIgnoreSpaceWidth(zero_space);
fonts.push_back(fnt);
}
@@ -1519,7 +1521,7 @@ int Interface::Init(InterfaceConfig* config)
CONFIG_INT("NumFingKboard", NumFingKboard = );
CONFIG_INT("NumFingInfo", NumFingInfo = );
CONFIG_INT("MouseFeedback", MouseFeedback = );
- CONFIG_INT("ZeroSpace", ZeroSpace = );
+
#undef CONFIG_INT
#define CONFIG_STRING(key, var, default) \
View
2  gemrb/core/Interface.h
@@ -794,7 +794,7 @@ class GEM_EXPORT Interface
int GUIEnhancements;
bool KeepCache;
bool MultipleQuickSaves;
- bool ZeroSpace;
+
Variables *plugin_flags;
/** The Main program loop */
void Main(void);
View
2  gemrb/plugins/TTFImporter/TTFFont.cpp
@@ -268,7 +268,7 @@ TTFFont::TTFFont(FT_Face face, ieWord ptSize, FontStyle style, Palette* pal)
// TODO: ttf fonts have a "box" glyph they use for this
blank = core->GetVideoDriver()->CreateSprite8(0, 0, 8, NULL, palette->col);
// ttf fonts dont produce glyphs for whitespace
- int SpaceWidth = core->ZeroSpace? 1 : (ptSize * 0.25) ;
+ int SpaceWidth = zeroSpace? 1 : (ptSize * 0.25);
Sprite2D* space = core->GetVideoDriver()->CreateSprite8(SpaceWidth, 0, 8, NULL, palette->col);;
Sprite2D* tab = core->GetVideoDriver()->CreateSprite8((space->Width)*4, 0, 8, NULL, palette->col);
Please sign in to comment.
Something went wrong with that request. Please try again.