/*#*
*#* $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.
+ *#*
*#* Revision 1.5 2006/03/07 22:18:04 bernie
*#* Correctly compute text width for prop fonts; Make styles a per-bitmap attribute.
*#*
struct TextWidthData
{
- Bitmap *bitmap;
- coord_t width;
+ Bitmap *bitmap;
+ coord_t width;
};
/**
coord_t glyph_width;
- if (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;
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;
}