Mercurial > emacs
annotate src/w32font.c @ 92441:483c7e7ad9cb
Update icons entry.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Mon, 03 Mar 2008 09:03:58 +0000 |
parents | dc438f2fa078 |
children | dba28a9d071a |
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> | |
92413 | 23 #include <math.h> |
90869 | 24 |
25 #include "lisp.h" | |
26 #include "w32term.h" | |
27 #include "frame.h" | |
28 #include "dispextern.h" | |
29 #include "character.h" | |
30 #include "charset.h" | |
31 #include "fontset.h" | |
32 #include "font.h" | |
91208 | 33 #include "w32font.h" |
90869 | 34 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
35 /* 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
|
36 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
|
37 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
|
38 */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
39 #ifndef CLEARTYPE_QUALITY |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
40 #define CLEARTYPE_QUALITY 5 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
41 #endif |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
42 #ifndef CLEARTYPE_NATURAL_QUALITY |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
43 #define CLEARTYPE_NATURAL_QUALITY 6 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
44 #endif |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
45 |
90869 | 46 extern struct font_driver w32font_driver; |
47 | |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
48 Lisp_Object Qgdi; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
49 Lisp_Object Quniscribe; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
50 static Lisp_Object QCformat; |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
51 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
|
52 static Lisp_Object Qserif, Qscript, Qdecorative; |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
53 static Lisp_Object Qraster, Qoutline, Qunknown; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
54 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
55 /* antialiasing */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
56 extern Lisp_Object QCantialias; /* defined in font.c */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
57 extern Lisp_Object Qnone; /* reuse from w32fns.c */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
58 static Lisp_Object Qstandard, Qsubpixel, Qnatural; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
59 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
60 /* scripts */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
61 static Lisp_Object Qlatin, Qgreek, Qcoptic, Qcyrillic, Qarmenian, Qhebrew; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
62 static Lisp_Object Qarabic, Qsyriac, Qnko, Qthaana, Qdevanagari, Qbengali; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
63 static Lisp_Object Qgurmukhi, Qgujarati, Qoriya, Qtamil, Qtelugu; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
64 static Lisp_Object Qkannada, Qmalayalam, Qsinhala, Qthai, Qlao; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
65 static Lisp_Object Qtibetan, Qmyanmar, Qgeorgian, Qhangul, Qethiopic; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
66 static Lisp_Object Qcherokee, Qcanadian_aboriginal, Qogham, Qrunic; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
67 static Lisp_Object Qkhmer, Qmongolian, Qsymbol, Qbraille, Qhan; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
68 static Lisp_Object Qideographic_description, Qcjk_misc, Qkana, Qbopomofo; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
69 static Lisp_Object Qkanbun, Qyi, Qbyzantine_musical_symbol; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
70 static Lisp_Object Qmusical_symbol, Qmathematical; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
71 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
72 /* Font spacing symbols - defined in font.c. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
73 extern Lisp_Object Qc, Qp, Qm; |
90869 | 74 |
75 static void fill_in_logfont P_ ((FRAME_PTR f, LOGFONT *logfont, | |
76 Lisp_Object font_spec)); | |
77 | |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
78 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
|
79 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
|
80 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
81 static Lisp_Object font_supported_scripts P_ ((FONTSIGNATURE * sig)); |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
82 static int w32font_full_name P_ ((LOGFONT * font, Lisp_Object font_obj, |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
83 int pixel_size, char *name, int nbytes)); |
92411
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
84 static void recompute_cached_metrics P_ ((HDC dc, struct w32font_info * font)); |
90869 | 85 |
86 static Lisp_Object w32_registry P_ ((LONG w32_charset)); | |
87 | |
88 /* EnumFontFamiliesEx callbacks. */ | |
89 static int CALLBACK add_font_entity_to_list P_ ((ENUMLOGFONTEX *, | |
90 NEWTEXTMETRICEX *, | |
91 DWORD, LPARAM)); | |
92 static int CALLBACK add_one_font_entity_to_list P_ ((ENUMLOGFONTEX *, | |
93 NEWTEXTMETRICEX *, | |
94 DWORD, LPARAM)); | |
95 static int CALLBACK add_font_name_to_list P_ ((ENUMLOGFONTEX *, | |
96 NEWTEXTMETRICEX *, | |
97 DWORD, LPARAM)); | |
98 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
99 /* 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
|
100 of what we really want. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
101 struct font_callback_data |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
102 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
103 /* The logfont we are matching against. EnumFontFamiliesEx only matches |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
104 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
|
105 in the callback function. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
106 LOGFONT pattern; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
107 /* The original font spec or entity. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
108 Lisp_Object orig_font_spec; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
109 /* The frame the font is being loaded on. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
110 Lisp_Object frame; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
111 /* The list to add matches to. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
112 Lisp_Object list; |
91208 | 113 /* Whether to match only opentype fonts. */ |
114 int opentype_only; | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
115 }; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
116 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
117 /* Handles the problem that EnumFontFamiliesEx will not return all |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
118 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
|
119 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
|
120 |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
121 /* From old font code in w32fns.c */ |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
122 char * w32_to_x_charset P_ ((int charset, char * matching)); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
123 |
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 |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
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. */ | |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
270 static 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 { |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
275 struct frame *f; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
276 HDC dc; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
277 HFONT old_font; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
278 DWORD retval; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
279 GCP_RESULTSW result; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
280 wchar_t in[2]; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
281 wchar_t out[2]; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
282 int len; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
283 struct w32font_info *w32_font = (struct w32font_info *) font; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
284 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
285 /* If glyph indexing is not working for this font, just return the |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
286 unicode code-point. */ |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
287 if (!w32_font->glyph_idx) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
288 return c; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
289 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
290 if (c > 0xFFFF) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
291 { |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
292 /* TODO: Encode as surrogate pair and lookup the glyph. */ |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
293 return FONT_INVALID_CODE; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
294 } |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
295 else |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
296 { |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
297 in[0] = (wchar_t) c; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
298 len = 1; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
299 } |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
300 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
301 bzero (&result, sizeof (result)); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
302 result.lStructSize = sizeof (result); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
303 result.lpGlyphs = out; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
304 result.nGlyphs = 2; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
305 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
306 f = XFRAME (selected_frame); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
307 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
308 dc = get_frame_dc (f); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
309 old_font = SelectObject (dc, ((W32FontStruct *) (font->font.font))->hfont); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
310 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
311 retval = GetCharacterPlacementW (dc, in, len, 0, &result, 0); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
312 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
313 SelectObject (dc, old_font); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
314 release_frame_dc (f, dc); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
315 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
316 if (retval) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
317 { |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
318 if (result.nGlyphs != 1 || !result.lpGlyphs[0]) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
319 return FONT_INVALID_CODE; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
320 return result.lpGlyphs[0]; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
321 } |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
322 else |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
323 { |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
324 int i; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
325 /* Mark this font as not supporting glyph indices. This can happen |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
326 on Windows9x, and maybe with non-Truetype fonts on NT etc. */ |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
327 w32_font->glyph_idx = 0; |
92411
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
328 recompute_cached_metrics (dc, w32_font); |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
329 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
330 return c; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
331 } |
90869 | 332 } |
333 | |
334 /* w32 implementation of text_extents for font backend. | |
335 Perform the size computation of glyphs of FONT and fillin members | |
336 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
|
337 CODE (length NGLYPHS). Apparently metrics can be NULL, in this |
90869 | 338 case just return the overall width. */ |
91208 | 339 int |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
340 w32font_text_extents (font, code, nglyphs, metrics) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
341 struct font *font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
342 unsigned *code; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
343 int nglyphs; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
344 struct font_metrics *metrics; |
90869 | 345 { |
346 int i; | |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
347 HFONT old_font = NULL; |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
348 HDC dc = NULL; |
91208 | 349 struct frame * f; |
90869 | 350 int total_width = 0; |
351 WORD *wcode = alloca(nglyphs * sizeof (WORD)); | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
352 SIZE size; |
90869 | 353 |
91593
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
354 /* TODO: Frames can come and go, and their fonts outlive them. So we |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
355 can't cache the frame in the font structure. Use selected_frame |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
356 until the API is updated to pass in a frame. */ |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
357 f = XFRAME (selected_frame); |
91258 | 358 |
90869 | 359 if (metrics) |
360 { | |
361 GLYPHMETRICS gm; | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
362 MAT2 transform; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
363 struct w32font_info *w32_font = (struct w32font_info *) font; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
364 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
365 /* Set transform to the identity matrix. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
366 bzero (&transform, sizeof (transform)); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
367 transform.eM11.value = 1; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
368 transform.eM22.value = 1; |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
369 metrics->width = 0; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
370 metrics->ascent = 0; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
371 metrics->descent = 0; |
91593
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
372 metrics->lbearing = 0; |
90869 | 373 |
374 for (i = 0; i < nglyphs; i++) | |
375 { | |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
376 if (*(code + i) < 128) |
91593
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
377 { |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
378 /* Use cached metrics for ASCII. */ |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
379 struct font_metrics *char_metric |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
380 = &w32_font->ascii_metrics[*(code+i)]; |
91593
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
381 |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
382 /* If we couldn't get metrics when caching, use fallback. */ |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
383 if (char_metric->width == 0) |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
384 break; |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
385 |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
386 metrics->lbearing = max (metrics->lbearing, |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
387 char_metric->lbearing - metrics->width); |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
388 metrics->rbearing = max (metrics->rbearing, |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
389 metrics->width + char_metric->rbearing); |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
390 metrics->width += char_metric->width; |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
391 metrics->ascent = max (metrics->ascent, char_metric->ascent); |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
392 metrics->descent = max (metrics->descent, char_metric->descent); |
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
393 } |
90869 | 394 else |
395 { | |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
396 if (dc == NULL) |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
397 { |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
398 dc = get_frame_dc (f); |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
399 old_font = SelectObject (dc, ((W32FontStruct *) |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
400 (font->font.font))->hfont); |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
401 } |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
402 if (GetGlyphOutlineW (dc, *(code + i), |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
403 GGO_METRICS |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
404 | w32_font->glyph_idx |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
405 ? GGO_GLYPH_INDEX : 0, |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
406 &gm, 0, NULL, &transform) != GDI_ERROR) |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
407 { |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
408 int new_val = metrics->width + gm.gmBlackBoxX |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
409 + gm.gmptGlyphOrigin.x; |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
410 metrics->rbearing = max (metrics->rbearing, new_val); |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
411 new_val = -gm.gmptGlyphOrigin.x - metrics->width; |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
412 metrics->lbearing = max (metrics->lbearing, new_val); |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
413 metrics->width += gm.gmCellIncX; |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
414 new_val = -gm.gmptGlyphOrigin.y; |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
415 metrics->ascent = max (metrics->ascent, new_val); |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
416 new_val = gm.gmBlackBoxY + gm.gmptGlyphOrigin.y; |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
417 metrics->descent = max (metrics->descent, new_val); |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
418 } |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
419 else |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
420 { |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
421 if (w32_font->glyph_idx) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
422 { |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
423 /* Disable glyph indexing for this font, as we can't |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
424 handle the metrics. Abort this run, our recovery |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
425 strategies rely on having unicode code points here. |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
426 This will cause a glitch in display, but in practice, |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
427 any problems should be caught when initialising the |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
428 metrics cache. */ |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
429 w32_font->glyph_idx = 0; |
92411
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
430 recompute_cached_metrics (dc, w32_font); |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
431 SelectObject (dc, old_font); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
432 release_frame_dc (f, dc); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
433 return 0; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
434 } |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
435 /* Rely on an estimate based on the overall font metrics. */ |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
436 break; |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
437 } |
90869 | 438 } |
439 } | |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
440 |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
441 /* 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
|
442 if (i == nglyphs) |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
443 { |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
444 if (dc != NULL) |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
445 { |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
446 /* Restore state and release DC. */ |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
447 SelectObject (dc, old_font); |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
448 release_frame_dc (f, dc); |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
449 } |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
450 |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
451 return metrics->width; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
452 } |
90869 | 453 } |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
454 |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
455 for (i = 0; i < nglyphs; i++) |
90869 | 456 { |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
457 if (code[i] < 0x10000) |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
458 wcode[i] = code[i]; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
459 else |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
460 { |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
461 /* 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
|
462 wcode[i] = 0xffff; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
463 } |
90869 | 464 } |
465 | |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
466 if (dc == NULL) |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
467 { |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
468 dc = get_frame_dc (f); |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
469 old_font = SelectObject (dc, ((W32FontStruct *) |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
470 (font->font.font))->hfont); |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
471 } |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
472 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
473 if (GetTextExtentPoint32W (dc, wcode, nglyphs, &size)) |
90869 | 474 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
475 total_width = size.cx; |
90869 | 476 } |
477 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
478 if (!total_width) |
90869 | 479 { |
480 RECT rect; | |
481 rect.top = 0; rect.bottom = font->font.height; rect.left = 0; rect.right = 1; | |
482 DrawTextW (dc, wcode, nglyphs, &rect, | |
483 DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE); | |
484 total_width = rect.right; | |
485 } | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
486 |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
487 if (metrics) |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
488 { |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
489 metrics->width = total_width; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
490 metrics->ascent = font->ascent; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
491 metrics->descent = font->descent; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
492 metrics->lbearing = 0; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
493 metrics->rbearing = total_width |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
494 + ((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
|
495 } |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
496 |
90869 | 497 /* Restore state and release DC. */ |
498 SelectObject (dc, old_font); | |
91208 | 499 release_frame_dc (f, dc); |
90869 | 500 |
501 return total_width; | |
502 } | |
503 | |
504 /* w32 implementation of draw for font backend. | |
505 Optional. | |
506 Draw glyphs between FROM and TO of S->char2b at (X Y) pixel | |
507 position of frame F with S->FACE and S->GC. If WITH_BACKGROUND | |
508 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
|
509 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
|
510 |
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
511 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
|
512 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
|
513 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
|
514 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
|
515 */ |
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
516 |
91208 | 517 int |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
518 w32font_draw (s, from, to, x, y, with_background) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
519 struct glyph_string *s; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
520 int from, to, x, y, with_background; |
90869 | 521 { |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
522 UINT options; |
91030
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
523 HRGN orig_clip; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
524 struct w32font_info *w32font = (struct w32font_info *) s->face->font_info; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
525 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
526 options = w32font->glyph_idx; |
91030
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
527 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
528 /* Save clip region for later restoration. */ |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
529 GetClipRgn(s->hdc, orig_clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
530 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
531 if (s->num_clips > 0) |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
532 { |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
533 HRGN new_clip = CreateRectRgnIndirect (s->clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
534 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
535 if (s->num_clips > 1) |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
536 { |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
537 HRGN clip2 = CreateRectRgnIndirect (s->clip + 1); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
538 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
539 CombineRgn (new_clip, new_clip, clip2, RGN_OR); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
540 DeleteObject (clip2); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
541 } |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
542 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
543 SelectClipRgn (s->hdc, new_clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
544 DeleteObject (new_clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
545 } |
90869 | 546 |
91128
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
547 /* 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
|
548 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
|
549 SetBkMode (s->hdc, TRANSPARENT); |
90869 | 550 if (with_background) |
551 { | |
90908
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
552 HBRUSH brush; |
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
553 RECT rect; |
91128
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
554 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
|
555 |
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
556 brush = CreateSolidBrush (s->gc->background); |
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
557 rect.left = x; |
91128
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
558 rect.top = y - font->ascent; |
90908
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
559 rect.right = x + s->width; |
91128
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
560 rect.bottom = y + font->descent; |
90908
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
561 FillRect (s->hdc, &rect, brush); |
90915
9aac5aff0dda
(w32font_draw): Delete brush after using it.
Jason Rumney <jasonr@gnu.org>
parents:
90908
diff
changeset
|
562 DeleteObject (brush); |
90869 | 563 } |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
564 |
92187
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
565 if (s->padding_p) |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
566 { |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
567 int len = to - from, i; |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
568 |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
569 for (i = 0; i < len; i++) |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
570 ExtTextOutW (s->hdc, x + i, y, options, NULL, |
92199
8324a41d50a9
(w32font_draw): Draw one character at a time when padding.
Jason Rumney <jasonr@gnu.org>
parents:
92187
diff
changeset
|
571 s->char2b + from + i, 1, NULL); |
92187
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
572 } |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
573 else |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
574 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
|
575 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
576 /* Restore clip region. */ |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
577 if (s->num_clips > 0) |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
578 { |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
579 SelectClipRgn (s->hdc, orig_clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
580 } |
90869 | 581 } |
582 | |
583 /* w32 implementation of free_entity for font backend. | |
584 Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value). | |
585 Free FONT_EXTRA_INDEX field of FONT_ENTITY. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
586 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
587 w32font_free_entity (Lisp_Object entity); |
90869 | 588 */ |
589 | |
590 /* w32 implementation of prepare_face for font backend. | |
591 Optional (if FACE->extra is not used). | |
592 Prepare FACE for displaying characters by FONT on frame F by | |
593 storing some data in FACE->extra. If successful, return 0. | |
594 Otherwise, return -1. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
595 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
596 w32font_prepare_face (FRAME_PTR f, struct face *face); |
90869 | 597 */ |
598 /* w32 implementation of done_face for font backend. | |
599 Optional. | |
600 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
|
601 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
602 w32font_done_face (FRAME_PTR f, struct face *face); */ |
90869 | 603 |
604 /* w32 implementation of get_bitmap for font backend. | |
605 Optional. | |
606 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
|
607 intended that this method is called from the other font-driver |
90869 | 608 for actual drawing. |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
609 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
610 w32font_get_bitmap (struct font *font, unsigned code, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
611 struct font_bitmap *bitmap, int bits_per_pixel); |
90869 | 612 */ |
613 /* w32 implementation of free_bitmap for font backend. | |
614 Optional. | |
615 Free bitmap data in BITMAP. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
616 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
617 w32font_free_bitmap (struct font *font, struct font_bitmap *bitmap); |
90869 | 618 */ |
619 /* w32 implementation of get_outline for font backend. | |
620 Optional. | |
621 Return an outline data for glyph-code CODE of FONT. The format | |
622 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
|
623 static void * |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
624 w32font_get_outline (struct font *font, unsigned code); |
90869 | 625 */ |
626 /* w32 implementation of free_outline for font backend. | |
627 Optional. | |
628 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
|
629 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
630 w32font_free_outline (struct font *font, void *outline); |
90869 | 631 */ |
632 /* w32 implementation of anchor_point for font backend. | |
633 Optional. | |
634 Get coordinates of the INDEXth anchor point of the glyph whose | |
635 code is CODE. Store the coordinates in *X and *Y. Return 0 if | |
636 the operations was successfull. Otherwise return -1. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
637 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
638 w32font_anchor_point (struct font *font, unsigned code, |
90869 | 639 int index, int *x, int *y); |
640 */ | |
641 /* w32 implementation of otf_capability for font backend. | |
642 Optional. | |
643 Return a list describing which scripts/languages FONT | |
644 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
|
645 static Lisp_Object |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
646 w32font_otf_capability (struct font *font); |
90869 | 647 */ |
648 /* w32 implementation of otf_drive for font backend. | |
649 Optional. | |
650 Apply FONT's OTF-FEATURES to the glyph string. | |
651 | |
652 FEATURES specifies which OTF features to apply in this format: | |
653 (SCRIPT LANGSYS GSUB-FEATURE GPOS-FEATURE) | |
654 See the documentation of `font-drive-otf' for the detail. | |
655 | |
656 This method applies the specified features to the codes in the | |
657 elements of GSTRING-IN (between FROMth and TOth). The output | |
658 codes are stored in GSTRING-OUT at the IDXth element and the | |
659 following elements. | |
660 | |
661 Return the number of output codes. If none of the features are | |
662 applicable to the input data, return 0. If GSTRING-OUT is too | |
663 short, return -1. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
664 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
665 w32font_otf_drive (struct font *font, Lisp_Object features, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
666 Lisp_Object gstring_in, int from, int to, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
667 Lisp_Object gstring_out, int idx, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
668 int alternate_subst); |
90869 | 669 */ |
670 | |
91208 | 671 /* Internal implementation of w32font_list. |
672 Additional parameter opentype_only restricts the returned fonts to | |
673 opentype fonts, which can be used with the Uniscribe backend. */ | |
674 Lisp_Object | |
675 w32font_list_internal (frame, font_spec, opentype_only) | |
676 Lisp_Object frame, font_spec; | |
677 int opentype_only; | |
678 { | |
679 struct font_callback_data match_data; | |
680 HDC dc; | |
681 FRAME_PTR f = XFRAME (frame); | |
682 | |
683 match_data.orig_font_spec = font_spec; | |
684 match_data.list = Qnil; | |
685 match_data.frame = frame; | |
686 | |
687 bzero (&match_data.pattern, sizeof (LOGFONT)); | |
688 fill_in_logfont (f, &match_data.pattern, font_spec); | |
689 | |
690 match_data.opentype_only = opentype_only; | |
691 if (opentype_only) | |
692 match_data.pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; | |
693 | |
694 if (match_data.pattern.lfFaceName[0] == '\0') | |
695 { | |
696 /* EnumFontFamiliesEx does not take other fields into account if | |
697 font name is blank, so need to use two passes. */ | |
698 list_all_matching_fonts (&match_data); | |
699 } | |
700 else | |
701 { | |
702 dc = get_frame_dc (f); | |
703 | |
704 EnumFontFamiliesEx (dc, &match_data.pattern, | |
705 (FONTENUMPROC) add_font_entity_to_list, | |
706 (LPARAM) &match_data, 0); | |
707 release_frame_dc (f, dc); | |
708 } | |
709 | |
710 return NILP (match_data.list) ? null_vector : Fvconcat (1, &match_data.list); | |
711 } | |
712 | |
713 /* Internal implementation of w32font_match. | |
714 Additional parameter opentype_only restricts the returned fonts to | |
715 opentype fonts, which can be used with the Uniscribe backend. */ | |
716 Lisp_Object | |
717 w32font_match_internal (frame, font_spec, opentype_only) | |
718 Lisp_Object frame, font_spec; | |
719 int opentype_only; | |
720 { | |
721 struct font_callback_data match_data; | |
722 HDC dc; | |
723 FRAME_PTR f = XFRAME (frame); | |
724 | |
725 match_data.orig_font_spec = font_spec; | |
726 match_data.frame = frame; | |
727 match_data.list = Qnil; | |
728 | |
729 bzero (&match_data.pattern, sizeof (LOGFONT)); | |
730 fill_in_logfont (f, &match_data.pattern, font_spec); | |
731 | |
732 match_data.opentype_only = opentype_only; | |
733 if (opentype_only) | |
734 match_data.pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; | |
735 | |
736 dc = get_frame_dc (f); | |
737 | |
738 EnumFontFamiliesEx (dc, &match_data.pattern, | |
739 (FONTENUMPROC) add_one_font_entity_to_list, | |
740 (LPARAM) &match_data, 0); | |
741 release_frame_dc (f, dc); | |
742 | |
743 return NILP (match_data.list) ? Qnil : XCAR (match_data.list); | |
744 } | |
745 | |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
746 int |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
747 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
|
748 FRAME_PTR f; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
749 Lisp_Object font_entity; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
750 int pixel_size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
751 struct w32font_info *w32_font; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
752 { |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
753 int len, size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
754 LOGFONT logfont; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
755 HDC dc; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
756 HFONT hfont, old_font; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
757 Lisp_Object val, extra; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
758 /* For backwards compatibility. */ |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
759 W32FontStruct *compat_w32_font; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
760 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
761 struct font * font = (struct font *) w32_font; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
762 if (!font) |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
763 return 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
764 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
765 bzero (&logfont, sizeof (logfont)); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
766 fill_in_logfont (f, &logfont, font_entity); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
767 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
768 size = XINT (AREF (font_entity, FONT_SIZE_INDEX)); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
769 if (!size) |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
770 size = pixel_size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
771 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
772 logfont.lfHeight = -size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
773 hfont = CreateFontIndirect (&logfont); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
774 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
775 if (hfont == NULL) |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
776 return 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
777 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
778 /* Get the metrics for this font. */ |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
779 dc = get_frame_dc (f); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
780 old_font = SelectObject (dc, hfont); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
781 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
782 GetTextMetrics (dc, &w32_font->metrics); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
783 |
91593
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
784 /* Cache ASCII metrics. */ |
92411
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
785 w32_font->glyph_idx = ETO_GLYPH_INDEX; |
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
786 recompute_cached_metrics (dc, w32_font); |
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
787 |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
788 SelectObject (dc, old_font); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
789 release_frame_dc (f, dc); |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
790 |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
791 /* 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
|
792 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
|
793 font->font.font = xmalloc (sizeof (W32FontStruct)); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
794 compat_w32_font = (W32FontStruct *) font->font.font; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
795 bzero (compat_w32_font, sizeof (W32FontStruct)); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
796 compat_w32_font->font_type = UNICODE_FONT; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
797 /* Duplicate the text metrics. */ |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
798 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
|
799 compat_w32_font->hfont = hfont; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
800 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
801 len = strlen (logfont.lfFaceName); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
802 font->font.name = (char *) xmalloc (len + 1); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
803 bcopy (logfont.lfFaceName, font->font.name, len); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
804 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
|
805 |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
806 { |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
807 char *name; |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
808 |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
809 /* 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
|
810 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
|
811 len = 96; |
91521
e96ff7166c81
(w32font_open_internal): Use xmalloc, xrealloc, xfree.
Jason Rumney <jasonr@gnu.org>
parents:
91496
diff
changeset
|
812 name = xmalloc (len); |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
813 while (name && w32font_full_name (&logfont, font_entity, pixel_size, |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
814 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
|
815 { |
91521
e96ff7166c81
(w32font_open_internal): Use xmalloc, xrealloc, xfree.
Jason Rumney <jasonr@gnu.org>
parents:
91496
diff
changeset
|
816 char *new = xrealloc (name, len += 32); |
91496
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
817 |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
818 if (! new) |
91521
e96ff7166c81
(w32font_open_internal): Use xmalloc, xrealloc, xfree.
Jason Rumney <jasonr@gnu.org>
parents:
91496
diff
changeset
|
819 xfree (name); |
91496
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
820 name = new; |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
821 } |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
822 if (name) |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
823 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
|
824 else |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
825 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
|
826 } |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
827 font->font.charset = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
828 font->font.codepage = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
829 font->font.size = w32_font->metrics.tmMaxCharWidth; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
830 font->font.height = w32_font->metrics.tmHeight |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
831 + w32_font->metrics.tmExternalLeading; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
832 font->font.space_width = font->font.average_width |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
833 = w32_font->metrics.tmAveCharWidth; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
834 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
835 font->font.vertical_centering = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
836 font->font.encoding_type = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
837 font->font.baseline_offset = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
838 font->font.relative_compose = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
839 font->font.default_ascent = w32_font->metrics.tmAscent; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
840 font->font.font_encoder = NULL; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
841 font->entity = font_entity; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
842 font->pixel_size = size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
843 font->driver = &w32font_driver; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
844 /* Use format cached during list, as the information we have access to |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
845 here is incomplete. */ |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
846 extra = AREF (font_entity, FONT_EXTRA_INDEX); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
847 if (CONSP (extra)) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
848 { |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
849 val = assq_no_quit (QCformat, extra); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
850 if (CONSP (val)) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
851 font->format = XCDR (val); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
852 else |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
853 font->format = Qunknown; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
854 } |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
855 else |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
856 font->format = Qunknown; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
857 |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
858 font->file_name = NULL; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
859 font->encoding_charset = -1; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
860 font->repertory_charset = -1; |
91545
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
861 /* TODO: do we really want the minimum width here, which could be negative? */ |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
862 font->min_width = font->font.space_width; |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
863 font->ascent = w32_font->metrics.tmAscent; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
864 font->descent = w32_font->metrics.tmDescent; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
865 font->scalable = w32_font->metrics.tmPitchAndFamily & TMPF_VECTOR; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
866 |
91545
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
867 /* Set global flag fonts_changed_p to non-zero if the font loaded |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
868 has a character with a smaller width than any other character |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
869 before, or if the font loaded has a smaller height than any other |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
870 font loaded before. If this happens, it will make a glyph matrix |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
871 reallocation necessary. */ |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
872 { |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
873 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
874 dpyinfo->n_fonts++; |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
875 |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
876 if (dpyinfo->n_fonts == 1) |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
877 { |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
878 dpyinfo->smallest_font_height = font->font.height; |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
879 dpyinfo->smallest_char_width = font->min_width; |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
880 } |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
881 else |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
882 { |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
883 if (dpyinfo->smallest_font_height > font->font.height) |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
884 { |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
885 dpyinfo->smallest_font_height = font->font.height; |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
886 fonts_changed_p |= 1; |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
887 } |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
888 if (dpyinfo->smallest_char_width > font->min_width) |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
889 { |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
890 dpyinfo->smallest_char_width = font->min_width; |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
891 fonts_changed_p |= 1; |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
892 } |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
893 } |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
894 } |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
895 |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
896 return 1; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
897 } |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
898 |
90869 | 899 /* Callback function for EnumFontFamiliesEx. |
900 * 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
|
901 static int CALLBACK |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
902 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
|
903 ENUMLOGFONTEX *logical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
904 NEWTEXTMETRICEX *physical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
905 DWORD font_type; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
906 LPARAM list_object; |
90869 | 907 { |
908 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
|
909 Lisp_Object family; |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
910 |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
911 /* 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
|
912 if (logical_font->elfLogFont.lfFaceName[0] == '@') |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
913 return 1; |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
914 |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
915 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
|
916 strlen (logical_font->elfLogFont.lfFaceName)); |
90869 | 917 if (! memq_no_quit (family, *list)) |
918 *list = Fcons (family, *list); | |
919 | |
920 return 1; | |
921 } | |
922 | |
923 /* 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
|
924 static Lisp_Object |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
925 w32_enumfont_pattern_entity (frame, logical_font, physical_font, |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
926 font_type, requested_font, backend) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
927 Lisp_Object frame; |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
928 ENUMLOGFONTEX *logical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
929 NEWTEXTMETRICEX *physical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
930 DWORD font_type; |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
931 LOGFONT *requested_font; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
932 Lisp_Object backend; |
90869 | 933 { |
934 Lisp_Object entity, tem; | |
935 LOGFONT *lf = (LOGFONT*) logical_font; | |
936 BYTE generic_type; | |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
937 BYTE full_type = physical_font->ntmTm.ntmFlags; |
90869 | 938 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
939 entity = Fmake_vector (make_number (FONT_ENTITY_MAX), Qnil); |
90869 | 940 |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
941 ASET (entity, FONT_TYPE_INDEX, backend); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
942 ASET (entity, FONT_FRAME_INDEX, frame); |
90869 | 943 ASET (entity, FONT_REGISTRY_INDEX, w32_registry (lf->lfCharSet)); |
944 ASET (entity, FONT_OBJLIST_INDEX, Qnil); | |
945 | |
946 /* 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
|
947 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
|
948 generic. Thes values make xflds compatible with Emacs 22. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
949 if (lf->lfOutPrecision == OUT_STRING_PRECIS) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
950 tem = Qraster; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
951 else if (lf->lfOutPrecision == OUT_STROKE_PRECIS) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
952 tem = Qoutline; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
953 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
954 tem = Qunknown; |
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 ASET (entity, FONT_FOUNDRY_INDEX, tem); |
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 /* 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
|
959 useful to users looking for a close match. */ |
90869 | 960 generic_type = physical_font->ntmTm.tmPitchAndFamily & 0xF0; |
961 if (generic_type == FF_DECORATIVE) | |
962 tem = Qdecorative; | |
963 else if (generic_type == FF_MODERN) | |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
964 tem = Qmono; |
90869 | 965 else if (generic_type == FF_ROMAN) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
966 tem = Qserif; |
90869 | 967 else if (generic_type == FF_SCRIPT) |
968 tem = Qscript; | |
969 else if (generic_type == FF_SWISS) | |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
970 tem = Qsans; |
90869 | 971 else |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
972 tem = null_string; |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
973 |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
974 ASET (entity, FONT_ADSTYLE_INDEX, tem); |
90869 | 975 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
976 if (physical_font->ntmTm.tmPitchAndFamily & 0x01) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
977 font_put_extra (entity, QCspacing, make_number (FONT_SPACING_PROPORTIONAL)); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
978 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
979 font_put_extra (entity, QCspacing, make_number (FONT_SPACING_MONO)); |
90869 | 980 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
981 if (requested_font->lfQuality != DEFAULT_QUALITY) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
982 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
983 font_put_extra (entity, QCantialias, |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
984 lispy_antialias_type (requested_font->lfQuality)); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
985 } |
90869 | 986 ASET (entity, FONT_FAMILY_INDEX, |
987 intern_downcase (lf->lfFaceName, strlen (lf->lfFaceName))); | |
988 | |
989 ASET (entity, FONT_WEIGHT_INDEX, make_number (lf->lfWeight)); | |
990 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
|
991 /* 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
|
992 to get it. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
993 ASET (entity, FONT_WIDTH_INDEX, make_number (100)); |
90869 | 994 |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
995 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
|
996 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
|
997 else |
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
998 ASET (entity, FONT_SIZE_INDEX, make_number (0)); |
90869 | 999 |
1000 /* Cache unicode codepoints covered by this font, as there is no other way | |
1001 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
|
1002 if (font_type & TRUETYPE_FONTTYPE) |
90869 | 1003 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1004 font_put_extra (entity, QCscript, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1005 font_supported_scripts (&physical_font->ntmFontSig)); |
90869 | 1006 } |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1007 |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1008 /* This information is not fully available when opening fonts, so |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1009 save it here. Only Windows 2000 and later return information |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1010 about opentype and type1 fonts, so need a fallback for detecting |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1011 truetype so that this information is not any worse than we could |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1012 have obtained later. */ |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1013 if (full_type & NTM_TT_OPENTYPE || font_type & TRUETYPE_FONTTYPE) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1014 tem = intern ("truetype"); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1015 else if (full_type & NTM_TYPE1) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1016 tem = intern ("type1"); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1017 else if (full_type & NTM_PS_OPENTYPE) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1018 tem = intern ("postscript"); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1019 else if (font_type & RASTER_FONTTYPE) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1020 tem = intern ("w32bitmap"); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1021 else |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1022 tem = intern ("w32vector"); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1023 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1024 font_put_extra (entity, QCformat, tem); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1025 |
90869 | 1026 return entity; |
1027 } | |
1028 | |
90906
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 /* Convert generic families to the family portion of lfPitchAndFamily. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1031 BYTE |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1032 w32_generic_family (Lisp_Object name) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1033 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1034 /* Generic families. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1035 if (EQ (name, Qmonospace) || EQ (name, Qmono)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1036 return FF_MODERN; |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1037 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
|
1038 return FF_SWISS; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1039 else if (EQ (name, Qserif)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1040 return FF_ROMAN; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1041 else if (EQ (name, Qdecorative)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1042 return FF_DECORATIVE; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1043 else if (EQ (name, Qscript)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1044 return FF_SCRIPT; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1045 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1046 return FF_DONTCARE; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1047 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1048 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1049 static int |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1050 logfonts_match (font, pattern) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1051 LOGFONT *font, *pattern; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1052 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1053 /* Only check height for raster fonts. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1054 if (pattern->lfHeight && font->lfOutPrecision == OUT_STRING_PRECIS |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1055 && font->lfHeight != pattern->lfHeight) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1056 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1057 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1058 /* Have some flexibility with weights. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1059 if (pattern->lfWeight |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1060 && ((font->lfWeight < (pattern->lfWeight - 150)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1061 || font->lfWeight > (pattern->lfWeight + 150))) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1062 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1063 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1064 /* 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
|
1065 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
|
1066 return 1; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1067 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1068 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1069 static int |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1070 font_matches_spec (type, font, spec) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1071 DWORD type; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1072 NEWTEXTMETRICEX *font; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1073 Lisp_Object spec; |
90869 | 1074 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1075 Lisp_Object extra, val; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1076 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1077 /* 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
|
1078 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
|
1079 val = AREF (spec, FONT_SLANT_INDEX); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1080 if (INTEGERP (val)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1081 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1082 int slant = XINT (val); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1083 if ((slant > 150 && !font->ntmTm.tmItalic) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1084 || (slant <= 150 && font->ntmTm.tmItalic)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1085 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1086 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1087 |
91264
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1088 /* Check adstyle against generic family. */ |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1089 val = AREF (spec, FONT_ADSTYLE_INDEX); |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1090 if (!NILP (val)) |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1091 { |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1092 BYTE family = w32_generic_family (val); |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1093 if (family != FF_DONTCARE |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1094 && family != (font->ntmTm.tmPitchAndFamily & 0xF0)) |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1095 return 0; |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1096 } |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1097 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1098 /* Check extra parameters. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1099 for (extra = AREF (spec, FONT_EXTRA_INDEX); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1100 CONSP (extra); extra = XCDR (extra)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1101 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1102 Lisp_Object extra_entry; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1103 extra_entry = XCAR (extra); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1104 if (CONSP (extra_entry)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1105 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1106 Lisp_Object key = XCAR (extra_entry); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1107 val = XCDR (extra_entry); |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1108 if (EQ (key, QCspacing)) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1109 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1110 int proportional; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1111 if (INTEGERP (val)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1112 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1113 int spacing = XINT (val); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1114 proportional = (spacing < FONT_SPACING_MONO); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1115 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1116 else if (EQ (val, Qp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1117 proportional = 1; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1118 else if (EQ (val, Qc) || EQ (val, Qm)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1119 proportional = 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1120 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1121 return 0; /* Bad font spec. */ |
90869 | 1122 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1123 if ((proportional && !(font->ntmTm.tmPitchAndFamily & 0x01)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1124 || (!proportional && (font->ntmTm.tmPitchAndFamily & 0x01))) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1125 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1126 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1127 else if (EQ (key, QCscript) && SYMBOLP (val)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1128 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1129 /* Only truetype fonts will have information about what |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1130 scripts they support. This probably means the user |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1131 will have to force Emacs to use raster, postscript |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1132 or atm fonts for non-ASCII text. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1133 if (type & TRUETYPE_FONTTYPE) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1134 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1135 Lisp_Object support |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1136 = font_supported_scripts (&font->ntmFontSig); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1137 if (! memq_no_quit (val, support)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1138 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1139 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1140 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1141 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1142 /* Return specific matches, but play it safe. Fonts |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1143 that cover more than their charset would suggest |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1144 are likely to be truetype or opentype fonts, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1145 covered above. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1146 if (EQ (val, Qlatin)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1147 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1148 /* Although every charset but symbol, thai and |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1149 arabic contains the basic ASCII set of latin |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1150 characters, Emacs expects much more. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1151 if (font->ntmTm.tmCharSet != ANSI_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1152 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1153 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1154 else if (EQ (val, Qsymbol)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1155 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1156 if (font->ntmTm.tmCharSet != SYMBOL_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1157 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1158 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1159 else if (EQ (val, Qcyrillic)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1160 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1161 if (font->ntmTm.tmCharSet != RUSSIAN_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1162 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1163 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1164 else if (EQ (val, Qgreek)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1165 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1166 if (font->ntmTm.tmCharSet != GREEK_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1167 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1168 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1169 else if (EQ (val, Qarabic)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1170 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1171 if (font->ntmTm.tmCharSet != ARABIC_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1172 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1173 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1174 else if (EQ (val, Qhebrew)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1175 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1176 if (font->ntmTm.tmCharSet != HEBREW_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1177 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1178 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1179 else if (EQ (val, Qthai)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1180 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1181 if (font->ntmTm.tmCharSet != THAI_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1182 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1183 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1184 else if (EQ (val, Qkana)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1185 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1186 if (font->ntmTm.tmCharSet != SHIFTJIS_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1187 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1188 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1189 else if (EQ (val, Qbopomofo)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1190 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1191 if (font->ntmTm.tmCharSet != CHINESEBIG5_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1192 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1193 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1194 else if (EQ (val, Qhangul)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1195 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1196 if (font->ntmTm.tmCharSet != HANGUL_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1197 && font->ntmTm.tmCharSet != JOHAB_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1198 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1199 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1200 else if (EQ (val, Qhan)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1201 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1202 if (font->ntmTm.tmCharSet != CHINESEBIG5_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1203 && font->ntmTm.tmCharSet != GB2312_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1204 && font->ntmTm.tmCharSet != HANGUL_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1205 && font->ntmTm.tmCharSet != JOHAB_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1206 && font->ntmTm.tmCharSet != SHIFTJIS_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1207 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1208 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1209 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1210 /* Other scripts unlikely to be handled. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1211 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1212 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1213 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1214 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1215 } |
90869 | 1216 return 1; |
1217 } | |
1218 | |
1219 /* Callback function for EnumFontFamiliesEx. | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1220 * 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
|
1221 * 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
|
1222 * 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
|
1223 * 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
|
1224 static int CALLBACK |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1225 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
|
1226 ENUMLOGFONTEX *logical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1227 NEWTEXTMETRICEX *physical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1228 DWORD font_type; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1229 LPARAM lParam; |
90869 | 1230 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1231 struct font_callback_data *match_data |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1232 = (struct font_callback_data *) lParam; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1233 |
91208 | 1234 if ((!match_data->opentype_only |
1235 || (physical_font->ntmTm.ntmFlags & NTMFLAGS_OPENTYPE)) | |
1236 && logfonts_match (&logical_font->elfLogFont, &match_data->pattern) | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1237 && 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
|
1238 match_data->orig_font_spec) |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1239 /* 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
|
1240 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
|
1241 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
|
1242 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
|
1243 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
|
1244 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
|
1245 anywhere within the full name. */ |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1246 && (logical_font->elfLogFont.lfOutPrecision != OUT_STRING_PRECIS |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1247 || strstr (logical_font->elfFullName, |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1248 logical_font->elfLogFont.lfFaceName))) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1249 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1250 Lisp_Object entity |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1251 = 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
|
1252 physical_font, font_type, |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1253 &match_data->pattern, |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1254 match_data->opentype_only |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1255 ? Quniscribe : Qgdi); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1256 if (!NILP (entity)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1257 match_data->list = Fcons (entity, match_data->list); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1258 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1259 return 1; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1260 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1261 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1262 /* Callback function for EnumFontFamiliesEx. |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1263 * Terminates the search once we have a match. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1264 static int CALLBACK |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1265 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
|
1266 ENUMLOGFONTEX *logical_font; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1267 NEWTEXTMETRICEX *physical_font; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1268 DWORD font_type; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1269 LPARAM lParam; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1270 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1271 struct font_callback_data *match_data |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1272 = (struct font_callback_data *) lParam; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1273 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
|
1274 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1275 /* 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
|
1276 return !NILP (match_data->list); |
90869 | 1277 } |
1278 | |
1279 /* 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
|
1280 static LONG |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1281 registry_to_w32_charset (charset) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1282 Lisp_Object charset; |
90869 | 1283 { |
1284 if (EQ (charset, Qiso10646_1) || EQ (charset, Qunicode_bmp) | |
1285 || EQ (charset, Qunicode_sip)) | |
1286 return DEFAULT_CHARSET; /* UNICODE_CHARSET not defined in MingW32 */ | |
1287 else if (EQ (charset, Qiso8859_1)) | |
1288 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
|
1289 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
|
1290 return x_to_w32_charset (SDATA (SYMBOL_NAME (charset))); |
90869 | 1291 else if (STRINGP (charset)) |
1292 return x_to_w32_charset (SDATA (charset)); | |
1293 else | |
1294 return DEFAULT_CHARSET; | |
1295 } | |
1296 | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1297 static Lisp_Object |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1298 w32_registry (w32_charset) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1299 LONG w32_charset; |
90869 | 1300 { |
1301 if (w32_charset == ANSI_CHARSET) | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1302 return Qiso10646_1; |
90869 | 1303 else |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1304 { |
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1305 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
|
1306 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
|
1307 } |
90869 | 1308 } |
1309 | |
1310 /* 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
|
1311 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1312 fill_in_logfont (f, logfont, font_spec) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1313 FRAME_PTR f; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1314 LOGFONT *logfont; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1315 Lisp_Object font_spec; |
90869 | 1316 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1317 Lisp_Object tmp, extra; |
90869 | 1318 int dpi = FRAME_W32_DISPLAY_INFO (f)->resy; |
1319 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1320 extra = AREF (font_spec, FONT_EXTRA_INDEX); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1321 /* Allow user to override dpi settings. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1322 if (CONSP (extra)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1323 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1324 tmp = assq_no_quit (QCdpi, extra); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1325 if (CONSP (tmp) && INTEGERP (XCDR (tmp))) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1326 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1327 dpi = XINT (XCDR (tmp)); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1328 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1329 else if (CONSP (tmp) && FLOATP (XCDR (tmp))) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1330 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1331 dpi = (int) (XFLOAT_DATA (XCDR (tmp)) + 0.5); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1332 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1333 } |
90869 | 1334 |
1335 /* Height */ | |
1336 tmp = AREF (font_spec, FONT_SIZE_INDEX); | |
1337 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
|
1338 logfont->lfHeight = -1 * XINT (tmp); |
90869 | 1339 else if (FLOATP (tmp)) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1340 logfont->lfHeight = (int) (-1.0 * dpi * XFLOAT_DATA (tmp) / 72.27 + 0.5); |
90869 | 1341 |
1342 /* Escapement */ | |
1343 | |
1344 /* Orientation */ | |
1345 | |
1346 /* Weight */ | |
1347 tmp = AREF (font_spec, FONT_WEIGHT_INDEX); | |
1348 if (INTEGERP (tmp)) | |
1349 logfont->lfWeight = XINT (tmp); | |
1350 | |
1351 /* Italic */ | |
1352 tmp = AREF (font_spec, FONT_SLANT_INDEX); | |
1353 if (INTEGERP (tmp)) | |
1354 { | |
1355 int slant = XINT (tmp); | |
1356 logfont->lfItalic = slant > 150 ? 1 : 0; | |
1357 } | |
1358 | |
1359 /* Underline */ | |
1360 | |
1361 /* Strikeout */ | |
1362 | |
1363 /* Charset */ | |
1364 tmp = AREF (font_spec, FONT_REGISTRY_INDEX); | |
1365 if (! NILP (tmp)) | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1366 logfont->lfCharSet = registry_to_w32_charset (tmp); |
90869 | 1367 |
1368 /* Out Precision */ | |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1369 |
90869 | 1370 /* Clip Precision */ |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1371 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1372 /* Quality */ |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1373 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
|
1374 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1375 /* Generic Family and Face Name */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1376 logfont->lfPitchAndFamily = FF_DONTCARE | DEFAULT_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1377 |
90869 | 1378 tmp = AREF (font_spec, FONT_FAMILY_INDEX); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1379 if (! NILP (tmp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1380 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1381 logfont->lfPitchAndFamily = w32_generic_family (tmp) | DEFAULT_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1382 if ((logfont->lfPitchAndFamily & 0xF0) != FF_DONTCARE) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1383 ; /* Font name was generic, don't fill in font name. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1384 /* 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
|
1385 user input. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1386 else if (SYMBOLP (tmp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1387 strncpy (logfont->lfFaceName, SDATA (SYMBOL_NAME (tmp)), LF_FACESIZE); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1388 else if (STRINGP (tmp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1389 strncpy (logfont->lfFaceName, SDATA (tmp), LF_FACESIZE); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1390 } |
90869 | 1391 |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1392 tmp = AREF (font_spec, FONT_ADSTYLE_INDEX); |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1393 if (!NILP (tmp)) |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1394 { |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1395 /* Override generic family. */ |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1396 BYTE family = w32_generic_family (tmp); |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1397 if (family != FF_DONTCARE) |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1398 logfont->lfPitchAndFamily = family | DEFAULT_PITCH; |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1399 } |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1400 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1401 /* Process EXTRA info. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1402 for ( ; CONSP (extra); extra = XCDR (extra)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1403 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1404 tmp = XCAR (extra); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1405 if (CONSP (tmp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1406 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1407 Lisp_Object key, val; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1408 key = XCAR (tmp), val = XCDR (tmp); |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1409 if (EQ (key, QCspacing)) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1410 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1411 /* Set pitch based on the spacing property. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1412 if (INTEGERP (val)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1413 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1414 int spacing = XINT (val); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1415 if (spacing < FONT_SPACING_MONO) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1416 logfont->lfPitchAndFamily |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1417 = logfont->lfPitchAndFamily & 0xF0 | VARIABLE_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1418 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1419 logfont->lfPitchAndFamily |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1420 = logfont->lfPitchAndFamily & 0xF0 | FIXED_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1421 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1422 else if (EQ (val, Qp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1423 logfont->lfPitchAndFamily |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1424 = logfont->lfPitchAndFamily & 0xF0 | VARIABLE_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1425 else if (EQ (val, Qc) || EQ (val, Qm)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1426 logfont->lfPitchAndFamily |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1427 = logfont->lfPitchAndFamily & 0xF0 | FIXED_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1428 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1429 /* 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
|
1430 and a single script is specified. This is rather crude, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1431 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
|
1432 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
|
1433 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
|
1434 them. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1435 else if (EQ (key, QCscript) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1436 && logfont->lfCharSet == DEFAULT_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1437 && SYMBOLP (val)) |
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 if (EQ (val, Qgreek)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1440 logfont->lfCharSet = GREEK_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1441 else if (EQ (val, Qhangul)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1442 logfont->lfCharSet = HANGUL_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1443 else if (EQ (val, Qkana) || EQ (val, Qkanbun)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1444 logfont->lfCharSet = SHIFTJIS_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1445 else if (EQ (val, Qbopomofo)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1446 logfont->lfCharSet = CHINESEBIG5_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1447 /* GB 18030 supports tibetan, yi, mongolian, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1448 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
|
1449 GB2312 fonts. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1450 else if (EQ (val, Qtibetan) || EQ (val, Qyi) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1451 || EQ (val, Qmongolian)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1452 logfont->lfCharSet = GB2312_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1453 else if (EQ (val, Qhebrew)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1454 logfont->lfCharSet = HEBREW_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1455 else if (EQ (val, Qarabic)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1456 logfont->lfCharSet = ARABIC_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1457 else if (EQ (val, Qthai)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1458 logfont->lfCharSet = THAI_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1459 else if (EQ (val, Qsymbol)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1460 logfont->lfCharSet = SYMBOL_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1461 } |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1462 else if (EQ (key, QCantialias) && SYMBOLP (val)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1463 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1464 logfont->lfQuality = w32_antialias_type (val); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1465 } |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1466 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1467 } |
90869 | 1468 } |
1469 | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1470 static void |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1471 list_all_matching_fonts (match_data) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1472 struct font_callback_data *match_data; |
90869 | 1473 { |
1474 HDC dc; | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1475 Lisp_Object families = w32font_list_family (match_data->frame); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1476 struct frame *f = XFRAME (match_data->frame); |
90869 | 1477 |
1478 dc = get_frame_dc (f); | |
1479 | |
1480 while (!NILP (families)) | |
1481 { | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1482 /* 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
|
1483 handle non-ASCII font names. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1484 char *name; |
90869 | 1485 Lisp_Object family = CAR (families); |
1486 families = CDR (families); | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1487 if (NILP (family)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1488 continue; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1489 else if (STRINGP (family)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1490 name = SDATA (family); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1491 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1492 name = SDATA (SYMBOL_NAME (family)); |
90869 | 1493 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1494 strncpy (match_data->pattern.lfFaceName, name, LF_FACESIZE); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1495 match_data->pattern.lfFaceName[LF_FACESIZE - 1] = '\0'; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1496 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1497 EnumFontFamiliesEx (dc, &match_data->pattern, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1498 (FONTENUMPROC) add_font_entity_to_list, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1499 (LPARAM) match_data, 0); |
90869 | 1500 } |
1501 | |
1502 release_frame_dc (f, dc); | |
1503 } | |
1504 | |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1505 static Lisp_Object |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1506 lispy_antialias_type (type) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1507 BYTE type; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1508 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1509 Lisp_Object lispy; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1510 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1511 switch (type) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1512 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1513 case NONANTIALIASED_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1514 lispy = Qnone; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1515 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1516 case ANTIALIASED_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1517 lispy = Qstandard; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1518 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1519 case CLEARTYPE_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1520 lispy = Qsubpixel; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1521 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1522 case CLEARTYPE_NATURAL_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1523 lispy = Qnatural; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1524 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1525 default: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1526 lispy = Qnil; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1527 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1528 } |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1529 return lispy; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1530 } |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1531 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1532 /* Convert antialiasing symbols to lfQuality */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1533 static BYTE |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1534 w32_antialias_type (type) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1535 Lisp_Object type; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1536 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1537 if (EQ (type, Qnone)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1538 return NONANTIALIASED_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1539 else if (EQ (type, Qstandard)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1540 return ANTIALIASED_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1541 else if (EQ (type, Qsubpixel)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1542 return CLEARTYPE_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1543 else if (EQ (type, Qnatural)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1544 return CLEARTYPE_NATURAL_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1545 else |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1546 return DEFAULT_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1547 } |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1548 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1549 /* 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
|
1550 static Lisp_Object |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1551 font_supported_scripts (FONTSIGNATURE * sig) |
90869 | 1552 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1553 DWORD * subranges = sig->fsUsb; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1554 Lisp_Object supported = Qnil; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1555 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1556 /* 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
|
1557 #define SUBRANGE(n,sym) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1558 if (subranges[(n) / 32] & (1 << ((n) % 32))) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1559 supported = Fcons ((sym), supported) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1560 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1561 /* 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
|
1562 subranges[0 - 3]. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1563 #define MASK_ANY(mask0,mask1,mask2,mask3,sym) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1564 if ((subranges[0] & (mask0)) || (subranges[1] & (mask1)) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1565 || (subranges[2] & (mask2)) || (subranges[3] & (mask3))) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1566 supported = Fcons ((sym), supported) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1567 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1568 SUBRANGE (0, Qlatin); /* There are many others... */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1569 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1570 SUBRANGE (7, Qgreek); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1571 SUBRANGE (8, Qcoptic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1572 SUBRANGE (9, Qcyrillic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1573 SUBRANGE (10, Qarmenian); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1574 SUBRANGE (11, Qhebrew); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1575 SUBRANGE (13, Qarabic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1576 SUBRANGE (14, Qnko); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1577 SUBRANGE (15, Qdevanagari); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1578 SUBRANGE (16, Qbengali); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1579 SUBRANGE (17, Qgurmukhi); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1580 SUBRANGE (18, Qgujarati); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1581 SUBRANGE (19, Qoriya); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1582 SUBRANGE (20, Qtamil); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1583 SUBRANGE (21, Qtelugu); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1584 SUBRANGE (22, Qkannada); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1585 SUBRANGE (23, Qmalayalam); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1586 SUBRANGE (24, Qthai); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1587 SUBRANGE (25, Qlao); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1588 SUBRANGE (26, Qgeorgian); |
90869 | 1589 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1590 SUBRANGE (48, Qcjk_misc); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1591 SUBRANGE (51, Qbopomofo); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1592 SUBRANGE (54, Qkanbun); /* Is this right? */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1593 SUBRANGE (56, Qhangul); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1594 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1595 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
|
1596 SUBRANGE (59, Qideographic_description); /* Windows lumps this in */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1597 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1598 SUBRANGE (70, Qtibetan); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1599 SUBRANGE (71, Qsyriac); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1600 SUBRANGE (72, Qthaana); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1601 SUBRANGE (73, Qsinhala); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1602 SUBRANGE (74, Qmyanmar); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1603 SUBRANGE (75, Qethiopic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1604 SUBRANGE (76, Qcherokee); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1605 SUBRANGE (77, Qcanadian_aboriginal); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1606 SUBRANGE (78, Qogham); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1607 SUBRANGE (79, Qrunic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1608 SUBRANGE (80, Qkhmer); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1609 SUBRANGE (81, Qmongolian); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1610 SUBRANGE (82, Qbraille); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1611 SUBRANGE (83, Qyi); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1612 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1613 SUBRANGE (88, Qbyzantine_musical_symbol); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1614 SUBRANGE (88, Qmusical_symbol); /* Windows doesn't distinguish these. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1615 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1616 SUBRANGE (89, Qmathematical); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1617 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1618 /* Match either katakana or hiragana for kana. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1619 MASK_ANY (0, 0x00060000, 0, 0, Qkana); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1620 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1621 /* 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
|
1622 relevant range is set. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1623 MASK_ANY (0x8000000, 0x0000FFFF, 0, 0, Qsymbol); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1624 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1625 #undef SUBRANGE |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1626 #undef MASK_ANY |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1627 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1628 return supported; |
90869 | 1629 } |
1630 | |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1631 /* Generate a full name for a Windows font. |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1632 The full name is in fcname format, with weight, slant and antialiasing |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1633 specified if they are not "normal". */ |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1634 static int |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1635 w32font_full_name (font, font_obj, pixel_size, name, nbytes) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1636 LOGFONT * font; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1637 Lisp_Object font_obj; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1638 int pixel_size; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1639 char *name; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1640 int nbytes; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1641 { |
92394
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1642 int len, height, outline; |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1643 char *p; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1644 Lisp_Object antialiasing, weight = Qnil; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1645 |
92394
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1646 len = strlen (font->lfFaceName); |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1647 |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1648 outline = EQ (AREF (font_obj, FONT_FOUNDRY_INDEX), Qoutline); |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1649 |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1650 /* Represent size of scalable fonts by point size. But use pixelsize for |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1651 raster fonts to indicate that they are exactly that size. */ |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1652 if (outline) |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1653 len += 11; /* -SIZE */ |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1654 else |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1655 len = strlen (font->lfFaceName) + 21; |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1656 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1657 if (font->lfItalic) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1658 len += 7; /* :italic */ |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1659 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1660 if (font->lfWeight && font->lfWeight != FW_NORMAL) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1661 { |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1662 weight = font_symbolic_weight (font_obj); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1663 len += 8 + SBYTES (SYMBOL_NAME (weight)); /* :weight=NAME */ |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1664 } |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1665 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1666 antialiasing = lispy_antialias_type (font->lfQuality); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1667 if (! NILP (antialiasing)) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1668 len += 11 + SBYTES (SYMBOL_NAME (antialiasing)); /* :antialias=NAME */ |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1669 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1670 /* Check that the buffer is big enough */ |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1671 if (len > nbytes) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1672 return -1; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1673 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1674 p = name; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1675 p += sprintf (p, "%s", font->lfFaceName); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1676 |
92394
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1677 height = font->lfHeight ? eabs (font->lfHeight) : pixel_size; |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1678 |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1679 if (height > 0) |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1680 { |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1681 if (outline) |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1682 { |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1683 float pointsize = height * 72.0 / one_w32_display_info.resy; |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1684 /* Round to nearest half point. */ |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1685 pointsize = round (pointsize * 2) / 2; |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1686 p += sprintf (p, "-%1.1f", pointsize); |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1687 } |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1688 else |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1689 p += sprintf (p, ":pixelsize=%d", height); |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1690 } |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1691 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1692 if (font->lfItalic) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1693 p += sprintf (p, ":italic"); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1694 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1695 if (SYMBOLP (weight) && ! NILP (weight)) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1696 p += sprintf (p, ":weight=%s", SDATA (SYMBOL_NAME (weight))); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1697 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1698 if (SYMBOLP (antialiasing) && ! NILP (antialiasing)) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1699 p += sprintf (p, ":antialias=%s", SDATA (SYMBOL_NAME (antialiasing))); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1700 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1701 return (p - name); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1702 } |
90869 | 1703 |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1704 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1705 static void |
92411
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
1706 recompute_cached_metrics (dc, w32_font) |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1707 HDC dc; |
92411
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
1708 struct w32font_info *w32_font; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1709 { |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1710 GLYPHMETRICS gm; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1711 MAT2 transform; |
92411
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
1712 unsigned int i; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1713 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1714 bzero (&transform, sizeof (transform)); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1715 transform.eM11.value = 1; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1716 transform.eM22.value = 1; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1717 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1718 for (i = 0; i < 128; i++) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1719 { |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1720 struct font_metrics* char_metric = &w32_font->ascii_metrics[i]; |
92411
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
1721 unsigned int options = GGO_METRICS; |
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
1722 if (w32_font->glyph_idx) |
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
1723 options |= GGO_GLYPH_INDEX; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1724 |
92411
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
1725 if (GetGlyphOutlineW (dc, i, options, &gm, 0, NULL, &transform) |
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
1726 != GDI_ERROR) |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1727 { |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1728 char_metric->lbearing = -gm.gmptGlyphOrigin.x; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1729 char_metric->rbearing = gm.gmBlackBoxX + gm.gmptGlyphOrigin.x; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1730 char_metric->width = gm.gmCellIncX; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1731 char_metric->ascent = -gm.gmptGlyphOrigin.y; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1732 char_metric->descent = gm.gmBlackBoxY + gm.gmptGlyphOrigin.y; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1733 } |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1734 else |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1735 char_metric->width = 0; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1736 } |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1737 } |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1738 |
90869 | 1739 struct font_driver w32font_driver = |
1740 { | |
90964 | 1741 0, /* Qgdi */ |
90869 | 1742 w32font_get_cache, |
1743 w32font_list, | |
1744 w32font_match, | |
1745 w32font_list_family, | |
1746 NULL, /* free_entity */ | |
1747 w32font_open, | |
1748 w32font_close, | |
1749 NULL, /* prepare_face */ | |
1750 NULL, /* done_face */ | |
1751 w32font_has_char, | |
1752 w32font_encode_char, | |
1753 w32font_text_extents, | |
1754 w32font_draw, | |
1755 NULL, /* get_bitmap */ | |
1756 NULL, /* free_bitmap */ | |
1757 NULL, /* get_outline */ | |
1758 NULL, /* free_outline */ | |
1759 NULL, /* anchor_point */ | |
1760 NULL, /* otf_capability */ | |
91158
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
1761 NULL, /* otf_drive */ |
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
1762 NULL, /* start_for_frame */ |
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
1763 NULL, /* end_for_frame */ |
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
1764 NULL /* shape */ |
90869 | 1765 }; |
1766 | |
1767 | |
1768 /* Initialize state that does not change between invocations. This is only | |
1769 called when Emacs is dumped. */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1770 void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1771 syms_of_w32font () |
90869 | 1772 { |
90964 | 1773 DEFSYM (Qgdi, "gdi"); |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1774 DEFSYM (Quniscribe, "uniscribe"); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1775 DEFSYM (QCformat, ":format"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1776 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1777 /* Generic font families. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1778 DEFSYM (Qmonospace, "monospace"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1779 DEFSYM (Qserif, "serif"); |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1780 DEFSYM (Qsansserif, "sansserif"); |
90869 | 1781 DEFSYM (Qscript, "script"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1782 DEFSYM (Qdecorative, "decorative"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1783 /* Aliases. */ |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1784 DEFSYM (Qsans_serif, "sans_serif"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1785 DEFSYM (Qsans, "sans"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1786 DEFSYM (Qmono, "mono"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1787 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1788 /* Fake foundries. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1789 DEFSYM (Qraster, "raster"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1790 DEFSYM (Qoutline, "outline"); |
90869 | 1791 DEFSYM (Qunknown, "unknown"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1792 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1793 /* Antialiasing. */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1794 DEFSYM (Qstandard, "standard"); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1795 DEFSYM (Qsubpixel, "subpixel"); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1796 DEFSYM (Qnatural, "natural"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1797 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1798 /* Scripts */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1799 DEFSYM (Qlatin, "latin"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1800 DEFSYM (Qgreek, "greek"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1801 DEFSYM (Qcoptic, "coptic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1802 DEFSYM (Qcyrillic, "cyrillic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1803 DEFSYM (Qarmenian, "armenian"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1804 DEFSYM (Qhebrew, "hebrew"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1805 DEFSYM (Qarabic, "arabic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1806 DEFSYM (Qsyriac, "syriac"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1807 DEFSYM (Qnko, "nko"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1808 DEFSYM (Qthaana, "thaana"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1809 DEFSYM (Qdevanagari, "devanagari"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1810 DEFSYM (Qbengali, "bengali"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1811 DEFSYM (Qgurmukhi, "gurmukhi"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1812 DEFSYM (Qgujarati, "gujarati"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1813 DEFSYM (Qoriya, "oriya"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1814 DEFSYM (Qtamil, "tamil"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1815 DEFSYM (Qtelugu, "telugu"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1816 DEFSYM (Qkannada, "kannada"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1817 DEFSYM (Qmalayalam, "malayalam"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1818 DEFSYM (Qsinhala, "sinhala"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1819 DEFSYM (Qthai, "thai"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1820 DEFSYM (Qlao, "lao"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1821 DEFSYM (Qtibetan, "tibetan"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1822 DEFSYM (Qmyanmar, "myanmar"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1823 DEFSYM (Qgeorgian, "georgian"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1824 DEFSYM (Qhangul, "hangul"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1825 DEFSYM (Qethiopic, "ethiopic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1826 DEFSYM (Qcherokee, "cherokee"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1827 DEFSYM (Qcanadian_aboriginal, "canadian-aboriginal"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1828 DEFSYM (Qogham, "ogham"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1829 DEFSYM (Qrunic, "runic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1830 DEFSYM (Qkhmer, "khmer"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1831 DEFSYM (Qmongolian, "mongolian"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1832 DEFSYM (Qsymbol, "symbol"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1833 DEFSYM (Qbraille, "braille"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1834 DEFSYM (Qhan, "han"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1835 DEFSYM (Qideographic_description, "ideographic-description"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1836 DEFSYM (Qcjk_misc, "cjk-misc"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1837 DEFSYM (Qkana, "kana"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1838 DEFSYM (Qbopomofo, "bopomofo"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1839 DEFSYM (Qkanbun, "kanbun"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1840 DEFSYM (Qyi, "yi"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1841 DEFSYM (Qbyzantine_musical_symbol, "byzantine-musical-symbol"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1842 DEFSYM (Qmusical_symbol, "musical-symbol"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1843 DEFSYM (Qmathematical, "mathematical"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1844 |
90964 | 1845 w32font_driver.type = Qgdi; |
90869 | 1846 register_font_driver (&w32font_driver, NULL); |
1847 } | |
90898 | 1848 |
1849 /* arch-tag: 65b8a3cd-46aa-4c0d-a1f3-99e75b9c07ee | |
1850 (do not change this comment) */ |