1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed a crash in cFreetypeFont::DrawText() if an unknown symbol is encountered; unknown symbols are replaced with a '?'

This commit is contained in:
Klaus Schmidinger 2008-02-29 13:41:11 +01:00
parent ff04bc72fd
commit 91dff73cf4
3 changed files with 9 additions and 1 deletions

View File

@ -2100,6 +2100,7 @@ Tobias Grimm <listaccount@e-tobi.net>
for fixing a memory leak in closing the video file during replay
for fixing deleting the 'skinDescriptions' in cMenuSetupOSD::~cMenuSetupOSD()
for reporting that GCC 4.3 issues a silly warning for expressions like 'a || b && c'
for fixing a crash in cFreetypeFont::DrawText() if an unknown symbol is encountered
Helge Lenz <h.lenz@gmx.de>
for reporting a bug in setting the 'Delta' parameter when calling the shutdown

View File

@ -5682,3 +5682,5 @@ Video Disk Recorder Revision History
- Updated French language texts (thanks to Jean-Claude Repetto).
- Fixed handling 3 and 4 byte UTF-8 symbols in Utf8CharGet() (thanks to Andreas
Mair).
- Fixed a crash in cFreetypeFont::DrawText() if an unknown symbol is encountered
(thanks to Tobias Grimm). Unknown symbols are replaced with a '?'.

7
font.c
View File

@ -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();