get rid of Kanji= flag; just push the baseline up a little

This commit is contained in:
Glenn Maynard
2003-01-10 03:48:21 +00:00
parent dfeb8feb49
commit 57d90f6bc9
3 changed files with 8 additions and 21 deletions
+4 -11
View File
@@ -171,17 +171,10 @@ void BitmapText::BuildChars()
const glyph &g = m_pFont->GetGlyph(szLine[j]);
/* set vertex positions */
float vshift = float(g.fp->vshift);
/* If either the font or the glyph is kanji, align the character
* centers. (Otherwise, leave it aligned at the baseline.) */
if(m_pFont->IsKanjiFont() || g.fp->kanji)
vshift += g.fp->GetCenter() - m_pFont->GetCenter();
v[0].p = RageVector3( iX+g.hshift, iY+vshift, 0 ); // top left
v[1].p = RageVector3( iX+g.hshift, iY+vshift+g.height, 0 );// bottom left
v[2].p = RageVector3( iX+g.hshift+g.width, iY+vshift+g.height, 0 );// bottom right
v[3].p = RageVector3( iX+g.hshift+g.width, iY+vshift, 0 ); // top right
v[0].p = RageVector3( iX+g.hshift, iY+g.fp->vshift, 0 ); // top left
v[1].p = RageVector3( iX+g.hshift, iY+g.fp->vshift+g.height, 0 ); // bottom left
v[2].p = RageVector3( iX+g.hshift+g.width, iY+g.fp->vshift+g.height, 0 ); // bottom right
v[3].p = RageVector3( iX+g.hshift+g.width, iY+g.fp->vshift, 0 ); // top right
/* Advance the cursor. */
iX += g.hadvance;
+1 -4
View File
@@ -39,8 +39,6 @@ void FontPage::Load( const FontPageSettings &cfg )
m_pTexture = TEXTUREMAN->LoadTexture( m_sTexturePath );
ASSERT( m_pTexture != NULL );
kanji = cfg.Kanji;
// load character widths
vector<int> FrameWidths;
int i;
@@ -99,7 +97,7 @@ void FontPage::Load( const FontPageSettings &cfg )
}
/* Shift the character up so the top will be rendered at the baseline. */
vshift = -baseline;
vshift = (float) -baseline;
SetTextureCoords(FrameWidths);
SetExtraPixels(cfg.DrawExtraPixelsLeft, cfg.DrawExtraPixelsRight);
@@ -440,7 +438,6 @@ void Font::LoadFontPageSettings(FontPageSettings &cfg, IniFile &ini, const CStri
ini.GetValueI( PageName, "LineSpacing", cfg.LineSpacing );
ini.GetValueI( PageName, "Top", cfg.Top );
ini.GetValueI( PageName, "Baseline", cfg.Baseline );
ini.GetValueB( PageName, "Kanji", cfg.Kanji );
/* Iterate over all keys. */
const IniFile::key *k = ini.GetKey(PageName);
+3 -6
View File
@@ -45,7 +45,6 @@ struct FontPageSettings
Top,
Baseline;
float ScaleAllWidthsBy;
bool Kanji;
map<longchar,int> CharToGlyphNo;
/* If a value is missing, the width of the texture frame is used. */
@@ -57,8 +56,7 @@ struct FontPageSettings
LineSpacing(-1),
ScaleAllWidthsBy(1),
Top(-1),
Baseline(-1),
Kanji(false)
Baseline(-1)
{ }
};
@@ -81,8 +79,8 @@ public:
/* Page-global properties. */
int height;
bool kanji;
int LineSpacing, vshift;
int LineSpacing;
float vshift;
int GetCenter() const { return height/2; }
private:
@@ -120,7 +118,6 @@ public:
void CapsOnly();
int GetHeight() const { return def->height; }
bool IsKanjiFont() const { return def->kanji; }
int GetCenter() const { return def->GetCenter(); }
int GetLineSpacing() const { return def->LineSpacing; }