]> git.eshelyaron.com Git - emacs.git/commitdiff
(uniscribe_encode_char): Return FONT_INVALID_CHAR
authorJason Rumney <jasonr@gnu.org>
Sun, 21 Dec 2008 15:52:26 +0000 (15:52 +0000)
committerJason Rumney <jasonr@gnu.org>
Sun, 21 Dec 2008 15:52:26 +0000 (15:52 +0000)
when character maps to .notdef character.

src/ChangeLog
src/w32uniscribe.c

index ae758b60dcf1ebe84d314fe4c7aabeb62ed59737..015f8f3dc7ca34de6984f3c4dbac425389ec7e4c 100644 (file)
@@ -1,3 +1,8 @@
+2008-12-21  Jason Rumney  <jasonr@gnu.org>
+
+       * w32uniscribe.c (uniscribe_encode_char): Return FONT_INVALID_CHAR
+       when character maps to .notdef character.
+
 2008-12-21  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * keyboard.c (cmd_error_internal): Don't exit in daemon mode, bug#1310.
index 14ce7449a09fa0f380714de77139ba0d2f1b668c..1b5984fbea6a180bb8fcd1fdcebbe339f8d3c442 100644 (file)
@@ -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... */
             }
        }
     }