emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/src ChangeLog w32font.c w32font.h w32unis...


From: Jason Rumney
Subject: [Emacs-diffs] emacs/src ChangeLog w32font.c w32font.h w32unis...
Date: Sat, 13 Dec 2008 17:56:29 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Jason Rumney <jasonr>   08/12/13 17:56:29

Modified files:
        src            : ChangeLog w32font.c w32font.h w32uniscribe.c 

Log message:
        * w32font.c (intern_font_name): New function.
        (add_font_name_to_list, w32_enumfont_pattern_entity): Use it.
        (w32font_open_internal, Fx_select_font): Decode font name.
        (fill_in_logfont, list_all_matching_fonts): Encode font name.
        
        * w32font.h (intern_font_name): Declare new function.
        
        * w32uniscribe.c (add_opentype_font_name_to_list):
        Use intern_font_name.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/ChangeLog?cvsroot=emacs&r1=1.7196&r2=1.7197
http://cvs.savannah.gnu.org/viewcvs/emacs/src/w32font.c?cvsroot=emacs&r1=1.63&r2=1.64
http://cvs.savannah.gnu.org/viewcvs/emacs/src/w32font.h?cvsroot=emacs&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/emacs/src/w32uniscribe.c?cvsroot=emacs&r1=1.28&r2=1.29

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/src/ChangeLog,v
retrieving revision 1.7196
retrieving revision 1.7197
diff -u -b -r1.7196 -r1.7197
--- ChangeLog   13 Dec 2008 15:40:22 -0000      1.7196
+++ ChangeLog   13 Dec 2008 17:56:27 -0000      1.7197
@@ -1,3 +1,15 @@
+2008-12-13  Jason Rumney  <address@hidden>
+
+       * w32font.c (intern_font_name): New function.
+       (add_font_name_to_list, w32_enumfont_pattern_entity): Use it.
+       (w32font_open_internal, Fx_select_font): Decode font name.
+       (fill_in_logfont, list_all_matching_fonts): Encode font name.
+
+       * w32font.h (intern_font_name): Declare new function.
+
+       * w32uniscribe.c (add_opentype_font_name_to_list):
+       Use intern_font_name.
+
 2008-12-13  Chong Yidong  <address@hidden>
 
        * frame.c (Fdelete_frame): Call free_font_driver_list.
@@ -32,6 +44,11 @@
 
        * xfns.c (Fx_wm_set_size_hint): Check if the frame is an X frame.
 
+2008-12-12  Jason Rumney  <address@hidden>
+
+       * w32fns.c (x_display_info_for_name, Fx_open_connection): Set
+       Vwindow_system_version to the real w32 major version.
+
 2008-12-12  Dan Nicolaescu  <address@hidden>
 
        * term.c (init_tty): Move setting the terminal name before the

Index: w32font.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32font.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -b -r1.63 -r1.64
--- w32font.c   11 Dec 2008 14:56:09 -0000      1.63
+++ w32font.c   13 Dec 2008 17:56:29 -0000      1.64
@@ -28,6 +28,7 @@
 #include "dispextern.h"
 #include "character.h"
 #include "charset.h"
+#include "coding.h"
 #include "fontset.h"
 #include "font.h"
 #include "w32font.h"
@@ -160,6 +161,26 @@
   return (CONSP (list));
 }
 
+Lisp_Object
+intern_font_name (string)
+     char * string;
+{
+  Lisp_Object obarray, tem, str;
+  int len;
+
+  str = DECODE_SYSTEM (build_string (string));
+  len = SCHARS (str);
+
+  /* The following code is copied from the function intern (in lread.c).  */
+  obarray = Vobarray;
+  if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
+    obarray = check_obarray (obarray);
+  tem = oblookup (obarray, SDATA (str), len, len);
+  if (SYMBOLP (tem))
+    return tem;
+  return Fintern (str, obarray);
+}
+
 /* w32 implementation of get_cache for font backend.
    Return a cache of font-entities on FRAME.  The cache must be a
    cons whose cdr part is the actual cache area.  */
@@ -840,10 +861,10 @@
       }
     if (name)
       font->props[FONT_FULLNAME_INDEX]
-        = make_unibyte_string (name, strlen (name));
+        = DECODE_SYSTEM (build_string (name));
     else
-      font->props[FONT_FULLNAME_INDEX] =
-        make_unibyte_string (logfont.lfFaceName, len);
+      font->props[FONT_FULLNAME_INDEX]
+       = DECODE_SYSTEM (build_string (logfont.lfFaceName));
   }
 
   font->max_width = w32_font->metrics.tmMaxCharWidth;
@@ -922,8 +943,7 @@
   if (logical_font->elfLogFont.lfFaceName[0] == '@')
     return 1;
 
-  family = font_intern_prop (logical_font->elfLogFont.lfFaceName,
-                            strlen (logical_font->elfLogFont.lfFaceName), 1);
+  family = intern_font_name (logical_font->elfLogFont.lfFaceName);
   if (! memq_no_quit (family, *list))
     *list = Fcons (family, *list);
 
@@ -996,7 +1016,7 @@
                       lispy_antialias_type (requested_font->lfQuality));
     }
   ASET (entity, FONT_FAMILY_INDEX,
-        font_intern_prop (lf->lfFaceName, strlen (lf->lfFaceName), 1));
+       intern_font_name (lf->lfFaceName));
 
   FONT_SET_STYLE (entity, FONT_WEIGHT_INDEX,
                  make_number (w32_decode_weight (lf->lfWeight)));
@@ -1891,7 +1911,8 @@
         /* Font families are interned, but allow for strings also in case of
            user input.  */
       else if (SYMBOLP (tmp))
-        strncpy (logfont->lfFaceName, SDATA (SYMBOL_NAME (tmp)), LF_FACESIZE);
+        strncpy (logfont->lfFaceName,
+                SDATA (ENCODE_SYSTEM (SYMBOL_NAME (tmp))), LF_FACESIZE);
     }
 
   tmp = AREF (font_spec, FONT_ADSTYLE_INDEX);
@@ -1977,15 +1998,17 @@
 
   while (!NILP (families))
     {
-      /* TODO: Use the Unicode versions of the W32 APIs, so we can
-         handle non-ASCII font names.  */
+      /* Only fonts from the current locale are given localized names
+        on Windows, so we can keep backwards compatibility with
+        Windows 9x/ME by using non-Unicode font enumeration without
+        sacrificing internationalization here.  */
       char *name;
       Lisp_Object family = CAR (families);
       families = CDR (families);
       if (NILP (family))
         continue;
       else if (SYMBOLP (family))
-        name = SDATA (SYMBOL_NAME (family));
+        name = SDATA (ENCODE_SYSTEM (SYMBOL_NAME (family)));
       else
        continue;
 
@@ -2391,7 +2414,7 @@
       || logfont_to_fcname (&lf, cf.iPointSize, buf, 100) < 0)
     return Qnil;
 
-  return build_string (buf);
+  return DECODE_SYSTEM (build_string (buf));
 }
 
 struct font_driver w32font_driver =

Index: w32font.h
===================================================================
RCS file: /sources/emacs/emacs/src/w32font.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- w32font.h   30 Jul 2008 21:45:35 -0000      1.12
+++ w32font.h   13 Dec 2008 17:56:29 -0000      1.13
@@ -81,6 +81,8 @@
 
 int uniscribe_check_otf P_ ((LOGFONT *font, Lisp_Object otf_spec));
 
+Lisp_Object intern_font_name P_ ((char *));
+
 #endif
 
 /* arch-tag: ef9d9675-a2a5-4d01-9526-815e9a3da7cb

Index: w32uniscribe.c
===================================================================
RCS file: /sources/emacs/emacs/src/w32uniscribe.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- w32uniscribe.c      11 Dec 2008 13:01:22 -0000      1.28
+++ w32uniscribe.c      13 Dec 2008 17:56:29 -0000      1.29
@@ -601,8 +601,7 @@
       && !(physical_font->ntmFontSig.fsUsb[0] & 0x3fffffff))
     return 1;
 
-  family = font_intern_prop (logical_font->elfLogFont.lfFaceName,
-                            strlen (logical_font->elfLogFont.lfFaceName), 1);
+  family = intern_font_name (logical_font->elfLogFont.lfFaceName);
   if (! memq_no_quit (family, *list))
     *list = Fcons (family, *list);
 




reply via email to

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