summaryrefslogtreecommitdiff
path: root/font.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2008-02-29 13:41:11 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2008-02-29 13:41:11 +0100
commit91dff73cf48d96a17c66b6476c48326aa379c409 (patch)
tree2b6186f9f7112942795f45a840df1b85b012616c /font.c
parentff04bc72fd71e3e1771d21358c315255f9790715 (diff)
downloadvdr-91dff73cf48d96a17c66b6476c48326aa379c409.tar.gz
vdr-91dff73cf48d96a17c66b6476c48326aa379c409.tar.bz2
Fixed a crash in cFreetypeFont::DrawText() if an unknown symbol is encountered; unknown symbols are replaced with a '?'
Diffstat (limited to 'font.c')
-rw-r--r--font.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/font.c b/font.c
index 2f14d14f..7e52a5f5 100644
--- a/font.c
+++ b/font.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: font.c 1.23 2008/02/09 11:52:25 kls Exp $
+ * $Id: font.c 1.24 2008/02/29 13:35:15 kls Exp $
*/
#include "font.h"
@@ -214,6 +214,9 @@ cGlyph* cFreetypeFont::Glyph(uint CharCode, bool AntiAliased) const
return Glyph;
}
}
+#define UNKNOWN_GLYPH_INDICATOR '?'
+ if (CharCode != UNKNOWN_GLYPH_INDICATOR)
+ return Glyph(UNKNOWN_GLYPH_INDICATOR);
return NULL;
}
@@ -258,6 +261,8 @@ void cFreetypeFont::DrawText(cBitmap *Bitmap, int x, int y, const char *s, tColo
uint sym = Utf8CharGet(s, sl);
s += sl;
cGlyph *g = Glyph(sym, AntiAliased);
+ if (!g)
+ continue;
int kerning = Kerning(g, prevSym);
prevSym = sym;
uchar *buffer = g->Bitmap();