From: divverent Date: Tue, 19 Jan 2010 20:55:06 +0000 (+0000) Subject: fix off-by-one bug rendering characters like U+0100 X-Git-Tag: xonotic-v0.1.0preview~230^2~630 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=29478d4df70c89f561914e06f61bcd41df7e3ce5;p=xonotic%2Fdarkplaces.git fix off-by-one bug rendering characters like U+0100 git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9839 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/ft2.c b/ft2.c index 0e7d31c6..e983fc63 100644 --- a/ft2.c +++ b/ft2.c @@ -1202,7 +1202,7 @@ qboolean Font_LoadMapForIndex(ft2_font_t *font, int map_index, Uchar _ch, ft2_fo ft2_font_map_t *FontMap_FindForChar(ft2_font_map_t *start, Uchar ch) { - while (start && start->start + FONT_CHARS_PER_MAP < ch) + while (start && start->start + FONT_CHARS_PER_MAP <= ch) start = start->next; if (start && start->start > ch) return NULL; diff --git a/gl_draw.c b/gl_draw.c index da593501..2f058761 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -1241,7 +1241,8 @@ float DrawQ_TextWidth_UntilWidth_TrackColors_Scale(const char *text, size_t *max } x += width_of[ch] * dw; } else { - if (!map || map == ft2_oldstyle_map || map->start < ch || map->start + FONT_CHARS_PER_MAP >= ch) + //if (!map || map == ft2_oldstyle_map || map->start < ch || map->start + FONT_CHARS_PER_MAP >= ch) + if (!map || map == ft2_oldstyle_map || ch < map->start || ch >= map->start + FONT_CHARS_PER_MAP) { map = FontMap_FindForChar(fontmap, ch); if (!map)