@ -288,7 +288,14 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t *st
if ( justCalc )
{
plCharacter & ch = fCharacters [ ( UInt16 ) string [ 0 ] - fFirstChar ] ;
plCharacter & ch = fCharacters [ fFirstChar ] ;
if ( fCharacters . Count ( ) < = ( ( UInt16 ) string [ 0 ] - fFirstChar ) )
if ( wctob ( string [ 0 ] ) ! = EOF )
ch = ( fCharacters [ ( UInt16 ) wctob ( string [ 0 ] ) ] ) ;
else
ch = ( fCharacters [ ( UInt16 ) L ' ' - fFirstChar ] ) ;
else
ch = ( fCharacters [ ( UInt16 ) string [ 0 ] - fFirstChar ] ) ;
fRenderInfo . fX = fRenderInfo . fFarthestX = x - ( Int16 ) ch . fLeftKern ;
if ( fRenderInfo . fX < 0 )
fRenderInfo . fX = 0 ;
@ -387,7 +394,14 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t *st
// Just calculating, no wrapping, so the max is as far as we can go
// Note: 32767 isn't quite right, since we'll be adding the left kern in before we
// calc the first character, so adjust so we make sure we don't underflow
plCharacter & ch = fCharacters [ ( UInt16 ) ( UInt8 ) string [ 0 ] - fFirstChar ] ;
plCharacter & ch = fCharacters [ fFirstChar ] ;
if ( fCharacters . Count ( ) < = ( ( UInt16 ) string [ 0 ] - fFirstChar ) )
if ( wctob ( string [ 0 ] ) ! = EOF )
ch = ( fCharacters [ ( UInt16 ) wctob ( string [ 0 ] ) ] ) ;
else
ch = ( fCharacters [ ( UInt16 ) L ' ' - fFirstChar ] ) ;
else
ch = ( fCharacters [ ( UInt16 ) string [ 0 ] - fFirstChar ] ) ;
fRenderInfo . fMaxHeight = ( Int16 ) fMaxCharHeight ;
fRenderInfo . fMaxWidth = ( Int16 ) 32767 + ( Int16 ) ch . fLeftKern ;
@ -453,7 +467,10 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t *st
// handle invalid chars discretely
plCharacter * charToDraw = NULL ;
if ( fCharacters . Count ( ) < = ( ( UInt16 ) string [ i ] - fFirstChar ) )
charToDraw = & ( fCharacters [ ( UInt16 ) L ' ' - fFirstChar ] ) ;
if ( wctob ( string [ i ] ) ! = EOF )
charToDraw = & ( fCharacters [ ( UInt16 ) wctob ( string [ i ] ) ] ) ;
else
charToDraw = & ( fCharacters [ ( UInt16 ) L ' ' - fFirstChar ] ) ;
else
charToDraw = & ( fCharacters [ ( UInt16 ) string [ i ] - fFirstChar ] ) ;
@ -584,8 +601,15 @@ void plFont::IRenderString( plMipmap *mip, UInt16 x, UInt16 y, const wchar_t *st
else if ( ( fRenderInfo . fFlags & kRenderJustXMask ) = = kRenderJustXForceLeft )
{
Int16 baseX = fRenderInfo . fX ;
plCharacter & ch = fCharacters [ ( UInt16 ) string [ 0 ] - fFirstChar ] ;
plCharacter & ch = fCharacters [ fFirstChar ] ;
if ( fCharacters . Count ( ) < = ( ( UInt16 ) string [ 0 ] - fFirstChar ) )
if ( wctob ( string [ 0 ] ) ! = EOF )
ch = ( fCharacters [ ( UInt16 ) wctob ( string [ 0 ] ) ] ) ;
else
ch = ( fCharacters [ ( UInt16 ) L ' ' - fFirstChar ] ) ;
else
ch = ( fCharacters [ ( UInt16 ) string [ 0 ] - fFirstChar ] ) ;
fRenderInfo . fX - = ( Int16 ) ch . fLeftKern ;
fRenderInfo . fDestPtr - = ( Int16 ) ch . fLeftKern * fRenderInfo . fDestBPP ;