# HG changeset patch # User ib # Date 1297548918 0 # Node ID abc6b4c527b530438853e88c205fc0bfff3f1357 # Parent e67eb882f67a0f3d02afafe49536838b2a1b5c70 Allow font characters varying in height. diff -r e67eb882f67a -r abc6b4c527b5 gui/skin/font.c --- a/gui/skin/font.c Sat Feb 12 16:52:23 2011 +0000 +++ b/gui/skin/font.c Sat Feb 12 22:15:18 2011 +0000 @@ -237,7 +237,7 @@ txSample * fntRender( wItem * item,int px,char * txt ) { unsigned char * u; - int c, i, dx = 0, tw, fbw, iw, id, ofs; + int c, i, dx = 0, tw, th, fbw, iw, id, ofs; int x,y,fh,fw,fyc,yc; uint32_t * ibuf; uint32_t * obuf; @@ -250,10 +250,17 @@ iw=item->width; fbw=Fonts[id]->Bitmap.Width; + th=fntTextHeight(id, txt); + + if (item->Bitmap.Image && (item->height != th)) + { + free(item->Bitmap.Image); + item->Bitmap.Image = NULL; + } if ( item->Bitmap.Image == NULL ) { - item->Bitmap.Height=item->height=fntTextHeight( id,txt ); + item->Bitmap.Height=item->height=th; item->Bitmap.Width=item->width=iw; item->Bitmap.ImageSize=item->height * iw * 4; if ( !item->Bitmap.ImageSize ) return NULL;