RTL cleanup

This commit is contained in:
Chris Danford
2005-09-22 16:49:51 +00:00
parent 1a7899e270
commit a19f0b492a
2 changed files with 7 additions and 8 deletions
+6 -8
View File
@@ -11,6 +11,7 @@
#include "Font.h" #include "Font.h"
#include "ActorUtil.h" // for BeginHandleArgs #include "ActorUtil.h" // for BeginHandleArgs
#include "LuaBinding.h" #include "LuaBinding.h"
#include "Foreach.h"
REGISTER_ACTOR_CLASS( BitmapText ) REGISTER_ACTOR_CLASS( BitmapText )
@@ -187,7 +188,9 @@ void BitmapText::BuildChars()
{ {
iY += m_pFont->GetHeight(); iY += m_pFont->GetHeight();
const wstring &szLine = m_wTextLines[i]; wstring &sLine = m_wTextLines[i];
if( m_pFont->IsRightToLeft() )
reverse( sLine.begin(), sLine.end() );
const int iLineWidth = m_iLineWidths[i]; const int iLineWidth = m_iLineWidths[i];
int iX; int iX;
@@ -198,13 +201,11 @@ void BitmapText::BuildChars()
case align_right: iX = -iLineWidth; break; case align_right: iX = -iLineWidth; break;
default: ASSERT( false ); return; default: ASSERT( false ); return;
} }
if( m_pFont->IsRightToLeft() )
iX += iLineWidth;
for( unsigned j=0; j<szLine.size(); j++ ) // for each character in the line FOREACH( wchar_t, sLine, c )
{ {
RageSpriteVertex v[4]; RageSpriteVertex v[4];
const glyph &g = m_pFont->GetGlyph(szLine[j]); const glyph &g = m_pFont->GetGlyph(*c);
if( m_pFont->IsRightToLeft() ) if( m_pFont->IsRightToLeft() )
iX -= g.m_iHadvance; iX -= g.m_iHadvance;
@@ -226,9 +227,6 @@ void BitmapText::BuildChars()
m_aVertices.insert( m_aVertices.end(), &v[0], &v[4] ); m_aVertices.insert( m_aVertices.end(), &v[0], &v[4] );
m_pTextures.push_back( g.GetTexture() ); m_pTextures.push_back( g.GetTexture() );
if( m_pFont->IsRightToLeft() )
iX -= g.m_iHadvance;
} }
/* The amount of padding a line needs: */ /* The amount of padding a line needs: */
+1
View File
@@ -220,6 +220,7 @@ Font::Font()
m_iRefCount = 1; m_iRefCount = 1;
m_pDefault = NULL; m_pDefault = NULL;
m_bRightToLeft = false;
} }
Font::~Font() Font::~Font()