add support for Right to Left fonts

This commit is contained in:
Chris Danford
2005-09-22 09:08:11 +00:00
parent eb8563ecd9
commit 1a7899e270
3 changed files with 16 additions and 0 deletions
+8
View File
@@ -198,12 +198,17 @@ void BitmapText::BuildChars()
case align_right: iX = -iLineWidth; break;
default: ASSERT( false ); return;
}
if( m_pFont->IsRightToLeft() )
iX += iLineWidth;
for( unsigned j=0; j<szLine.size(); j++ ) // for each character in the line
{
RageSpriteVertex v[4];
const glyph &g = m_pFont->GetGlyph(szLine[j]);
if( m_pFont->IsRightToLeft() )
iX -= g.m_iHadvance;
/* set vertex positions */
v[0].p = RageVector3( iX+g.m_fHshift, iY+g.m_pPage->m_fVshift, 0 ); // top left
v[1].p = RageVector3( iX+g.m_fHshift, iY+g.m_pPage->m_fVshift+g.m_fHeight, 0 ); // bottom left
@@ -221,6 +226,9 @@ void BitmapText::BuildChars()
m_aVertices.insert( m_aVertices.end(), &v[0], &v[4] );
m_pTextures.push_back( g.GetTexture() );
if( m_pFont->IsRightToLeft() )
iX -= g.m_iHadvance;
}
/* The amount of padding a line needs: */