From 1fc200d61fd9acdea40fea3239decea32d35bde4 Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Sun, 21 Dec 2008 15:52:26 +0000 Subject: [PATCH] (uniscribe_encode_char): Return FONT_INVALID_CHAR when character maps to .notdef character. --- src/ChangeLog | 5 +++++ src/w32uniscribe.c | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ae758b60dcf..015f8f3dc7c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-12-21 Jason Rumney + + * w32uniscribe.c (uniscribe_encode_char): Return FONT_INVALID_CHAR + when character maps to .notdef character. + 2008-12-21 Stefan Monnier * keyboard.c (cmd_error_internal): Don't exit in daemon mode, bug#1310. diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index 14ce7449a09..1b5984fbea6 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -516,7 +516,10 @@ uniscribe_encode_char (font, c) if (SUCCEEDED (result) && nglyphs == 1) { - code = glyphs[0]; + /* Some fonts return .notdef glyphs instead of failing. + (Truetype spec reserves glyph code 0 for .notdef) */ + if (glyphs[0]) + code = glyphs[0]; } else if (SUCCEEDED (result) || result == E_OUTOFMEMORY) { @@ -526,11 +529,8 @@ uniscribe_encode_char (font, c) later. */ result = ScriptGetCMap (context, &(uniscribe_font->cache), ch, len, 0, glyphs); - if (SUCCEEDED (result)) + if (SUCCEEDED (result) && glyphs[0]) code = glyphs[0]; - else - code = 0; /* notdef - enough in some cases to get the script - engine working, but not others... */ } } } -- 2.39.2