remove GetWidestLineWidthInSourcePixels (use GetUnzoomedWidth)
This commit is contained in:
@@ -73,8 +73,6 @@ BitmapText::BitmapText()
|
|||||||
|
|
||||||
m_pFont = NULL;
|
m_pFont = NULL;
|
||||||
|
|
||||||
m_iWidestLineWidth = 0;
|
|
||||||
|
|
||||||
m_bShadow = true;
|
m_bShadow = true;
|
||||||
|
|
||||||
m_bRainbow = false;
|
m_bRainbow = false;
|
||||||
@@ -130,16 +128,14 @@ void BitmapText::BuildChars()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* calculate line lengths and widths */
|
/* calculate line lengths and widths */
|
||||||
m_iWidestLineWidth = 0;
|
m_size.x = 0;
|
||||||
|
|
||||||
m_iLineWidths.clear();
|
m_iLineWidths.clear();
|
||||||
for( unsigned l=0; l<m_wTextLines.size(); l++ ) // for each line
|
for( unsigned l=0; l<m_wTextLines.size(); l++ ) // for each line
|
||||||
{
|
{
|
||||||
m_iLineWidths.push_back(m_pFont->GetLineWidthInSourcePixels( m_wTextLines[l] ));
|
m_iLineWidths.push_back(m_pFont->GetLineWidthInSourcePixels( m_wTextLines[l] ));
|
||||||
m_iWidestLineWidth = max(m_iWidestLineWidth, m_iLineWidths.back());
|
m_size.x = max( m_size.x, m_iLineWidths.back() );
|
||||||
}
|
}
|
||||||
m_size.x = (float) m_iWidestLineWidth;
|
|
||||||
|
|
||||||
|
|
||||||
verts.clear();
|
verts.clear();
|
||||||
tex.clear();
|
tex.clear();
|
||||||
@@ -313,8 +309,11 @@ void BitmapText::SetTextMaxWidth( float MaxWidth, const CString &text, const CSt
|
|||||||
{
|
{
|
||||||
this->SetText(text, alttext);
|
this->SetText(text, alttext);
|
||||||
|
|
||||||
|
const float Width = GetUnzoomedWidth();
|
||||||
|
|
||||||
/* Avoid division by zero. */
|
/* Avoid division by zero. */
|
||||||
const int Width = GetWidestLineWidthInSourcePixels()+1;
|
if( !Width )
|
||||||
|
return;
|
||||||
|
|
||||||
/* Never decrease the zoom. Important: make sure you reset zoom before
|
/* Never decrease the zoom. Important: make sure you reset zoom before
|
||||||
* changing text with this function. */
|
* changing text with this function. */
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ public:
|
|||||||
void SetTextMaxWidth( float MaxWidth, const CString &text, const CString &alttext = "" );
|
void SetTextMaxWidth( float MaxWidth, const CString &text, const CString &alttext = "" );
|
||||||
void SetWrapWidthPixels( int iWrapWidthPixels );
|
void SetWrapWidthPixels( int iWrapWidthPixels );
|
||||||
|
|
||||||
int GetWidestLineWidthInSourcePixels() { return m_iWidestLineWidth; };
|
|
||||||
void CropToWidth( int iWidthInSourcePixels );
|
void CropToWidth( int iWidthInSourcePixels );
|
||||||
|
|
||||||
virtual void DrawPrimitives();
|
virtual void DrawPrimitives();
|
||||||
@@ -56,7 +55,6 @@ protected:
|
|||||||
CString m_sText;
|
CString 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_iWidestLineWidth; // in source pixels
|
|
||||||
int m_iWrapWidthPixels; // -1 = no wrap
|
int m_iWrapWidthPixels; // -1 = no wrap
|
||||||
|
|
||||||
bool m_bRainbow;
|
bool m_bRainbow;
|
||||||
|
|||||||
Reference in New Issue
Block a user