X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=gfx%2Ftext_format.c;h=54dab7c866e373e8c7a6d1c596237b50ace63aee;hb=c49c99e64ee64ad490b2aea2d6c6d8f9f6d225db;hp=1b0e8a340571b976f160a7466807a7bb2ea1d500;hpb=42b50d5905e886d792cd1a338c446ac43f61d6cf;p=bertos.git diff --git a/gfx/text_format.c b/gfx/text_format.c index 1b0e8a34..54dab7c8 100755 --- a/gfx/text_format.c +++ b/gfx/text_format.c @@ -15,6 +15,12 @@ /*#* *#* $Log$ + *#* Revision 1.8 2006/03/22 09:50:11 bernie + *#* Don't use C99 stuff. + *#* + *#* Revision 1.7 2006/03/20 17:51:55 bernie + *#* Cleanups. + *#* *#* Revision 1.6 2006/03/13 02:05:54 bernie *#* Mark slow paths as UNLIKELY. *#* @@ -199,8 +205,8 @@ int PGM_FUNC(text_xprintf)(struct Bitmap *bm, struct TextWidthData { - Bitmap *bitmap; - coord_t width; + Bitmap *bitmap; + coord_t width; }; /** @@ -222,9 +228,9 @@ static int text_charWidth(int c, struct TextWidthData *twd) coord_t glyph_width; - if (UNLIKELY(index < bm->font->first || index > bm->font->last)) + if (UNLIKELY(!FONT_HAS_GLYPH(bm->font, index))) { - if ('?' >= bm->font->first && '?' <= bm->font->last) + if (!FONT_HAS_GLYPH(bm->font, '?')) index = '?'; else index = bm->font->first; @@ -264,7 +270,9 @@ int PGM_FUNC(text_vwidthf)( return PGM_FUNC(vsprintf)(NULL, fmt, ap) * bm->font->width; else { - struct TextWidthData twd = { bm, 0 }; + struct TextWidthData twd; + twd.bitmap = bm; + twd.width = 0; _formatted_write(fmt, (void (*)(char, void *))text_charWidth, &twd, ap); return twd.width; }