add StringWillUseAlternate
This commit is contained in:
@@ -231,12 +231,8 @@ void BitmapText::SetText( CString sText, CString sAlternateText )
|
||||
{
|
||||
ASSERT( m_pFont );
|
||||
|
||||
if(sAlternateText.size())
|
||||
{
|
||||
if(!m_pFont->FontCompleteForString(CStringToWstring(sText)) &&
|
||||
m_pFont->FontCompleteForString(CStringToWstring(sAlternateText)))
|
||||
sText = sAlternateText;
|
||||
}
|
||||
if(StringWillUseAlternate(sText, sAlternateText))
|
||||
sText = sAlternateText;
|
||||
|
||||
if(m_szText == sText)
|
||||
return;
|
||||
@@ -250,6 +246,22 @@ void BitmapText::SetText( CString sText, CString sAlternateText )
|
||||
BuildChars();
|
||||
}
|
||||
|
||||
bool BitmapText::StringWillUseAlternate(CString sText, CString sAlternateText) const
|
||||
{
|
||||
ASSERT( m_pFont );
|
||||
|
||||
/* Can't use the alternate if there isn't one. */
|
||||
if(!sAlternateText.size()) return false;
|
||||
|
||||
/* False if the alternate isn't needed. */
|
||||
if(m_pFont->FontCompleteForString(CStringToWstring(sText))) return false;
|
||||
|
||||
/* False if the alternate is also incomplete. */
|
||||
if(!m_pFont->FontCompleteForString(CStringToWstring(sAlternateText))) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BitmapText::CropToWidth( int iMaxWidthInSourcePixels )
|
||||
{
|
||||
iMaxWidthInSourcePixels = max( 0, iMaxWidthInSourcePixels );
|
||||
|
||||
Reference in New Issue
Block a user