aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2008-12-13 17:56:27 +0000
committerJason Rumney2008-12-13 17:56:27 +0000
commite6df5336489bdb73c6e9b1c72b27d190ce8aa224 (patch)
tree8e0833deeeab72dccc9110ea833cab6f5f23634f /src
parentebbbc028abed83c5199092327c735aa38bf6250e (diff)
downloademacs-e6df5336489bdb73c6e9b1c72b27d190ce8aa224.tar.gz
emacs-e6df5336489bdb73c6e9b1c72b27d190ce8aa224.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog17
-rw-r--r--src/w32font.c45
-rw-r--r--src/w32font.h2
-rw-r--r--src/w32uniscribe.c3
4 files changed, 54 insertions, 13 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f73e6d3f72a..47922061be2 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
12008-12-13 Jason Rumney <jasonr@gnu.org>
2
3 * w32font.c (intern_font_name): New function.
4 (add_font_name_to_list, w32_enumfont_pattern_entity): Use it.
5 (w32font_open_internal, Fx_select_font): Decode font name.
6 (fill_in_logfont, list_all_matching_fonts): Encode font name.
7
8 * w32font.h (intern_font_name): Declare new function.
9
10 * w32uniscribe.c (add_opentype_font_name_to_list):
11 Use intern_font_name.
12
12008-12-13 Chong Yidong <cyd@stupidchicken.com> 132008-12-13 Chong Yidong <cyd@stupidchicken.com>
2 14
3 * frame.c (Fdelete_frame): Call free_font_driver_list. 15 * frame.c (Fdelete_frame): Call free_font_driver_list.
@@ -32,6 +44,11 @@
32 44
33 * xfns.c (Fx_wm_set_size_hint): Check if the frame is an X frame. 45 * xfns.c (Fx_wm_set_size_hint): Check if the frame is an X frame.
34 46
472008-12-12 Jason Rumney <jasonr@gnu.org>
48
49 * w32fns.c (x_display_info_for_name, Fx_open_connection): Set
50 Vwindow_system_version to the real w32 major version.
51
352008-12-12 Dan Nicolaescu <dann@ics.uci.edu> 522008-12-12 Dan Nicolaescu <dann@ics.uci.edu>
36 53
37 * term.c (init_tty): Move setting the terminal name before the 54 * term.c (init_tty): Move setting the terminal name before the
diff --git a/src/w32font.c b/src/w32font.c
index 4cfa8a242c6..f892adeb636 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -28,6 +28,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28#include "dispextern.h" 28#include "dispextern.h"
29#include "character.h" 29#include "character.h"
30#include "charset.h" 30#include "charset.h"
31#include "coding.h"
31#include "fontset.h" 32#include "fontset.h"
32#include "font.h" 33#include "font.h"
33#include "w32font.h" 34#include "w32font.h"
@@ -160,6 +161,26 @@ memq_no_quit (elt, list)
160 return (CONSP (list)); 161 return (CONSP (list));
161} 162}
162 163
164Lisp_Object
165intern_font_name (string)
166 char * string;
167{
168 Lisp_Object obarray, tem, str;
169 int len;
170
171 str = DECODE_SYSTEM (build_string (string));
172 len = SCHARS (str);
173
174 /* The following code is copied from the function intern (in lread.c). */
175 obarray = Vobarray;
176 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
177 obarray = check_obarray (obarray);
178 tem = oblookup (obarray, SDATA (str), len, len);
179 if (SYMBOLP (tem))
180 return tem;
181 return Fintern (str, obarray);
182}
183
163/* w32 implementation of get_cache for font backend. 184/* w32 implementation of get_cache for font backend.
164 Return a cache of font-entities on FRAME. The cache must be a 185 Return a cache of font-entities on FRAME. The cache must be a
165 cons whose cdr part is the actual cache area. */ 186 cons whose cdr part is the actual cache area. */
@@ -840,10 +861,10 @@ w32font_open_internal (f, font_entity, pixel_size, font_object)
840 } 861 }
841 if (name) 862 if (name)
842 font->props[FONT_FULLNAME_INDEX] 863 font->props[FONT_FULLNAME_INDEX]
843 = make_unibyte_string (name, strlen (name)); 864 = DECODE_SYSTEM (build_string (name));
844 else 865 else
845 font->props[FONT_FULLNAME_INDEX] = 866 font->props[FONT_FULLNAME_INDEX]
846 make_unibyte_string (logfont.lfFaceName, len); 867 = DECODE_SYSTEM (build_string (logfont.lfFaceName));
847 } 868 }
848 869
849 font->max_width = w32_font->metrics.tmMaxCharWidth; 870 font->max_width = w32_font->metrics.tmMaxCharWidth;
@@ -922,8 +943,7 @@ add_font_name_to_list (logical_font, physical_font, font_type, list_object)
922 if (logical_font->elfLogFont.lfFaceName[0] == '@') 943 if (logical_font->elfLogFont.lfFaceName[0] == '@')
923 return 1; 944 return 1;
924 945
925 family = font_intern_prop (logical_font->elfLogFont.lfFaceName, 946 family = intern_font_name (logical_font->elfLogFont.lfFaceName);
926 strlen (logical_font->elfLogFont.lfFaceName), 1);
927 if (! memq_no_quit (family, *list)) 947 if (! memq_no_quit (family, *list))
928 *list = Fcons (family, *list); 948 *list = Fcons (family, *list);
929 949
@@ -996,7 +1016,7 @@ w32_enumfont_pattern_entity (frame, logical_font, physical_font,
996 lispy_antialias_type (requested_font->lfQuality)); 1016 lispy_antialias_type (requested_font->lfQuality));
997 } 1017 }
998 ASET (entity, FONT_FAMILY_INDEX, 1018 ASET (entity, FONT_FAMILY_INDEX,
999 font_intern_prop (lf->lfFaceName, strlen (lf->lfFaceName), 1)); 1019 intern_font_name (lf->lfFaceName));
1000 1020
1001 FONT_SET_STYLE (entity, FONT_WEIGHT_INDEX, 1021 FONT_SET_STYLE (entity, FONT_WEIGHT_INDEX,
1002 make_number (w32_decode_weight (lf->lfWeight))); 1022 make_number (w32_decode_weight (lf->lfWeight)));
@@ -1891,7 +1911,8 @@ fill_in_logfont (f, logfont, font_spec)
1891 /* Font families are interned, but allow for strings also in case of 1911 /* Font families are interned, but allow for strings also in case of
1892 user input. */ 1912 user input. */
1893 else if (SYMBOLP (tmp)) 1913 else if (SYMBOLP (tmp))
1894 strncpy (logfont->lfFaceName, SDATA (SYMBOL_NAME (tmp)), LF_FACESIZE); 1914 strncpy (logfont->lfFaceName,
1915 SDATA (ENCODE_SYSTEM (SYMBOL_NAME (tmp))), LF_FACESIZE);
1895 } 1916 }
1896 1917
1897 tmp = AREF (font_spec, FONT_ADSTYLE_INDEX); 1918 tmp = AREF (font_spec, FONT_ADSTYLE_INDEX);
@@ -1977,15 +1998,17 @@ list_all_matching_fonts (match_data)
1977 1998
1978 while (!NILP (families)) 1999 while (!NILP (families))
1979 { 2000 {
1980 /* TODO: Use the Unicode versions of the W32 APIs, so we can 2001 /* Only fonts from the current locale are given localized names
1981 handle non-ASCII font names. */ 2002 on Windows, so we can keep backwards compatibility with
2003 Windows 9x/ME by using non-Unicode font enumeration without
2004 sacrificing internationalization here. */
1982 char *name; 2005 char *name;
1983 Lisp_Object family = CAR (families); 2006 Lisp_Object family = CAR (families);
1984 families = CDR (families); 2007 families = CDR (families);
1985 if (NILP (family)) 2008 if (NILP (family))
1986 continue; 2009 continue;
1987 else if (SYMBOLP (family)) 2010 else if (SYMBOLP (family))
1988 name = SDATA (SYMBOL_NAME (family)); 2011 name = SDATA (ENCODE_SYSTEM (SYMBOL_NAME (family)));
1989 else 2012 else
1990 continue; 2013 continue;
1991 2014
@@ -2391,7 +2414,7 @@ in the font selection dialog. */)
2391 || logfont_to_fcname (&lf, cf.iPointSize, buf, 100) < 0) 2414 || logfont_to_fcname (&lf, cf.iPointSize, buf, 100) < 0)
2392 return Qnil; 2415 return Qnil;
2393 2416
2394 return build_string (buf); 2417 return DECODE_SYSTEM (build_string (buf));
2395} 2418}
2396 2419
2397struct font_driver w32font_driver = 2420struct font_driver w32font_driver =
diff --git a/src/w32font.h b/src/w32font.h
index 748b329f8da..180a5b873ba 100644
--- a/src/w32font.h
+++ b/src/w32font.h
@@ -81,6 +81,8 @@ int w32font_draw P_ ((struct glyph_string *s, int from, int to,
81 81
82int uniscribe_check_otf P_ ((LOGFONT *font, Lisp_Object otf_spec)); 82int uniscribe_check_otf P_ ((LOGFONT *font, Lisp_Object otf_spec));
83 83
84Lisp_Object intern_font_name P_ ((char *));
85
84#endif 86#endif
85 87
86/* arch-tag: ef9d9675-a2a5-4d01-9526-815e9a3da7cb 88/* arch-tag: ef9d9675-a2a5-4d01-9526-815e9a3da7cb
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 12870129776..14ce7449a09 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -601,8 +601,7 @@ add_opentype_font_name_to_list (logical_font, physical_font, font_type,
601 && !(physical_font->ntmFontSig.fsUsb[0] & 0x3fffffff)) 601 && !(physical_font->ntmFontSig.fsUsb[0] & 0x3fffffff))
602 return 1; 602 return 1;
603 603
604 family = font_intern_prop (logical_font->elfLogFont.lfFaceName, 604 family = intern_font_name (logical_font->elfLogFont.lfFaceName);
605 strlen (logical_font->elfLogFont.lfFaceName), 1);
606 if (! memq_no_quit (family, *list)) 605 if (! memq_no_quit (family, *list))
607 *list = Fcons (family, *list); 606 *list = Fcons (family, *list);
608 607