This commit is contained in:
Glenn Maynard
2006-01-24 01:02:21 +00:00
parent 63368f99da
commit 39bf48696a
2 changed files with 19 additions and 21 deletions
+6 -6
View File
@@ -178,13 +178,13 @@ void BitmapText::BuildChars()
return; return;
m_size.y = float(m_pFont->GetHeight() * m_wTextLines.size()); m_size.y = float(m_pFont->GetHeight() * m_wTextLines.size());
int MinSpacing = 0; int iMinSpacing = 0;
/* The height (from the origin to the baseline): */ /* The height (from the origin to the baseline): */
int Padding = max(m_pFont->GetLineSpacing(), MinSpacing) - m_pFont->GetHeight(); int iPadding = max(m_pFont->GetLineSpacing(), iMinSpacing) - m_pFont->GetHeight();
/* There's padding between every line: */ /* There's padding between every line: */
m_size.y += Padding * (m_wTextLines.size()-1); m_size.y += iPadding * (m_wTextLines.size()-1);
int iY; // the top position of the first row of characters int iY; // the top position of the first row of characters
switch( m_VertAlign ) switch( m_VertAlign )
@@ -192,7 +192,7 @@ void BitmapText::BuildChars()
case align_top: iY = 0; break; case align_top: iY = 0; break;
case align_middle: iY = -(int)roundf(m_size.y/2.0f); break; case align_middle: iY = -(int)roundf(m_size.y/2.0f); break;
case align_bottom: iY = -(int)m_size.y; break; case align_bottom: iY = -(int)m_size.y; break;
default: ASSERT( false ); return; default: ASSERT( false );
} }
for( unsigned i=0; i<m_wTextLines.size(); i++ ) // foreach line for( unsigned i=0; i<m_wTextLines.size(); i++ ) // foreach line
@@ -210,7 +210,7 @@ void BitmapText::BuildChars()
case align_left: iX = 0; break; case align_left: iX = 0; break;
case align_center: iX = -(int)roundf(iLineWidth/2.0f); break; case align_center: iX = -(int)roundf(iLineWidth/2.0f); break;
case align_right: iX = -iLineWidth; break; case align_right: iX = -iLineWidth; break;
default: ASSERT( false ); return; default: ASSERT( false );
} }
for( unsigned i = 0; i < sLine.size(); ++i ) for( unsigned i = 0; i < sLine.size(); ++i )
@@ -241,7 +241,7 @@ void BitmapText::BuildChars()
} }
/* The amount of padding a line needs: */ /* The amount of padding a line needs: */
iY += Padding; iY += iPadding;
} }
} }
+1 -3
View File
@@ -51,20 +51,18 @@ public:
Font* m_pFont; Font* m_pFont;
protected: protected:
// recalculate the items in SetText()
RString m_sText; RString m_sText;
vector<wstring> m_wTextLines; vector<wstring> m_wTextLines;
vector<int> m_iLineWidths; // in source pixels vector<int> m_iLineWidths; // in source pixels
int m_iWrapWidthPixels; // -1 = no wrap int m_iWrapWidthPixels; // -1 = no wrap
float m_fMaxWidth; float m_fMaxWidth;
float m_fMaxHeight; float m_fMaxHeight;
bool m_bRainbow; bool m_bRainbow;
vector<RageSpriteVertex> m_aVertices; vector<RageSpriteVertex> m_aVertices;
vector<RageTexture *> m_pTextures; vector<RageTexture *> m_pTextures;
// recalculate the items in SetText()
void BuildChars(); void BuildChars();
void DrawChars(); void DrawChars();
void UpdateBaseZoom(); void UpdateBaseZoom();