From ad07abd01a09e135bf5502a2fe79948977991bba Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 6 Jan 2003 23:49:54 +0000 Subject: [PATCH] use font alignment --- stepmania/src/BitmapText.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index a20ee6becc..dae35744eb 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -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;