use font alignment

This commit is contained in:
Glenn Maynard
2003-01-06 23:49:54 +00:00
parent c6e63f37d3
commit ad07abd01a
+13 -4
View File
@@ -153,10 +153,19 @@ void BitmapText::BuildChars()
const glyph &g = m_pFont->GetGlyph(szLine[j]);
/* set vertex positions */
v[0].p = RageVector3( iX+g.hshift, iY+g.vshift, 0 ); // top left
v[1].p = RageVector3( iX+g.hshift, iY+g.vshift+g.height, 0 ); // bottom left
v[2].p = RageVector3( iX+g.hshift+g.width, iY+g.vshift+g.height, 0 ); // bottom right
v[3].p = RageVector3( iX+g.hshift+g.width, iY+g.vshift, 0 ); // top right
float vshift = g.vshift;
/* Align the glyph with the font. If either the font or the glyph is
* kanji, align the centers; otherwise align the baselines. */
if(m_pFont->IsKanjiFont() || g.fp->kanji)
vshift += m_pFont->GetCenter() - g.fp->center;
else
vshift += m_pFont->GetBaseline() - g.fp->baseline;
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
/* Advance the cursor. */
iX += g.hadvance;