summaryrefslogtreecommitdiffstats
path: root/Gui
diff options
context:
space:
mode:
Diffstat (limited to 'Gui')
-rw-r--r--Gui/skin/font.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/Gui/skin/font.c b/Gui/skin/font.c
index 7db2d6ea30..65f196fe73 100644
--- a/Gui/skin/font.c
+++ b/Gui/skin/font.c
@@ -119,7 +119,11 @@ int fntTextWidth( int id,char * str )
if ( ( !Fonts[id] )||( !str[0] ) ) return 0;
for ( i=0;i < (unsigned int)strlen( str );i++ )
- size+=( Fonts[id]->Fnt[ (unsigned char)str[i] ].sx == -1? Fonts[id]->Fnt[ 32 ].sx : Fonts[id]->Fnt[ (unsigned char)str[i] ].sx );
+ {
+ unsigned char c = (unsigned char)str[i];
+ if ( Fonts[id]->Fnt[c].sx == -1 ) c = ' ';
+ size+= Fonts[id]->Fnt[ c ].sx;
+ }
return size;
}
@@ -131,7 +135,10 @@ int fntTextHeight( int id,char * str )
for ( i=0;i < (int)strlen( str );i++ )
{
- int h = Fonts[id]->Fnt[ (unsigned char)str[i] ].sy;
+ int h;
+ unsigned char c = (unsigned char)str[i];
+ if ( Fonts[id]->Fnt[c].sx == -1 ) c = ' ';
+ h = Fonts[id]->Fnt[c].sy;
if ( h > max ) max=h;
}
return max;