emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/w32font.c,v


From: Jason Rumney
Subject: [Emacs-diffs] Changes to emacs/src/w32font.c,v
Date: Wed, 11 Jun 2008 22:39:43 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Jason Rumney <jasonr>   08/06/11 22:39:43

Index: w32font.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32font.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- w32font.c   10 Jun 2008 02:07:06 -0000      1.35
+++ w32font.c   11 Jun 2008 22:39:43 -0000      1.36
@@ -310,6 +310,9 @@
   dc = get_frame_dc (f);
   old_font = SelectObject (dc, w32_font->compat_w32_font->hfont);
 
+  /* GetCharacterPlacement is used here rather than GetGlyphIndices because
+     it is supported on Windows NT 4 and 9x/ME.  But it cannot reliably report
+     missing glyphs, see below for workaround.  */
   retval = GetCharacterPlacementW (dc, in, len, 0, &result, 0);
 
   SelectObject (dc, old_font);
@@ -317,7 +320,11 @@
 
   if (retval)
     {
-      if (result.nGlyphs != 1 || !result.lpGlyphs[0])
+      if (result.nGlyphs != 1 || !result.lpGlyphs[0]
+          /* GetCharacterPlacementW seems to return 3, which seems to be
+             the space glyph in most/all truetype fonts, instead of 0
+             for unsupported glyphs.  */
+          || (result.lpGlyphs[0] == 3 && !iswspace (in[0])))
         return FONT_INVALID_CODE;
       return result.lpGlyphs[0];
     }
@@ -1360,7 +1367,9 @@
           /* If registry was specified as iso10646-1, only report
              ANSI and DEFAULT charsets, as most unicode fonts will
              contain one of those plus others.  */
-          if (EQ (spec_charset, Qiso10646_1)
+          if ((EQ (spec_charset, Qiso10646_1)
+               || EQ (spec_charset, Qunicode_bmp)
+               || EQ (spec_charset, Qunicode_sip))
               && logical_font->elfLogFont.lfCharSet != DEFAULT_CHARSET
               && logical_font->elfLogFont.lfCharSet != ANSI_CHARSET)
             return 1;
@@ -1370,6 +1379,8 @@
              least it eliminates known definite mismatches.  */
           else if (!NILP (spec_charset)
                    && !EQ (spec_charset, Qiso10646_1)
+                   && !EQ (spec_charset, Qunicode_bmp)
+                   && !EQ (spec_charset, Qunicode_sip)
                    && match_data->pattern.lfCharSet == DEFAULT_CHARSET
                    && logical_font->elfLogFont.lfCharSet != DEFAULT_CHARSET)
             return 1;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]