Mercurial > emacs
annotate src/w32font.c @ 91505:24e0f42ae574
Adjust dates of unicode merge entries to UTC.
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1046
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 04 Feb 2008 09:38:39 +0000 |
parents | d3d1ab7e6e35 |
children | e96ff7166c81 |
rev | line source |
---|---|
90869 | 1 /* Font backend for the Microsoft W32 API. |
91447
15ea95e2d57b
Update copyright years and GPL version.
Glenn Morris <rgm@gnu.org>
parents:
91264
diff
changeset
|
2 Copyright (C) 2007, 2008 Free Software Foundation, Inc. |
90869 | 3 |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
91447
15ea95e2d57b
Update copyright years and GPL version.
Glenn Morris <rgm@gnu.org>
parents:
91264
diff
changeset
|
8 the Free Software Foundation; either version 3, or (at your option) |
90869 | 9 any later version. |
10 | |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GNU Emacs; see the file COPYING. If not, write to | |
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
19 Boston, MA 02110-1301, USA. */ | |
20 | |
21 #include <config.h> | |
22 #include <windows.h> | |
23 | |
24 #include "lisp.h" | |
25 #include "w32term.h" | |
26 #include "frame.h" | |
27 #include "dispextern.h" | |
28 #include "character.h" | |
29 #include "charset.h" | |
30 #include "fontset.h" | |
31 #include "font.h" | |
91208 | 32 #include "w32font.h" |
90869 | 33 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
34 /* Cleartype available on Windows XP, cleartype_natural from XP SP1. |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
35 The latter does not try to fit cleartype smoothed fonts into the |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
36 same bounding box as the non-antialiased version of the font. |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
37 */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
38 #ifndef CLEARTYPE_QUALITY |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
39 #define CLEARTYPE_QUALITY 5 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
40 #endif |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
41 #ifndef CLEARTYPE_NATURAL_QUALITY |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
42 #define CLEARTYPE_NATURAL_QUALITY 6 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
43 #endif |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
44 |
90869 | 45 extern struct font_driver w32font_driver; |
46 | |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
47 Lisp_Object Qgdi; |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
48 static Lisp_Object Qmonospace, Qsansserif, Qmono, Qsans, Qsans_serif; |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
49 static Lisp_Object Qserif, Qscript, Qdecorative; |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
50 static Lisp_Object Qraster, Qoutline, Qunknown; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
51 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
52 /* antialiasing */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
53 extern Lisp_Object QCantialias; /* defined in font.c */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
54 extern Lisp_Object Qnone; /* reuse from w32fns.c */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
55 static Lisp_Object Qstandard, Qsubpixel, Qnatural; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
56 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
57 /* scripts */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
58 static Lisp_Object Qlatin, Qgreek, Qcoptic, Qcyrillic, Qarmenian, Qhebrew; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
59 static Lisp_Object Qarabic, Qsyriac, Qnko, Qthaana, Qdevanagari, Qbengali; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
60 static Lisp_Object Qgurmukhi, Qgujarati, Qoriya, Qtamil, Qtelugu; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
61 static Lisp_Object Qkannada, Qmalayalam, Qsinhala, Qthai, Qlao; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
62 static Lisp_Object Qtibetan, Qmyanmar, Qgeorgian, Qhangul, Qethiopic; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
63 static Lisp_Object Qcherokee, Qcanadian_aboriginal, Qogham, Qrunic; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
64 static Lisp_Object Qkhmer, Qmongolian, Qsymbol, Qbraille, Qhan; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
65 static Lisp_Object Qideographic_description, Qcjk_misc, Qkana, Qbopomofo; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
66 static Lisp_Object Qkanbun, Qyi, Qbyzantine_musical_symbol; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
67 static Lisp_Object Qmusical_symbol, Qmathematical; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
68 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
69 /* Font spacing symbols - defined in font.c. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
70 extern Lisp_Object Qc, Qp, Qm; |
90869 | 71 |
72 static void fill_in_logfont P_ ((FRAME_PTR f, LOGFONT *logfont, | |
73 Lisp_Object font_spec)); | |
74 | |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
75 static BYTE w32_antialias_type P_ ((Lisp_Object type)); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
76 static Lisp_Object lispy_antialias_type P_ ((BYTE type)); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
77 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
78 static Lisp_Object font_supported_scripts P_ ((FONTSIGNATURE * sig)); |
90869 | 79 |
80 /* From old font code in w32fns.c */ | |
81 char * w32_to_x_charset P_ ((int charset, char * matching)); | |
82 | |
83 static Lisp_Object w32_registry P_ ((LONG w32_charset)); | |
84 | |
85 /* EnumFontFamiliesEx callbacks. */ | |
86 static int CALLBACK add_font_entity_to_list P_ ((ENUMLOGFONTEX *, | |
87 NEWTEXTMETRICEX *, | |
88 DWORD, LPARAM)); | |
89 static int CALLBACK add_one_font_entity_to_list P_ ((ENUMLOGFONTEX *, | |
90 NEWTEXTMETRICEX *, | |
91 DWORD, LPARAM)); | |
92 static int CALLBACK add_font_name_to_list P_ ((ENUMLOGFONTEX *, | |
93 NEWTEXTMETRICEX *, | |
94 DWORD, LPARAM)); | |
95 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
96 /* struct passed in as LPARAM arg to EnumFontFamiliesEx, for keeping track |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
97 of what we really want. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
98 struct font_callback_data |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
99 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
100 /* The logfont we are matching against. EnumFontFamiliesEx only matches |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
101 face name and charset, so we need to manually match everything else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
102 in the callback function. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
103 LOGFONT pattern; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
104 /* The original font spec or entity. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
105 Lisp_Object orig_font_spec; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
106 /* The frame the font is being loaded on. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
107 Lisp_Object frame; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
108 /* The list to add matches to. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
109 Lisp_Object list; |
91208 | 110 /* Whether to match only opentype fonts. */ |
111 int opentype_only; | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
112 }; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
113 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
114 /* Handles the problem that EnumFontFamiliesEx will not return all |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
115 style variations if the font name is not specified. */ |
91182
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
116 static void list_all_matching_fonts P_ ((struct font_callback_data *match)); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
117 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
118 |
90869 | 119 /* MingW headers only define this when _WIN32_WINNT >= 0x0500, but we |
120 target older versions. */ | |
91182
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
121 #ifndef GGI_MARK_NONEXISTING_GLYPHS |
90869 | 122 #define GGI_MARK_NONEXISTING_GLYPHS 1 |
91182
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
123 #endif |
90869 | 124 |
125 static int | |
126 memq_no_quit (elt, list) | |
127 Lisp_Object elt, list; | |
128 { | |
129 while (CONSP (list) && ! EQ (XCAR (list), elt)) | |
130 list = XCDR (list); | |
131 return (CONSP (list)); | |
132 } | |
133 | |
134 /* w32 implementation of get_cache for font backend. | |
135 Return a cache of font-entities on FRAME. The cache must be a | |
136 cons whose cdr part is the actual cache area. */ | |
91208 | 137 Lisp_Object |
91246
3a1805edf0b5
(w32font_get_cache): Adjust the argument type.
Kenichi Handa <handa@m17n.org>
parents:
91211
diff
changeset
|
138 w32font_get_cache (f) |
3a1805edf0b5
(w32font_get_cache): Adjust the argument type.
Kenichi Handa <handa@m17n.org>
parents:
91211
diff
changeset
|
139 FRAME_PTR f; |
90869 | 140 { |
91246
3a1805edf0b5
(w32font_get_cache): Adjust the argument type.
Kenichi Handa <handa@m17n.org>
parents:
91211
diff
changeset
|
141 struct w32_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
90869 | 142 |
143 return (dpyinfo->name_list_element); | |
144 } | |
145 | |
146 /* w32 implementation of list for font backend. | |
147 List fonts exactly matching with FONT_SPEC on FRAME. The value | |
148 is a vector of font-entities. This is the sole API that | |
149 allocates font-entities. */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
150 static Lisp_Object |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
151 w32font_list (frame, font_spec) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
152 Lisp_Object frame, font_spec; |
90869 | 153 { |
91208 | 154 return w32font_list_internal (frame, font_spec, 0); |
90869 | 155 } |
156 | |
157 /* w32 implementation of match for font backend. | |
158 Return a font entity most closely matching with FONT_SPEC on | |
159 FRAME. The closeness is detemined by the font backend, thus | |
160 `face-font-selection-order' is ignored here. */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
161 static Lisp_Object |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
162 w32font_match (frame, font_spec) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
163 Lisp_Object frame, font_spec; |
90869 | 164 { |
91208 | 165 return w32font_match_internal (frame, font_spec, 0); |
90869 | 166 } |
167 | |
168 /* w32 implementation of list_family for font backend. | |
169 List available families. The value is a list of family names | |
170 (symbols). */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
171 static Lisp_Object |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
172 w32font_list_family (frame) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
173 Lisp_Object frame; |
90869 | 174 { |
175 Lisp_Object list = Qnil; | |
176 LOGFONT font_match_pattern; | |
177 HDC dc; | |
178 FRAME_PTR f = XFRAME (frame); | |
179 | |
180 bzero (&font_match_pattern, sizeof (font_match_pattern)); | |
181 | |
182 dc = get_frame_dc (f); | |
183 | |
184 EnumFontFamiliesEx (dc, &font_match_pattern, | |
185 (FONTENUMPROC) add_font_name_to_list, | |
186 (LPARAM) &list, 0); | |
187 release_frame_dc (f, dc); | |
188 | |
189 return list; | |
190 } | |
191 | |
192 /* w32 implementation of open for font backend. | |
193 Open a font specified by FONT_ENTITY on frame F. | |
194 If the font is scalable, open it with PIXEL_SIZE. */ | |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
195 static struct font * |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
196 w32font_open (f, font_entity, pixel_size) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
197 FRAME_PTR f; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
198 Lisp_Object font_entity; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
199 int pixel_size; |
90869 | 200 { |
201 struct w32font_info *w32_font = xmalloc (sizeof (struct w32font_info)); | |
202 | |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
203 if (w32_font == NULL) |
90869 | 204 return NULL; |
205 | |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
206 if (!w32font_open_internal (f, font_entity, pixel_size, w32_font)) |
90869 | 207 { |
208 xfree (w32_font); | |
209 return NULL; | |
210 } | |
211 | |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
212 return (struct font *) w32_font; |
90869 | 213 } |
214 | |
215 /* w32 implementation of close for font_backend. | |
216 Close FONT on frame F. */ | |
91208 | 217 void |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
218 w32font_close (f, font) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
219 FRAME_PTR f; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
220 struct font *font; |
90869 | 221 { |
222 if (font->font.font) | |
223 { | |
224 W32FontStruct *old_w32_font = (W32FontStruct *)font->font.font; | |
90933
bd1251472ab9
(w32font_close): Delete the GDI font object.
Jason Rumney <jasonr@gnu.org>
parents:
90915
diff
changeset
|
225 DeleteObject (old_w32_font->hfont); |
90869 | 226 xfree (old_w32_font); |
227 font->font.font = 0; | |
228 } | |
229 | |
91496
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
230 if (font->font.full_name && font->font.full_name != font->font.name) |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
231 xfree (font->font.full_name); |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
232 |
90869 | 233 if (font->font.name) |
234 xfree (font->font.name); | |
91496
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
235 |
90869 | 236 xfree (font); |
237 } | |
238 | |
239 /* w32 implementation of has_char for font backend. | |
240 Optional. | |
241 If FONT_ENTITY has a glyph for character C (Unicode code point), | |
242 return 1. If not, return 0. If a font must be opened to check | |
243 it, return -1. */ | |
91208 | 244 int |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
245 w32font_has_char (entity, c) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
246 Lisp_Object entity; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
247 int c; |
90869 | 248 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
249 Lisp_Object supported_scripts, extra, script; |
90869 | 250 DWORD mask; |
251 | |
90887
aa7f1d212e78
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90879
diff
changeset
|
252 extra = AREF (entity, FONT_EXTRA_INDEX); |
aa7f1d212e78
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90879
diff
changeset
|
253 if (!CONSP (extra)) |
aa7f1d212e78
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90879
diff
changeset
|
254 return -1; |
aa7f1d212e78
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90879
diff
changeset
|
255 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
256 supported_scripts = assq_no_quit (QCscript, extra); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
257 if (!CONSP (supported_scripts)) |
90869 | 258 return -1; |
259 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
260 supported_scripts = XCDR (supported_scripts); |
90869 | 261 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
262 script = CHAR_TABLE_REF (Vchar_script_table, c); |
90869 | 263 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
264 return (memq_no_quit (script, supported_scripts)) ? 1 : 0; |
90869 | 265 } |
266 | |
267 /* w32 implementation of encode_char for font backend. | |
268 Return a glyph code of FONT for characer C (Unicode code point). | |
269 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. */ | |
91208 | 270 unsigned |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
271 w32font_encode_char (font, c) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
272 struct font *font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
273 int c; |
90869 | 274 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
275 /* Avoid unneccesary conversion - all the Win32 APIs will take a unicode |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
276 character. */ |
90869 | 277 return c; |
278 } | |
279 | |
280 /* w32 implementation of text_extents for font backend. | |
281 Perform the size computation of glyphs of FONT and fillin members | |
282 of METRICS. The glyphs are specified by their glyph codes in | |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
283 CODE (length NGLYPHS). Apparently metrics can be NULL, in this |
90869 | 284 case just return the overall width. */ |
91208 | 285 int |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
286 w32font_text_extents (font, code, nglyphs, metrics) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
287 struct font *font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
288 unsigned *code; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
289 int nglyphs; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
290 struct font_metrics *metrics; |
90869 | 291 { |
292 int i; | |
293 HFONT old_font; | |
91208 | 294 HDC dc; |
295 struct frame * f; | |
90869 | 296 int total_width = 0; |
297 WORD *wcode = alloca(nglyphs * sizeof (WORD)); | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
298 SIZE size; |
90869 | 299 |
91258 | 300 #if 0 |
301 /* Frames can come and go, and their fonts outlive them. This is | |
302 particularly troublesome with tooltip frames, and causes crashes. */ | |
91208 | 303 f = ((struct w32font_info *)font)->owning_frame; |
91258 | 304 #else |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
305 f = XFRAME (selected_frame); |
91258 | 306 #endif |
307 | |
91208 | 308 dc = get_frame_dc (f); |
90869 | 309 old_font = SelectObject (dc, ((W32FontStruct *)(font->font.font))->hfont); |
310 | |
311 if (metrics) | |
312 { | |
313 GLYPHMETRICS gm; | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
314 MAT2 transform; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
315 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
316 /* Set transform to the identity matrix. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
317 bzero (&transform, sizeof (transform)); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
318 transform.eM11.value = 1; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
319 transform.eM22.value = 1; |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
320 metrics->width = 0; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
321 metrics->ascent = 0; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
322 metrics->descent = 0; |
90869 | 323 |
324 for (i = 0; i < nglyphs; i++) | |
325 { | |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
326 if (GetGlyphOutlineW (dc, *(code + i), GGO_METRICS, &gm, 0, |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
327 NULL, &transform) != GDI_ERROR) |
90869 | 328 { |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
329 int new_val = metrics->width + gm.gmBlackBoxX |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
330 + gm.gmptGlyphOrigin.x; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
331 |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
332 metrics->rbearing = max (metrics->rbearing, new_val); |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
333 metrics->width += gm.gmCellIncX; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
334 new_val = -gm.gmptGlyphOrigin.y; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
335 metrics->ascent = max (metrics->ascent, new_val); |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
336 new_val = gm.gmBlackBoxY + gm.gmptGlyphOrigin.y; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
337 metrics->descent = max (metrics->descent, new_val); |
90908
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
338 } |
90869 | 339 else |
340 { | |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
341 /* Rely on an estimate based on the overall font metrics. */ |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
342 break; |
90869 | 343 } |
344 } | |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
345 |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
346 /* If we got through everything, return. */ |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
347 if (i == nglyphs) |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
348 { |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
349 /* Restore state and release DC. */ |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
350 SelectObject (dc, old_font); |
91208 | 351 release_frame_dc (f, dc); |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
352 |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
353 return metrics->width; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
354 } |
90869 | 355 } |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
356 |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
357 for (i = 0; i < nglyphs; i++) |
90869 | 358 { |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
359 if (code[i] < 0x10000) |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
360 wcode[i] = code[i]; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
361 else |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
362 { |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
363 /* TODO: Convert to surrogate, reallocating array if needed */ |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
364 wcode[i] = 0xffff; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
365 } |
90869 | 366 } |
367 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
368 if (GetTextExtentPoint32W (dc, wcode, nglyphs, &size)) |
90869 | 369 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
370 total_width = size.cx; |
90869 | 371 } |
372 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
373 if (!total_width) |
90869 | 374 { |
375 RECT rect; | |
376 rect.top = 0; rect.bottom = font->font.height; rect.left = 0; rect.right = 1; | |
377 DrawTextW (dc, wcode, nglyphs, &rect, | |
378 DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE); | |
379 total_width = rect.right; | |
380 } | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
381 |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
382 if (metrics) |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
383 { |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
384 metrics->width = total_width; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
385 metrics->ascent = font->ascent; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
386 metrics->descent = font->descent; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
387 metrics->lbearing = 0; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
388 metrics->rbearing = total_width |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
389 + ((struct w32font_info *) font)->metrics.tmOverhang; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
390 } |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
391 |
90869 | 392 /* Restore state and release DC. */ |
393 SelectObject (dc, old_font); | |
91208 | 394 release_frame_dc (f, dc); |
90869 | 395 |
396 return total_width; | |
397 } | |
398 | |
399 /* w32 implementation of draw for font backend. | |
400 Optional. | |
401 Draw glyphs between FROM and TO of S->char2b at (X Y) pixel | |
402 position of frame F with S->FACE and S->GC. If WITH_BACKGROUND | |
403 is nonzero, fill the background in advance. It is assured that | |
91182
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
404 WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). |
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
405 |
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
406 TODO: Currently this assumes that the colors and fonts are already |
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
407 set in the DC. This seems to be true now, but maybe only due to |
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
408 the old font code setting it up. It may be safer to resolve faces |
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
409 and fonts in here and set them explicitly |
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
410 */ |
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
411 |
91208 | 412 int |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
413 w32font_draw (s, from, to, x, y, with_background) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
414 struct glyph_string *s; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
415 int from, to, x, y, with_background; |
90869 | 416 { |
417 UINT options = 0; | |
91030
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
418 HRGN orig_clip; |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
419 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
420 /* Save clip region for later restoration. */ |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
421 GetClipRgn(s->hdc, orig_clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
422 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
423 if (s->num_clips > 0) |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
424 { |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
425 HRGN new_clip = CreateRectRgnIndirect (s->clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
426 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
427 if (s->num_clips > 1) |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
428 { |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
429 HRGN clip2 = CreateRectRgnIndirect (s->clip + 1); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
430 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
431 CombineRgn (new_clip, new_clip, clip2, RGN_OR); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
432 DeleteObject (clip2); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
433 } |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
434 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
435 SelectClipRgn (s->hdc, new_clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
436 DeleteObject (new_clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
437 } |
90869 | 438 |
91128
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
439 /* Using OPAQUE background mode can clear more background than expected |
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
440 when Cleartype is used. Draw the background manually to avoid this. */ |
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
441 SetBkMode (s->hdc, TRANSPARENT); |
90869 | 442 if (with_background) |
443 { | |
90908
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
444 HBRUSH brush; |
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
445 RECT rect; |
91128
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
446 struct font *font = (struct font *) s->face->font_info; |
90908
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
447 |
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
448 brush = CreateSolidBrush (s->gc->background); |
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
449 rect.left = x; |
91128
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
450 rect.top = y - font->ascent; |
90908
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
451 rect.right = x + s->width; |
91128
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
452 rect.bottom = y + font->descent; |
90908
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
453 FillRect (s->hdc, &rect, brush); |
90915
9aac5aff0dda
(w32font_draw): Delete brush after using it.
Jason Rumney <jasonr@gnu.org>
parents:
90908
diff
changeset
|
454 DeleteObject (brush); |
90869 | 455 } |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
456 |
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
457 ExtTextOutW (s->hdc, x, y, options, NULL, s->char2b + from, to - from, NULL); |
91030
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
458 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
459 /* Restore clip region. */ |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
460 if (s->num_clips > 0) |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
461 { |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
462 SelectClipRgn (s->hdc, orig_clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
463 } |
90869 | 464 } |
465 | |
466 /* w32 implementation of free_entity for font backend. | |
467 Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value). | |
468 Free FONT_EXTRA_INDEX field of FONT_ENTITY. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
469 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
470 w32font_free_entity (Lisp_Object entity); |
90869 | 471 */ |
472 | |
473 /* w32 implementation of prepare_face for font backend. | |
474 Optional (if FACE->extra is not used). | |
475 Prepare FACE for displaying characters by FONT on frame F by | |
476 storing some data in FACE->extra. If successful, return 0. | |
477 Otherwise, return -1. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
478 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
479 w32font_prepare_face (FRAME_PTR f, struct face *face); |
90869 | 480 */ |
481 /* w32 implementation of done_face for font backend. | |
482 Optional. | |
483 Done FACE for displaying characters by FACE->font on frame F. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
484 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
485 w32font_done_face (FRAME_PTR f, struct face *face); */ |
90869 | 486 |
487 /* w32 implementation of get_bitmap for font backend. | |
488 Optional. | |
489 Store bitmap data for glyph-code CODE of FONT in BITMAP. It is | |
90915
9aac5aff0dda
(w32font_draw): Delete brush after using it.
Jason Rumney <jasonr@gnu.org>
parents:
90908
diff
changeset
|
490 intended that this method is called from the other font-driver |
90869 | 491 for actual drawing. |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
492 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
493 w32font_get_bitmap (struct font *font, unsigned code, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
494 struct font_bitmap *bitmap, int bits_per_pixel); |
90869 | 495 */ |
496 /* w32 implementation of free_bitmap for font backend. | |
497 Optional. | |
498 Free bitmap data in BITMAP. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
499 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
500 w32font_free_bitmap (struct font *font, struct font_bitmap *bitmap); |
90869 | 501 */ |
502 /* w32 implementation of get_outline for font backend. | |
503 Optional. | |
504 Return an outline data for glyph-code CODE of FONT. The format | |
505 of the outline data depends on the font-driver. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
506 static void * |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
507 w32font_get_outline (struct font *font, unsigned code); |
90869 | 508 */ |
509 /* w32 implementation of free_outline for font backend. | |
510 Optional. | |
511 Free OUTLINE (that is obtained by the above method). | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
512 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
513 w32font_free_outline (struct font *font, void *outline); |
90869 | 514 */ |
515 /* w32 implementation of anchor_point for font backend. | |
516 Optional. | |
517 Get coordinates of the INDEXth anchor point of the glyph whose | |
518 code is CODE. Store the coordinates in *X and *Y. Return 0 if | |
519 the operations was successfull. Otherwise return -1. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
520 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
521 w32font_anchor_point (struct font *font, unsigned code, |
90869 | 522 int index, int *x, int *y); |
523 */ | |
524 /* w32 implementation of otf_capability for font backend. | |
525 Optional. | |
526 Return a list describing which scripts/languages FONT | |
527 supports by which GSUB/GPOS features of OpenType tables. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
528 static Lisp_Object |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
529 w32font_otf_capability (struct font *font); |
90869 | 530 */ |
531 /* w32 implementation of otf_drive for font backend. | |
532 Optional. | |
533 Apply FONT's OTF-FEATURES to the glyph string. | |
534 | |
535 FEATURES specifies which OTF features to apply in this format: | |
536 (SCRIPT LANGSYS GSUB-FEATURE GPOS-FEATURE) | |
537 See the documentation of `font-drive-otf' for the detail. | |
538 | |
539 This method applies the specified features to the codes in the | |
540 elements of GSTRING-IN (between FROMth and TOth). The output | |
541 codes are stored in GSTRING-OUT at the IDXth element and the | |
542 following elements. | |
543 | |
544 Return the number of output codes. If none of the features are | |
545 applicable to the input data, return 0. If GSTRING-OUT is too | |
546 short, return -1. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
547 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
548 w32font_otf_drive (struct font *font, Lisp_Object features, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
549 Lisp_Object gstring_in, int from, int to, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
550 Lisp_Object gstring_out, int idx, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
551 int alternate_subst); |
90869 | 552 */ |
553 | |
91208 | 554 /* Internal implementation of w32font_list. |
555 Additional parameter opentype_only restricts the returned fonts to | |
556 opentype fonts, which can be used with the Uniscribe backend. */ | |
557 Lisp_Object | |
558 w32font_list_internal (frame, font_spec, opentype_only) | |
559 Lisp_Object frame, font_spec; | |
560 int opentype_only; | |
561 { | |
562 struct font_callback_data match_data; | |
563 HDC dc; | |
564 FRAME_PTR f = XFRAME (frame); | |
565 | |
566 match_data.orig_font_spec = font_spec; | |
567 match_data.list = Qnil; | |
568 match_data.frame = frame; | |
569 | |
570 bzero (&match_data.pattern, sizeof (LOGFONT)); | |
571 fill_in_logfont (f, &match_data.pattern, font_spec); | |
572 | |
573 match_data.opentype_only = opentype_only; | |
574 if (opentype_only) | |
575 match_data.pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; | |
576 | |
577 if (match_data.pattern.lfFaceName[0] == '\0') | |
578 { | |
579 /* EnumFontFamiliesEx does not take other fields into account if | |
580 font name is blank, so need to use two passes. */ | |
581 list_all_matching_fonts (&match_data); | |
582 } | |
583 else | |
584 { | |
585 dc = get_frame_dc (f); | |
586 | |
587 EnumFontFamiliesEx (dc, &match_data.pattern, | |
588 (FONTENUMPROC) add_font_entity_to_list, | |
589 (LPARAM) &match_data, 0); | |
590 release_frame_dc (f, dc); | |
591 } | |
592 | |
593 return NILP (match_data.list) ? null_vector : Fvconcat (1, &match_data.list); | |
594 } | |
595 | |
596 /* Internal implementation of w32font_match. | |
597 Additional parameter opentype_only restricts the returned fonts to | |
598 opentype fonts, which can be used with the Uniscribe backend. */ | |
599 Lisp_Object | |
600 w32font_match_internal (frame, font_spec, opentype_only) | |
601 Lisp_Object frame, font_spec; | |
602 int opentype_only; | |
603 { | |
604 struct font_callback_data match_data; | |
605 HDC dc; | |
606 FRAME_PTR f = XFRAME (frame); | |
607 | |
608 match_data.orig_font_spec = font_spec; | |
609 match_data.frame = frame; | |
610 match_data.list = Qnil; | |
611 | |
612 bzero (&match_data.pattern, sizeof (LOGFONT)); | |
613 fill_in_logfont (f, &match_data.pattern, font_spec); | |
614 | |
615 match_data.opentype_only = opentype_only; | |
616 if (opentype_only) | |
617 match_data.pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; | |
618 | |
619 dc = get_frame_dc (f); | |
620 | |
621 EnumFontFamiliesEx (dc, &match_data.pattern, | |
622 (FONTENUMPROC) add_one_font_entity_to_list, | |
623 (LPARAM) &match_data, 0); | |
624 release_frame_dc (f, dc); | |
625 | |
626 return NILP (match_data.list) ? Qnil : XCAR (match_data.list); | |
627 } | |
628 | |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
629 int |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
630 w32font_open_internal (f, font_entity, pixel_size, w32_font) |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
631 FRAME_PTR f; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
632 Lisp_Object font_entity; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
633 int pixel_size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
634 struct w32font_info *w32_font; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
635 { |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
636 int len, size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
637 LOGFONT logfont; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
638 HDC dc; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
639 HFONT hfont, old_font; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
640 Lisp_Object val, extra; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
641 /* For backwards compatibility. */ |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
642 W32FontStruct *compat_w32_font; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
643 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
644 struct font * font = (struct font *) w32_font; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
645 if (!font) |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
646 return 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
647 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
648 bzero (&logfont, sizeof (logfont)); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
649 fill_in_logfont (f, &logfont, font_entity); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
650 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
651 size = XINT (AREF (font_entity, FONT_SIZE_INDEX)); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
652 if (!size) |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
653 size = pixel_size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
654 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
655 logfont.lfHeight = -size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
656 hfont = CreateFontIndirect (&logfont); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
657 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
658 if (hfont == NULL) |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
659 return 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
660 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
661 w32_font->owning_frame = f; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
662 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
663 /* Get the metrics for this font. */ |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
664 dc = get_frame_dc (f); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
665 old_font = SelectObject (dc, hfont); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
666 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
667 GetTextMetrics (dc, &w32_font->metrics); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
668 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
669 SelectObject (dc, old_font); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
670 release_frame_dc (f, dc); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
671 /* W32FontStruct - we should get rid of this, and use the w32font_info |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
672 struct for any W32 specific fields. font->font.font can then be hfont. */ |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
673 font->font.font = xmalloc (sizeof (W32FontStruct)); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
674 compat_w32_font = (W32FontStruct *) font->font.font; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
675 bzero (compat_w32_font, sizeof (W32FontStruct)); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
676 compat_w32_font->font_type = UNICODE_FONT; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
677 /* Duplicate the text metrics. */ |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
678 bcopy (&w32_font->metrics, &compat_w32_font->tm, sizeof (TEXTMETRIC)); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
679 compat_w32_font->hfont = hfont; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
680 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
681 len = strlen (logfont.lfFaceName); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
682 font->font.name = (char *) xmalloc (len + 1); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
683 bcopy (logfont.lfFaceName, font->font.name, len); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
684 font->font.name[len] = '\0'; |
91496
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
685 |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
686 { |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
687 char *name; |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
688 |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
689 /* We don't know how much space we need for the full name, so start with |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
690 96 bytes and go up in steps of 32. */ |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
691 len = 96; |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
692 name = malloc (len); |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
693 while (name && font_unparse_fcname (font_entity, pixel_size, name, len) < 0) |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
694 { |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
695 char *new = realloc (name, len += 32); |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
696 |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
697 if (! new) |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
698 free (name); |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
699 name = new; |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
700 } |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
701 if (name) |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
702 font->font.full_name = name; |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
703 else |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
704 font->font.full_name = font->font.name; |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
705 } |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
706 font->font.charset = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
707 font->font.codepage = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
708 font->font.size = w32_font->metrics.tmMaxCharWidth; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
709 font->font.height = w32_font->metrics.tmHeight |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
710 + w32_font->metrics.tmExternalLeading; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
711 font->font.space_width = font->font.average_width |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
712 = w32_font->metrics.tmAveCharWidth; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
713 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
714 font->font.vertical_centering = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
715 font->font.encoding_type = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
716 font->font.baseline_offset = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
717 font->font.relative_compose = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
718 font->font.default_ascent = w32_font->metrics.tmAscent; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
719 font->font.font_encoder = NULL; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
720 font->entity = font_entity; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
721 font->pixel_size = size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
722 font->driver = &w32font_driver; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
723 font->format = Qgdi; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
724 font->file_name = NULL; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
725 font->encoding_charset = -1; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
726 font->repertory_charset = -1; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
727 font->min_width = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
728 font->ascent = w32_font->metrics.tmAscent; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
729 font->descent = w32_font->metrics.tmDescent; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
730 font->scalable = w32_font->metrics.tmPitchAndFamily & TMPF_VECTOR; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
731 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
732 return 1; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
733 } |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
734 |
90869 | 735 /* Callback function for EnumFontFamiliesEx. |
736 * Adds the name of a font to a Lisp list (passed in as the lParam arg). */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
737 static int CALLBACK |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
738 add_font_name_to_list (logical_font, physical_font, font_type, list_object) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
739 ENUMLOGFONTEX *logical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
740 NEWTEXTMETRICEX *physical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
741 DWORD font_type; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
742 LPARAM list_object; |
90869 | 743 { |
744 Lisp_Object* list = (Lisp_Object *) list_object; | |
91070
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
745 Lisp_Object family; |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
746 |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
747 /* Skip vertical fonts (intended only for printing) */ |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
748 if (logical_font->elfLogFont.lfFaceName[0] == '@') |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
749 return 1; |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
750 |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
751 family = intern_downcase (logical_font->elfLogFont.lfFaceName, |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
752 strlen (logical_font->elfLogFont.lfFaceName)); |
90869 | 753 if (! memq_no_quit (family, *list)) |
754 *list = Fcons (family, *list); | |
755 | |
756 return 1; | |
757 } | |
758 | |
759 /* Convert an enumerated Windows font to an Emacs font entity. */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
760 static Lisp_Object |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
761 w32_enumfont_pattern_entity (frame, logical_font, physical_font, |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
762 font_type, requested_font) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
763 Lisp_Object frame; |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
764 ENUMLOGFONTEX *logical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
765 NEWTEXTMETRICEX *physical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
766 DWORD font_type; |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
767 LOGFONT *requested_font; |
90869 | 768 { |
769 Lisp_Object entity, tem; | |
770 LOGFONT *lf = (LOGFONT*) logical_font; | |
771 BYTE generic_type; | |
772 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
773 entity = Fmake_vector (make_number (FONT_ENTITY_MAX), Qnil); |
90869 | 774 |
90964 | 775 ASET (entity, FONT_TYPE_INDEX, Qgdi); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
776 ASET (entity, FONT_FRAME_INDEX, frame); |
90869 | 777 ASET (entity, FONT_REGISTRY_INDEX, w32_registry (lf->lfCharSet)); |
778 ASET (entity, FONT_OBJLIST_INDEX, Qnil); | |
779 | |
780 /* Foundry is difficult to get in readable form on Windows. | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
781 But Emacs crashes if it is not set, so set it to something more |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
782 generic. Thes values make xflds compatible with Emacs 22. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
783 if (lf->lfOutPrecision == OUT_STRING_PRECIS) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
784 tem = Qraster; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
785 else if (lf->lfOutPrecision == OUT_STROKE_PRECIS) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
786 tem = Qoutline; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
787 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
788 tem = Qunknown; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
789 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
790 ASET (entity, FONT_FOUNDRY_INDEX, tem); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
791 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
792 /* Save the generic family in the extra info, as it is likely to be |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
793 useful to users looking for a close match. */ |
90869 | 794 generic_type = physical_font->ntmTm.tmPitchAndFamily & 0xF0; |
795 if (generic_type == FF_DECORATIVE) | |
796 tem = Qdecorative; | |
797 else if (generic_type == FF_MODERN) | |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
798 tem = Qmono; |
90869 | 799 else if (generic_type == FF_ROMAN) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
800 tem = Qserif; |
90869 | 801 else if (generic_type == FF_SCRIPT) |
802 tem = Qscript; | |
803 else if (generic_type == FF_SWISS) | |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
804 tem = Qsans; |
90869 | 805 else |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
806 tem = null_string; |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
807 |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
808 ASET (entity, FONT_ADSTYLE_INDEX, tem); |
90869 | 809 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
810 if (physical_font->ntmTm.tmPitchAndFamily & 0x01) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
811 font_put_extra (entity, QCspacing, make_number (FONT_SPACING_PROPORTIONAL)); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
812 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
813 font_put_extra (entity, QCspacing, make_number (FONT_SPACING_MONO)); |
90869 | 814 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
815 if (requested_font->lfQuality != DEFAULT_QUALITY) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
816 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
817 font_put_extra (entity, QCantialias, |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
818 lispy_antialias_type (requested_font->lfQuality)); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
819 } |
90869 | 820 ASET (entity, FONT_FAMILY_INDEX, |
821 intern_downcase (lf->lfFaceName, strlen (lf->lfFaceName))); | |
822 | |
823 ASET (entity, FONT_WEIGHT_INDEX, make_number (lf->lfWeight)); | |
824 ASET (entity, FONT_SLANT_INDEX, make_number (lf->lfItalic ? 200 : 100)); | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
825 /* TODO: PANOSE struct has this info, but need to call GetOutlineTextMetrics |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
826 to get it. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
827 ASET (entity, FONT_WIDTH_INDEX, make_number (100)); |
90869 | 828 |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
829 if (font_type & RASTER_FONTTYPE) |
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
830 ASET (entity, FONT_SIZE_INDEX, make_number (physical_font->ntmTm.tmHeight)); |
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
831 else |
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
832 ASET (entity, FONT_SIZE_INDEX, make_number (0)); |
90869 | 833 |
834 /* Cache unicode codepoints covered by this font, as there is no other way | |
835 of getting this information easily. */ | |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
836 if (font_type & TRUETYPE_FONTTYPE) |
90869 | 837 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
838 font_put_extra (entity, QCscript, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
839 font_supported_scripts (&physical_font->ntmFontSig)); |
90869 | 840 } |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
841 |
90869 | 842 return entity; |
843 } | |
844 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
845 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
846 /* Convert generic families to the family portion of lfPitchAndFamily. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
847 BYTE |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
848 w32_generic_family (Lisp_Object name) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
849 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
850 /* Generic families. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
851 if (EQ (name, Qmonospace) || EQ (name, Qmono)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
852 return FF_MODERN; |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
853 else if (EQ (name, Qsans) || EQ (name, Qsans_serif) || EQ (name, Qsansserif)) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
854 return FF_SWISS; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
855 else if (EQ (name, Qserif)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
856 return FF_ROMAN; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
857 else if (EQ (name, Qdecorative)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
858 return FF_DECORATIVE; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
859 else if (EQ (name, Qscript)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
860 return FF_SCRIPT; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
861 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
862 return FF_DONTCARE; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
863 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
864 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
865 static int |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
866 logfonts_match (font, pattern) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
867 LOGFONT *font, *pattern; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
868 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
869 /* Only check height for raster fonts. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
870 if (pattern->lfHeight && font->lfOutPrecision == OUT_STRING_PRECIS |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
871 && font->lfHeight != pattern->lfHeight) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
872 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
873 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
874 /* Have some flexibility with weights. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
875 if (pattern->lfWeight |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
876 && ((font->lfWeight < (pattern->lfWeight - 150)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
877 || font->lfWeight > (pattern->lfWeight + 150))) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
878 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
879 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
880 /* Charset and face should be OK. Italic has to be checked |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
881 against the original spec, in case we don't have any preference. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
882 return 1; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
883 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
884 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
885 static int |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
886 font_matches_spec (type, font, spec) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
887 DWORD type; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
888 NEWTEXTMETRICEX *font; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
889 Lisp_Object spec; |
90869 | 890 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
891 Lisp_Object extra, val; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
892 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
893 /* Check italic. Can't check logfonts, since it is a boolean field, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
894 so there is no difference between "non-italic" and "don't care". */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
895 val = AREF (spec, FONT_SLANT_INDEX); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
896 if (INTEGERP (val)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
897 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
898 int slant = XINT (val); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
899 if ((slant > 150 && !font->ntmTm.tmItalic) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
900 || (slant <= 150 && font->ntmTm.tmItalic)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
901 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
902 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
903 |
91264
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
904 /* Check adstyle against generic family. */ |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
905 val = AREF (spec, FONT_ADSTYLE_INDEX); |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
906 if (!NILP (val)) |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
907 { |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
908 BYTE family = w32_generic_family (val); |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
909 if (family != FF_DONTCARE |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
910 && family != (font->ntmTm.tmPitchAndFamily & 0xF0)) |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
911 return 0; |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
912 } |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
913 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
914 /* Check extra parameters. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
915 for (extra = AREF (spec, FONT_EXTRA_INDEX); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
916 CONSP (extra); extra = XCDR (extra)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
917 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
918 Lisp_Object extra_entry; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
919 extra_entry = XCAR (extra); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
920 if (CONSP (extra_entry)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
921 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
922 Lisp_Object key = XCAR (extra_entry); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
923 val = XCDR (extra_entry); |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
924 if (EQ (key, QCspacing)) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
925 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
926 int proportional; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
927 if (INTEGERP (val)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
928 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
929 int spacing = XINT (val); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
930 proportional = (spacing < FONT_SPACING_MONO); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
931 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
932 else if (EQ (val, Qp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
933 proportional = 1; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
934 else if (EQ (val, Qc) || EQ (val, Qm)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
935 proportional = 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
936 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
937 return 0; /* Bad font spec. */ |
90869 | 938 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
939 if ((proportional && !(font->ntmTm.tmPitchAndFamily & 0x01)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
940 || (!proportional && (font->ntmTm.tmPitchAndFamily & 0x01))) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
941 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
942 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
943 else if (EQ (key, QCscript) && SYMBOLP (val)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
944 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
945 /* Only truetype fonts will have information about what |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
946 scripts they support. This probably means the user |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
947 will have to force Emacs to use raster, postscript |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
948 or atm fonts for non-ASCII text. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
949 if (type & TRUETYPE_FONTTYPE) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
950 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
951 Lisp_Object support |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
952 = font_supported_scripts (&font->ntmFontSig); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
953 if (! memq_no_quit (val, support)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
954 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
955 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
956 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
957 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
958 /* Return specific matches, but play it safe. Fonts |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
959 that cover more than their charset would suggest |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
960 are likely to be truetype or opentype fonts, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
961 covered above. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
962 if (EQ (val, Qlatin)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
963 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
964 /* Although every charset but symbol, thai and |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
965 arabic contains the basic ASCII set of latin |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
966 characters, Emacs expects much more. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
967 if (font->ntmTm.tmCharSet != ANSI_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
968 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
969 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
970 else if (EQ (val, Qsymbol)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
971 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
972 if (font->ntmTm.tmCharSet != SYMBOL_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
973 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
974 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
975 else if (EQ (val, Qcyrillic)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
976 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
977 if (font->ntmTm.tmCharSet != RUSSIAN_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
978 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
979 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
980 else if (EQ (val, Qgreek)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
981 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
982 if (font->ntmTm.tmCharSet != GREEK_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
983 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
984 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
985 else if (EQ (val, Qarabic)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
986 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
987 if (font->ntmTm.tmCharSet != ARABIC_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
988 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
989 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
990 else if (EQ (val, Qhebrew)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
991 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
992 if (font->ntmTm.tmCharSet != HEBREW_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
993 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
994 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
995 else if (EQ (val, Qthai)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
996 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
997 if (font->ntmTm.tmCharSet != THAI_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
998 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
999 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1000 else if (EQ (val, Qkana)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1001 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1002 if (font->ntmTm.tmCharSet != SHIFTJIS_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1003 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1004 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1005 else if (EQ (val, Qbopomofo)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1006 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1007 if (font->ntmTm.tmCharSet != CHINESEBIG5_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1008 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1009 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1010 else if (EQ (val, Qhangul)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1011 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1012 if (font->ntmTm.tmCharSet != HANGUL_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1013 && font->ntmTm.tmCharSet != JOHAB_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1014 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1015 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1016 else if (EQ (val, Qhan)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1017 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1018 if (font->ntmTm.tmCharSet != CHINESEBIG5_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1019 && font->ntmTm.tmCharSet != GB2312_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1020 && font->ntmTm.tmCharSet != HANGUL_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1021 && font->ntmTm.tmCharSet != JOHAB_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1022 && font->ntmTm.tmCharSet != SHIFTJIS_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1023 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1024 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1025 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1026 /* Other scripts unlikely to be handled. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1027 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1028 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1029 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1030 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1031 } |
90869 | 1032 return 1; |
1033 } | |
1034 | |
1035 /* Callback function for EnumFontFamiliesEx. | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1036 * Checks if a font matches everything we are trying to check agaist, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1037 * and if so, adds it to a list. Both the data we are checking against |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1038 * and the list to which the fonts are added are passed in via the |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1039 * lparam argument, in the form of a font_callback_data struct. */ |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1040 static int CALLBACK |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1041 add_font_entity_to_list (logical_font, physical_font, font_type, lParam) |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1042 ENUMLOGFONTEX *logical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1043 NEWTEXTMETRICEX *physical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1044 DWORD font_type; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1045 LPARAM lParam; |
90869 | 1046 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1047 struct font_callback_data *match_data |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1048 = (struct font_callback_data *) lParam; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1049 |
91208 | 1050 if ((!match_data->opentype_only |
1051 || (physical_font->ntmTm.ntmFlags & NTMFLAGS_OPENTYPE)) | |
1052 && logfonts_match (&logical_font->elfLogFont, &match_data->pattern) | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1053 && font_matches_spec (font_type, physical_font, |
91264
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1054 match_data->orig_font_spec) |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1055 /* Avoid substitutions involving raster fonts (eg Helv -> MS Sans Serif) |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1056 We limit this to raster fonts, because the test can catch some |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1057 genuine fonts (eg the full name of DejaVu Sans Mono Light is actually |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1058 DejaVu Sans Mono ExtraLight). Helvetica -> Arial substitution will |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1059 therefore get through this test. Since full names can be prefixed |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1060 by a foundry, we accept raster fonts if the font name is found |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1061 anywhere within the full name. */ |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1062 && (logical_font->elfLogFont.lfOutPrecision != OUT_STRING_PRECIS |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1063 || strstr (logical_font->elfFullName, |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1064 logical_font->elfLogFont.lfFaceName))) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1065 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1066 Lisp_Object entity |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1067 = w32_enumfont_pattern_entity (match_data->frame, logical_font, |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1068 physical_font, font_type, |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1069 &match_data->pattern); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1070 if (!NILP (entity)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1071 match_data->list = Fcons (entity, match_data->list); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1072 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1073 return 1; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1074 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1075 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1076 /* Callback function for EnumFontFamiliesEx. |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1077 * Terminates the search once we have a match. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1078 static int CALLBACK |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1079 add_one_font_entity_to_list (logical_font, physical_font, font_type, lParam) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1080 ENUMLOGFONTEX *logical_font; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1081 NEWTEXTMETRICEX *physical_font; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1082 DWORD font_type; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1083 LPARAM lParam; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1084 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1085 struct font_callback_data *match_data |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1086 = (struct font_callback_data *) lParam; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1087 add_font_entity_to_list (logical_font, physical_font, font_type, lParam); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1088 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1089 /* If we have a font in the list, terminate the search. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1090 return !NILP (match_data->list); |
90869 | 1091 } |
1092 | |
1093 /* Convert a Lisp font registry (symbol) to a windows charset. */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1094 static LONG |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1095 registry_to_w32_charset (charset) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1096 Lisp_Object charset; |
90869 | 1097 { |
1098 if (EQ (charset, Qiso10646_1) || EQ (charset, Qunicode_bmp) | |
1099 || EQ (charset, Qunicode_sip)) | |
1100 return DEFAULT_CHARSET; /* UNICODE_CHARSET not defined in MingW32 */ | |
1101 else if (EQ (charset, Qiso8859_1)) | |
1102 return ANSI_CHARSET; | |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1103 else if (SYMBOLP (charset)) |
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1104 return x_to_w32_charset (SDATA (SYMBOL_NAME (charset))); |
90869 | 1105 else if (STRINGP (charset)) |
1106 return x_to_w32_charset (SDATA (charset)); | |
1107 else | |
1108 return DEFAULT_CHARSET; | |
1109 } | |
1110 | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1111 static Lisp_Object |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1112 w32_registry (w32_charset) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1113 LONG w32_charset; |
90869 | 1114 { |
1115 if (w32_charset == ANSI_CHARSET) | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1116 return Qiso10646_1; |
90869 | 1117 else |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1118 { |
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1119 char * charset = w32_to_x_charset (w32_charset, NULL); |
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1120 return intern_downcase (charset, strlen(charset)); |
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1121 } |
90869 | 1122 } |
1123 | |
1124 /* Fill in all the available details of LOGFONT from FONT_SPEC. */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1125 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1126 fill_in_logfont (f, logfont, font_spec) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1127 FRAME_PTR f; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1128 LOGFONT *logfont; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1129 Lisp_Object font_spec; |
90869 | 1130 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1131 Lisp_Object tmp, extra; |
90869 | 1132 int dpi = FRAME_W32_DISPLAY_INFO (f)->resy; |
1133 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1134 extra = AREF (font_spec, FONT_EXTRA_INDEX); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1135 /* Allow user to override dpi settings. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1136 if (CONSP (extra)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1137 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1138 tmp = assq_no_quit (QCdpi, extra); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1139 if (CONSP (tmp) && INTEGERP (XCDR (tmp))) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1140 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1141 dpi = XINT (XCDR (tmp)); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1142 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1143 else if (CONSP (tmp) && FLOATP (XCDR (tmp))) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1144 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1145 dpi = (int) (XFLOAT_DATA (XCDR (tmp)) + 0.5); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1146 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1147 } |
90869 | 1148 |
1149 /* Height */ | |
1150 tmp = AREF (font_spec, FONT_SIZE_INDEX); | |
1151 if (INTEGERP (tmp)) | |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1152 logfont->lfHeight = -1 * XINT (tmp); |
90869 | 1153 else if (FLOATP (tmp)) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1154 logfont->lfHeight = (int) (-1.0 * dpi * XFLOAT_DATA (tmp) / 72.27 + 0.5); |
90869 | 1155 |
1156 /* Escapement */ | |
1157 | |
1158 /* Orientation */ | |
1159 | |
1160 /* Weight */ | |
1161 tmp = AREF (font_spec, FONT_WEIGHT_INDEX); | |
1162 if (INTEGERP (tmp)) | |
1163 logfont->lfWeight = XINT (tmp); | |
1164 | |
1165 /* Italic */ | |
1166 tmp = AREF (font_spec, FONT_SLANT_INDEX); | |
1167 if (INTEGERP (tmp)) | |
1168 { | |
1169 int slant = XINT (tmp); | |
1170 logfont->lfItalic = slant > 150 ? 1 : 0; | |
1171 } | |
1172 | |
1173 /* Underline */ | |
1174 | |
1175 /* Strikeout */ | |
1176 | |
1177 /* Charset */ | |
1178 tmp = AREF (font_spec, FONT_REGISTRY_INDEX); | |
1179 if (! NILP (tmp)) | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1180 logfont->lfCharSet = registry_to_w32_charset (tmp); |
90869 | 1181 |
1182 /* Out Precision */ | |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1183 |
90869 | 1184 /* Clip Precision */ |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1185 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1186 /* Quality */ |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1187 logfont->lfQuality = DEFAULT_QUALITY; |
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1188 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1189 /* Generic Family and Face Name */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1190 logfont->lfPitchAndFamily = FF_DONTCARE | DEFAULT_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1191 |
90869 | 1192 tmp = AREF (font_spec, FONT_FAMILY_INDEX); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1193 if (! NILP (tmp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1194 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1195 logfont->lfPitchAndFamily = w32_generic_family (tmp) | DEFAULT_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1196 if ((logfont->lfPitchAndFamily & 0xF0) != FF_DONTCARE) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1197 ; /* Font name was generic, don't fill in font name. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1198 /* Font families are interned, but allow for strings also in case of |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1199 user input. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1200 else if (SYMBOLP (tmp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1201 strncpy (logfont->lfFaceName, SDATA (SYMBOL_NAME (tmp)), LF_FACESIZE); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1202 else if (STRINGP (tmp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1203 strncpy (logfont->lfFaceName, SDATA (tmp), LF_FACESIZE); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1204 } |
90869 | 1205 |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1206 tmp = AREF (font_spec, FONT_ADSTYLE_INDEX); |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1207 if (!NILP (tmp)) |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1208 { |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1209 /* Override generic family. */ |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1210 BYTE family = w32_generic_family (tmp); |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1211 if (family != FF_DONTCARE) |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1212 logfont->lfPitchAndFamily = family | DEFAULT_PITCH; |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1213 } |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1214 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1215 /* Process EXTRA info. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1216 for ( ; CONSP (extra); extra = XCDR (extra)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1217 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1218 tmp = XCAR (extra); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1219 if (CONSP (tmp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1220 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1221 Lisp_Object key, val; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1222 key = XCAR (tmp), val = XCDR (tmp); |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1223 if (EQ (key, QCspacing)) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1224 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1225 /* Set pitch based on the spacing property. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1226 if (INTEGERP (val)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1227 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1228 int spacing = XINT (val); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1229 if (spacing < FONT_SPACING_MONO) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1230 logfont->lfPitchAndFamily |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1231 = logfont->lfPitchAndFamily & 0xF0 | VARIABLE_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1232 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1233 logfont->lfPitchAndFamily |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1234 = logfont->lfPitchAndFamily & 0xF0 | FIXED_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1235 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1236 else if (EQ (val, Qp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1237 logfont->lfPitchAndFamily |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1238 = logfont->lfPitchAndFamily & 0xF0 | VARIABLE_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1239 else if (EQ (val, Qc) || EQ (val, Qm)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1240 logfont->lfPitchAndFamily |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1241 = logfont->lfPitchAndFamily & 0xF0 | FIXED_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1242 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1243 /* Only use QCscript if charset is not provided, or is unicode |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1244 and a single script is specified. This is rather crude, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1245 and is only used to narrow down the fonts returned where |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1246 there is a definite match. Some scripts, such as latin, han, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1247 cjk-misc match multiple lfCharSet values, so we can't pre-filter |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1248 them. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1249 else if (EQ (key, QCscript) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1250 && logfont->lfCharSet == DEFAULT_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1251 && SYMBOLP (val)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1252 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1253 if (EQ (val, Qgreek)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1254 logfont->lfCharSet = GREEK_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1255 else if (EQ (val, Qhangul)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1256 logfont->lfCharSet = HANGUL_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1257 else if (EQ (val, Qkana) || EQ (val, Qkanbun)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1258 logfont->lfCharSet = SHIFTJIS_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1259 else if (EQ (val, Qbopomofo)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1260 logfont->lfCharSet = CHINESEBIG5_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1261 /* GB 18030 supports tibetan, yi, mongolian, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1262 fonts that support it should show up if we ask for |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1263 GB2312 fonts. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1264 else if (EQ (val, Qtibetan) || EQ (val, Qyi) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1265 || EQ (val, Qmongolian)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1266 logfont->lfCharSet = GB2312_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1267 else if (EQ (val, Qhebrew)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1268 logfont->lfCharSet = HEBREW_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1269 else if (EQ (val, Qarabic)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1270 logfont->lfCharSet = ARABIC_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1271 else if (EQ (val, Qthai)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1272 logfont->lfCharSet = THAI_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1273 else if (EQ (val, Qsymbol)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1274 logfont->lfCharSet = SYMBOL_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1275 } |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1276 else if (EQ (key, QCantialias) && SYMBOLP (val)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1277 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1278 logfont->lfQuality = w32_antialias_type (val); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1279 } |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1280 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1281 } |
90869 | 1282 } |
1283 | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1284 static void |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1285 list_all_matching_fonts (match_data) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1286 struct font_callback_data *match_data; |
90869 | 1287 { |
1288 HDC dc; | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1289 Lisp_Object families = w32font_list_family (match_data->frame); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1290 struct frame *f = XFRAME (match_data->frame); |
90869 | 1291 |
1292 dc = get_frame_dc (f); | |
1293 | |
1294 while (!NILP (families)) | |
1295 { | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1296 /* TODO: Use the Unicode versions of the W32 APIs, so we can |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1297 handle non-ASCII font names. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1298 char *name; |
90869 | 1299 Lisp_Object family = CAR (families); |
1300 families = CDR (families); | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1301 if (NILP (family)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1302 continue; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1303 else if (STRINGP (family)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1304 name = SDATA (family); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1305 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1306 name = SDATA (SYMBOL_NAME (family)); |
90869 | 1307 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1308 strncpy (match_data->pattern.lfFaceName, name, LF_FACESIZE); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1309 match_data->pattern.lfFaceName[LF_FACESIZE - 1] = '\0'; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1310 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1311 EnumFontFamiliesEx (dc, &match_data->pattern, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1312 (FONTENUMPROC) add_font_entity_to_list, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1313 (LPARAM) match_data, 0); |
90869 | 1314 } |
1315 | |
1316 release_frame_dc (f, dc); | |
1317 } | |
1318 | |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1319 static Lisp_Object |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1320 lispy_antialias_type (type) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1321 BYTE type; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1322 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1323 Lisp_Object lispy; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1324 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1325 switch (type) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1326 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1327 case NONANTIALIASED_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1328 lispy = Qnone; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1329 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1330 case ANTIALIASED_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1331 lispy = Qstandard; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1332 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1333 case CLEARTYPE_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1334 lispy = Qsubpixel; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1335 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1336 case CLEARTYPE_NATURAL_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1337 lispy = Qnatural; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1338 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1339 default: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1340 lispy = Qnil; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1341 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1342 } |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1343 return lispy; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1344 } |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1345 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1346 /* Convert antialiasing symbols to lfQuality */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1347 static BYTE |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1348 w32_antialias_type (type) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1349 Lisp_Object type; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1350 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1351 if (EQ (type, Qnone)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1352 return NONANTIALIASED_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1353 else if (EQ (type, Qstandard)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1354 return ANTIALIASED_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1355 else if (EQ (type, Qsubpixel)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1356 return CLEARTYPE_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1357 else if (EQ (type, Qnatural)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1358 return CLEARTYPE_NATURAL_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1359 else |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1360 return DEFAULT_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1361 } |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1362 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1363 /* Return a list of all the scripts that the font supports. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1364 static Lisp_Object |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1365 font_supported_scripts (FONTSIGNATURE * sig) |
90869 | 1366 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1367 DWORD * subranges = sig->fsUsb; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1368 Lisp_Object supported = Qnil; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1369 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1370 /* Match a single subrange. SYM is set if bit N is set in subranges. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1371 #define SUBRANGE(n,sym) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1372 if (subranges[(n) / 32] & (1 << ((n) % 32))) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1373 supported = Fcons ((sym), supported) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1374 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1375 /* Match multiple subranges. SYM is set if any MASK bit is set in |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1376 subranges[0 - 3]. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1377 #define MASK_ANY(mask0,mask1,mask2,mask3,sym) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1378 if ((subranges[0] & (mask0)) || (subranges[1] & (mask1)) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1379 || (subranges[2] & (mask2)) || (subranges[3] & (mask3))) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1380 supported = Fcons ((sym), supported) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1381 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1382 SUBRANGE (0, Qlatin); /* There are many others... */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1383 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1384 SUBRANGE (7, Qgreek); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1385 SUBRANGE (8, Qcoptic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1386 SUBRANGE (9, Qcyrillic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1387 SUBRANGE (10, Qarmenian); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1388 SUBRANGE (11, Qhebrew); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1389 SUBRANGE (13, Qarabic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1390 SUBRANGE (14, Qnko); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1391 SUBRANGE (15, Qdevanagari); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1392 SUBRANGE (16, Qbengali); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1393 SUBRANGE (17, Qgurmukhi); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1394 SUBRANGE (18, Qgujarati); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1395 SUBRANGE (19, Qoriya); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1396 SUBRANGE (20, Qtamil); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1397 SUBRANGE (21, Qtelugu); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1398 SUBRANGE (22, Qkannada); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1399 SUBRANGE (23, Qmalayalam); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1400 SUBRANGE (24, Qthai); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1401 SUBRANGE (25, Qlao); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1402 SUBRANGE (26, Qgeorgian); |
90869 | 1403 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1404 SUBRANGE (48, Qcjk_misc); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1405 SUBRANGE (51, Qbopomofo); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1406 SUBRANGE (54, Qkanbun); /* Is this right? */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1407 SUBRANGE (56, Qhangul); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1408 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1409 SUBRANGE (59, Qhan); /* There are others, but this is the main one. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1410 SUBRANGE (59, Qideographic_description); /* Windows lumps this in */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1411 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1412 SUBRANGE (70, Qtibetan); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1413 SUBRANGE (71, Qsyriac); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1414 SUBRANGE (72, Qthaana); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1415 SUBRANGE (73, Qsinhala); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1416 SUBRANGE (74, Qmyanmar); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1417 SUBRANGE (75, Qethiopic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1418 SUBRANGE (76, Qcherokee); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1419 SUBRANGE (77, Qcanadian_aboriginal); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1420 SUBRANGE (78, Qogham); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1421 SUBRANGE (79, Qrunic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1422 SUBRANGE (80, Qkhmer); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1423 SUBRANGE (81, Qmongolian); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1424 SUBRANGE (82, Qbraille); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1425 SUBRANGE (83, Qyi); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1426 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1427 SUBRANGE (88, Qbyzantine_musical_symbol); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1428 SUBRANGE (88, Qmusical_symbol); /* Windows doesn't distinguish these. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1429 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1430 SUBRANGE (89, Qmathematical); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1431 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1432 /* Match either katakana or hiragana for kana. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1433 MASK_ANY (0, 0x00060000, 0, 0, Qkana); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1434 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1435 /* There isn't really a main symbol range, so include symbol if any |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1436 relevant range is set. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1437 MASK_ANY (0x8000000, 0x0000FFFF, 0, 0, Qsymbol); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1438 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1439 #undef SUBRANGE |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1440 #undef MASK_ANY |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1441 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1442 return supported; |
90869 | 1443 } |
1444 | |
1445 | |
1446 struct font_driver w32font_driver = | |
1447 { | |
90964 | 1448 0, /* Qgdi */ |
90869 | 1449 w32font_get_cache, |
1450 w32font_list, | |
1451 w32font_match, | |
1452 w32font_list_family, | |
1453 NULL, /* free_entity */ | |
1454 w32font_open, | |
1455 w32font_close, | |
1456 NULL, /* prepare_face */ | |
1457 NULL, /* done_face */ | |
1458 w32font_has_char, | |
1459 w32font_encode_char, | |
1460 w32font_text_extents, | |
1461 w32font_draw, | |
1462 NULL, /* get_bitmap */ | |
1463 NULL, /* free_bitmap */ | |
1464 NULL, /* get_outline */ | |
1465 NULL, /* free_outline */ | |
1466 NULL, /* anchor_point */ | |
1467 NULL, /* otf_capability */ | |
91158
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
1468 NULL, /* otf_drive */ |
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
1469 NULL, /* start_for_frame */ |
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
1470 NULL, /* end_for_frame */ |
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
1471 NULL /* shape */ |
90869 | 1472 }; |
1473 | |
1474 | |
1475 /* Initialize state that does not change between invocations. This is only | |
1476 called when Emacs is dumped. */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1477 void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1478 syms_of_w32font () |
90869 | 1479 { |
90964 | 1480 DEFSYM (Qgdi, "gdi"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1481 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1482 /* Generic font families. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1483 DEFSYM (Qmonospace, "monospace"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1484 DEFSYM (Qserif, "serif"); |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1485 DEFSYM (Qsansserif, "sansserif"); |
90869 | 1486 DEFSYM (Qscript, "script"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1487 DEFSYM (Qdecorative, "decorative"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1488 /* Aliases. */ |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1489 DEFSYM (Qsans_serif, "sans_serif"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1490 DEFSYM (Qsans, "sans"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1491 DEFSYM (Qmono, "mono"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1492 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1493 /* Fake foundries. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1494 DEFSYM (Qraster, "raster"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1495 DEFSYM (Qoutline, "outline"); |
90869 | 1496 DEFSYM (Qunknown, "unknown"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1497 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1498 /* Antialiasing. */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1499 DEFSYM (Qstandard, "standard"); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1500 DEFSYM (Qsubpixel, "subpixel"); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1501 DEFSYM (Qnatural, "natural"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1502 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1503 /* Scripts */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1504 DEFSYM (Qlatin, "latin"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1505 DEFSYM (Qgreek, "greek"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1506 DEFSYM (Qcoptic, "coptic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1507 DEFSYM (Qcyrillic, "cyrillic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1508 DEFSYM (Qarmenian, "armenian"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1509 DEFSYM (Qhebrew, "hebrew"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1510 DEFSYM (Qarabic, "arabic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1511 DEFSYM (Qsyriac, "syriac"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1512 DEFSYM (Qnko, "nko"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1513 DEFSYM (Qthaana, "thaana"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1514 DEFSYM (Qdevanagari, "devanagari"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1515 DEFSYM (Qbengali, "bengali"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1516 DEFSYM (Qgurmukhi, "gurmukhi"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1517 DEFSYM (Qgujarati, "gujarati"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1518 DEFSYM (Qoriya, "oriya"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1519 DEFSYM (Qtamil, "tamil"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1520 DEFSYM (Qtelugu, "telugu"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1521 DEFSYM (Qkannada, "kannada"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1522 DEFSYM (Qmalayalam, "malayalam"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1523 DEFSYM (Qsinhala, "sinhala"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1524 DEFSYM (Qthai, "thai"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1525 DEFSYM (Qlao, "lao"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1526 DEFSYM (Qtibetan, "tibetan"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1527 DEFSYM (Qmyanmar, "myanmar"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1528 DEFSYM (Qgeorgian, "georgian"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1529 DEFSYM (Qhangul, "hangul"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1530 DEFSYM (Qethiopic, "ethiopic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1531 DEFSYM (Qcherokee, "cherokee"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1532 DEFSYM (Qcanadian_aboriginal, "canadian-aboriginal"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1533 DEFSYM (Qogham, "ogham"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1534 DEFSYM (Qrunic, "runic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1535 DEFSYM (Qkhmer, "khmer"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1536 DEFSYM (Qmongolian, "mongolian"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1537 DEFSYM (Qsymbol, "symbol"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1538 DEFSYM (Qbraille, "braille"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1539 DEFSYM (Qhan, "han"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1540 DEFSYM (Qideographic_description, "ideographic-description"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1541 DEFSYM (Qcjk_misc, "cjk-misc"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1542 DEFSYM (Qkana, "kana"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1543 DEFSYM (Qbopomofo, "bopomofo"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1544 DEFSYM (Qkanbun, "kanbun"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1545 DEFSYM (Qyi, "yi"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1546 DEFSYM (Qbyzantine_musical_symbol, "byzantine-musical-symbol"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1547 DEFSYM (Qmusical_symbol, "musical-symbol"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1548 DEFSYM (Qmathematical, "mathematical"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1549 |
90964 | 1550 w32font_driver.type = Qgdi; |
90869 | 1551 register_font_driver (&w32font_driver, NULL); |
1552 } | |
90898 | 1553 |
1554 /* arch-tag: 65b8a3cd-46aa-4c0d-a1f3-99e75b9c07ee | |
1555 (do not change this comment) */ |