changeset 32809:abc6b4c527b5

Allow font characters varying in height.
author ib
date Sat, 12 Feb 2011 22:15:18 +0000
parents e67eb882f67a
children 9d5519459be8
files gui/skin/font.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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;