changeset 100627:4159567b77d7

(uniscribe_encode_char): Return FONT_INVALID_CHAR when character maps to .notdef character.
author Jason Rumney <jasonr@gnu.org>
date Sun, 21 Dec 2008 15:51:29 +0000
parents 096796d792df
children ec52420d2c02
files src/w32uniscribe.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/w32uniscribe.c	Sun Dec 21 11:03:30 2008 +0000
+++ b/src/w32uniscribe.c	Sun Dec 21 15:51:29 2008 +0000
@@ -516,7 +516,10 @@
 
           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 @@
                  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... */
             }
 	}
     }