emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Jason Rumney
Subject: [Emacs-diffs] Changes to emacs/src/w32uniscribe.c,v
Date: Fri, 25 Jul 2008 11:25:45 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Jason Rumney <jasonr>   08/07/25 11:25:43

Index: w32uniscribe.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32uniscribe.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- w32uniscribe.c      23 Jul 2008 15:37:44 -0000      1.18
+++ w32uniscribe.c      25 Jul 2008 11:25:43 -0000      1.19
@@ -411,25 +411,36 @@
      struct font *font;
      int c;
 {
-  wchar_t chars[1];
+  wchar_t chars[2];
+  int len;
   WORD indices[1];
   HDC context;
   struct frame *f;
   HFONT old_font;
   DWORD retval;
 
-  /* TODO: surrogates.  */
   if (c > 0xFFFF)
-    return FONT_INVALID_CODE;
+    {
+      DWORD surrogate = c - 0x10000;
 
+      /* High surrogate: U+D800 - U+DBFF.  */
+      chars[0] = 0xD800 + ((surrogate >> 10) & 0x03FF);
+      /* Low surrogate: U+DC00 - U+DFFF.  */
+      chars[1] = 0xDC00 + (surrogate & 0x03FF);
+      len = 2;
+    }
+  else
+    {
   chars[0] = (wchar_t) c;
+      len = 1;
+    }
 
   /* Use selected frame until API is updated to pass the frame.  */
   f = XFRAME (selected_frame);
   context = get_frame_dc (f);
   old_font = SelectObject (context, FONT_HANDLE(font));
 
-  retval = GetGlyphIndicesW (context, chars, 1, indices,
+  retval = GetGlyphIndicesW (context, chars, len, indices,
                             GGI_MARK_NONEXISTING_GLYPHS);
 
   SelectObject (context, old_font);




reply via email to

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