Mercurial > emacs
annotate src/w32font.c @ 93898:d44db694f2b3
Fix typo.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Wed, 09 Apr 2008 07:13:43 +0000 |
parents | 833bbf13f09d |
children | 4000ba1ef9ce |
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 | |
92472
dba28a9d071a
Wrap in USE_FONT_BACKEND conditional
Jason Rumney <jasonr@gnu.org>
parents:
92413
diff
changeset
|
21 #ifdef USE_FONT_BACKEND |
dba28a9d071a
Wrap in USE_FONT_BACKEND conditional
Jason Rumney <jasonr@gnu.org>
parents:
92413
diff
changeset
|
22 |
90869 | 23 #include <config.h> |
24 #include <windows.h> | |
92413 | 25 #include <math.h> |
90869 | 26 |
27 #include "lisp.h" | |
28 #include "w32term.h" | |
29 #include "frame.h" | |
30 #include "dispextern.h" | |
31 #include "character.h" | |
32 #include "charset.h" | |
33 #include "fontset.h" | |
34 #include "font.h" | |
91208 | 35 #include "w32font.h" |
90869 | 36 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
37 /* 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
|
38 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
|
39 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
|
40 */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
41 #ifndef CLEARTYPE_QUALITY |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
42 #define CLEARTYPE_QUALITY 5 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
43 #endif |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
44 #ifndef CLEARTYPE_NATURAL_QUALITY |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
45 #define CLEARTYPE_NATURAL_QUALITY 6 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
46 #endif |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
47 |
90869 | 48 extern struct font_driver w32font_driver; |
49 | |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
50 Lisp_Object Qgdi; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
51 Lisp_Object Quniscribe; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
52 static Lisp_Object QCformat; |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
53 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
|
54 static Lisp_Object Qserif, Qscript, Qdecorative; |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
55 static Lisp_Object Qraster, Qoutline, Qunknown; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
56 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
57 /* antialiasing */ |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
58 extern Lisp_Object QCantialias, QCotf, QClanguage; /* defined in font.c */ |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
59 extern Lisp_Object Qnone; /* reuse from w32fns.c */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
60 static Lisp_Object Qstandard, Qsubpixel, Qnatural; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
61 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
62 /* languages */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
63 static Lisp_Object Qja, Qko, Qzh; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
64 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
65 /* scripts */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
66 static Lisp_Object Qlatin, Qgreek, Qcoptic, Qcyrillic, Qarmenian, Qhebrew; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
67 static Lisp_Object Qarabic, Qsyriac, Qnko, Qthaana, Qdevanagari, Qbengali; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
68 static Lisp_Object Qgurmukhi, Qgujarati, Qoriya, Qtamil, Qtelugu; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
69 static Lisp_Object Qkannada, Qmalayalam, Qsinhala, Qthai, Qlao; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
70 static Lisp_Object Qtibetan, Qmyanmar, Qgeorgian, Qhangul, Qethiopic; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
71 static Lisp_Object Qcherokee, Qcanadian_aboriginal, Qogham, Qrunic; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
72 static Lisp_Object Qkhmer, Qmongolian, Qsymbol, Qbraille, Qhan; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
73 static Lisp_Object Qideographic_description, Qcjk_misc, Qkana, Qbopomofo; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
74 static Lisp_Object Qkanbun, Qyi, Qbyzantine_musical_symbol; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
75 static Lisp_Object Qmusical_symbol, Qmathematical; |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
76 /* Not defined in characters.el, but referenced in fontset.el. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
77 static Lisp_Object Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot; |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
78 static Lisp_Object Qdeseret, Qglagolitic, Qgothic, Qhanunoo, Qkharoshthi; |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
79 static Lisp_Object Qlimbu, Qlinear_b, Qold_italic, Qold_persian, Qosmanya; |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
80 static Lisp_Object Qphags_pa, Qphoenician, Qshavian, Qsyloti_nagri; |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
81 static Lisp_Object Qtagalog, Qtagbanwa, Qtai_le, Qtifinagh, Qugaritic; |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
82 /* Only defined here, but useful for distinguishing IPA capable fonts. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
83 static Lisp_Object Qphonetic; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
84 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
85 /* Font spacing symbols - defined in font.c. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
86 extern Lisp_Object Qc, Qp, Qm; |
90869 | 87 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
88 static void fill_in_logfont P_ ((FRAME_PTR, LOGFONT *, Lisp_Object)); |
90869 | 89 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
90 static BYTE w32_antialias_type P_ ((Lisp_Object)); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
91 static Lisp_Object lispy_antialias_type P_ ((BYTE)); |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
92 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
93 static Lisp_Object font_supported_scripts P_ ((FONTSIGNATURE *)); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
94 static int w32font_full_name P_ ((LOGFONT *, Lisp_Object, int, char *, int)); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
95 static void compute_metrics P_ ((HDC, struct w32font_info *, unsigned int, |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
96 struct w32_metric_cache *)); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
97 static void clear_cached_metrics P_ ((struct w32font_info *)); |
90869 | 98 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
99 static Lisp_Object w32_registry P_ ((LONG, DWORD)); |
90869 | 100 |
101 /* EnumFontFamiliesEx callbacks. */ | |
102 static int CALLBACK add_font_entity_to_list P_ ((ENUMLOGFONTEX *, | |
103 NEWTEXTMETRICEX *, | |
104 DWORD, LPARAM)); | |
105 static int CALLBACK add_one_font_entity_to_list P_ ((ENUMLOGFONTEX *, | |
106 NEWTEXTMETRICEX *, | |
107 DWORD, LPARAM)); | |
108 static int CALLBACK add_font_name_to_list P_ ((ENUMLOGFONTEX *, | |
109 NEWTEXTMETRICEX *, | |
110 DWORD, LPARAM)); | |
111 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
112 /* 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
|
113 of what we really want. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
114 struct font_callback_data |
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 /* The logfont we are matching against. EnumFontFamiliesEx only matches |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
117 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
|
118 in the callback function. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
119 LOGFONT pattern; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
120 /* The original font spec or entity. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
121 Lisp_Object orig_font_spec; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
122 /* The frame the font is being loaded on. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
123 Lisp_Object frame; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
124 /* The list to add matches to. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
125 Lisp_Object list; |
91208 | 126 /* Whether to match only opentype fonts. */ |
127 int opentype_only; | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
128 }; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
129 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
130 /* Handles the problem that EnumFontFamiliesEx will not return all |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
131 style variations if the font name is not specified. */ |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
132 static void list_all_matching_fonts P_ ((struct font_callback_data *)); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
133 |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
134 /* From old font code in w32fns.c */ |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
135 char * w32_to_x_charset P_ ((int, char *)); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
136 |
90869 | 137 |
138 static int | |
139 memq_no_quit (elt, list) | |
140 Lisp_Object elt, list; | |
141 { | |
142 while (CONSP (list) && ! EQ (XCAR (list), elt)) | |
143 list = XCDR (list); | |
144 return (CONSP (list)); | |
145 } | |
146 | |
147 /* w32 implementation of get_cache for font backend. | |
148 Return a cache of font-entities on FRAME. The cache must be a | |
149 cons whose cdr part is the actual cache area. */ | |
91208 | 150 Lisp_Object |
91246
3a1805edf0b5
(w32font_get_cache): Adjust the argument type.
Kenichi Handa <handa@m17n.org>
parents:
91211
diff
changeset
|
151 w32font_get_cache (f) |
3a1805edf0b5
(w32font_get_cache): Adjust the argument type.
Kenichi Handa <handa@m17n.org>
parents:
91211
diff
changeset
|
152 FRAME_PTR f; |
90869 | 153 { |
91246
3a1805edf0b5
(w32font_get_cache): Adjust the argument type.
Kenichi Handa <handa@m17n.org>
parents:
91211
diff
changeset
|
154 struct w32_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
90869 | 155 |
156 return (dpyinfo->name_list_element); | |
157 } | |
158 | |
159 /* w32 implementation of list for font backend. | |
160 List fonts exactly matching with FONT_SPEC on FRAME. The value | |
161 is a vector of font-entities. This is the sole API that | |
162 allocates font-entities. */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
163 static Lisp_Object |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
164 w32font_list (frame, font_spec) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
165 Lisp_Object frame, font_spec; |
90869 | 166 { |
91208 | 167 return w32font_list_internal (frame, font_spec, 0); |
90869 | 168 } |
169 | |
170 /* w32 implementation of match for font backend. | |
171 Return a font entity most closely matching with FONT_SPEC on | |
172 FRAME. The closeness is detemined by the font backend, thus | |
173 `face-font-selection-order' is ignored here. */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
174 static Lisp_Object |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
175 w32font_match (frame, font_spec) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
176 Lisp_Object frame, font_spec; |
90869 | 177 { |
91208 | 178 return w32font_match_internal (frame, font_spec, 0); |
90869 | 179 } |
180 | |
181 /* w32 implementation of list_family for font backend. | |
182 List available families. The value is a list of family names | |
183 (symbols). */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
184 static Lisp_Object |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
185 w32font_list_family (frame) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
186 Lisp_Object frame; |
90869 | 187 { |
188 Lisp_Object list = Qnil; | |
189 LOGFONT font_match_pattern; | |
190 HDC dc; | |
191 FRAME_PTR f = XFRAME (frame); | |
192 | |
193 bzero (&font_match_pattern, sizeof (font_match_pattern)); | |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
194 font_match_pattern.lfCharSet = DEFAULT_CHARSET; |
90869 | 195 |
196 dc = get_frame_dc (f); | |
197 | |
198 EnumFontFamiliesEx (dc, &font_match_pattern, | |
199 (FONTENUMPROC) add_font_name_to_list, | |
200 (LPARAM) &list, 0); | |
201 release_frame_dc (f, dc); | |
202 | |
203 return list; | |
204 } | |
205 | |
206 /* w32 implementation of open for font backend. | |
207 Open a font specified by FONT_ENTITY on frame F. | |
208 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
|
209 static struct font * |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
210 w32font_open (f, font_entity, pixel_size) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
211 FRAME_PTR f; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
212 Lisp_Object font_entity; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
213 int pixel_size; |
90869 | 214 { |
215 struct w32font_info *w32_font = xmalloc (sizeof (struct w32font_info)); | |
216 | |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
217 if (w32_font == NULL) |
90869 | 218 return NULL; |
219 | |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
220 if (!w32font_open_internal (f, font_entity, pixel_size, w32_font)) |
90869 | 221 { |
222 xfree (w32_font); | |
223 return NULL; | |
224 } | |
225 | |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
226 return (struct font *) w32_font; |
90869 | 227 } |
228 | |
229 /* w32 implementation of close for font_backend. | |
230 Close FONT on frame F. */ | |
91208 | 231 void |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
232 w32font_close (f, font) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
233 FRAME_PTR f; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
234 struct font *font; |
90869 | 235 { |
236 if (font->font.font) | |
237 { | |
238 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
|
239 DeleteObject (old_w32_font->hfont); |
90869 | 240 xfree (old_w32_font); |
241 font->font.font = 0; | |
242 } | |
243 | |
91496
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
244 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
|
245 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
|
246 |
90869 | 247 if (font->font.name) |
248 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
|
249 |
90869 | 250 xfree (font); |
251 } | |
252 | |
253 /* w32 implementation of has_char for font backend. | |
254 Optional. | |
255 If FONT_ENTITY has a glyph for character C (Unicode code point), | |
256 return 1. If not, return 0. If a font must be opened to check | |
257 it, return -1. */ | |
91208 | 258 int |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
259 w32font_has_char (entity, c) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
260 Lisp_Object entity; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
261 int c; |
90869 | 262 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
263 Lisp_Object supported_scripts, extra, script; |
90869 | 264 DWORD mask; |
265 | |
90887
aa7f1d212e78
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90879
diff
changeset
|
266 extra = AREF (entity, FONT_EXTRA_INDEX); |
aa7f1d212e78
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90879
diff
changeset
|
267 if (!CONSP (extra)) |
aa7f1d212e78
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90879
diff
changeset
|
268 return -1; |
aa7f1d212e78
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90879
diff
changeset
|
269 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
270 supported_scripts = assq_no_quit (QCscript, extra); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
271 if (!CONSP (supported_scripts)) |
90869 | 272 return -1; |
273 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
274 supported_scripts = XCDR (supported_scripts); |
90869 | 275 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
276 script = CHAR_TABLE_REF (Vchar_script_table, c); |
90869 | 277 |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
278 return (memq_no_quit (script, supported_scripts)) ? -1 : 0; |
90869 | 279 } |
280 | |
281 /* w32 implementation of encode_char for font backend. | |
282 Return a glyph code of FONT for characer C (Unicode code point). | |
283 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
|
284 static unsigned |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
285 w32font_encode_char (font, c) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
286 struct font *font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
287 int c; |
90869 | 288 { |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
289 struct frame *f; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
290 HDC dc; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
291 HFONT old_font; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
292 DWORD retval; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
293 GCP_RESULTSW result; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
294 wchar_t in[2]; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
295 wchar_t out[2]; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
296 int len; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
297 struct w32font_info *w32_font = (struct w32font_info *) font; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
298 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
299 /* 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
|
300 unicode code-point. */ |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
301 if (!w32_font->glyph_idx) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
302 return c; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
303 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
304 if (c > 0xFFFF) |
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 /* TODO: Encode as surrogate pair and lookup the glyph. */ |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
307 return FONT_INVALID_CODE; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
308 } |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
309 else |
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 in[0] = (wchar_t) c; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
312 len = 1; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
313 } |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
314 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
315 bzero (&result, sizeof (result)); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
316 result.lStructSize = sizeof (result); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
317 result.lpGlyphs = out; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
318 result.nGlyphs = 2; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
319 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
320 f = XFRAME (selected_frame); |
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 dc = get_frame_dc (f); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
323 old_font = SelectObject (dc, ((W32FontStruct *) (font->font.font))->hfont); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
324 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
325 retval = GetCharacterPlacementW (dc, in, len, 0, &result, 0); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
326 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
327 SelectObject (dc, old_font); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
328 release_frame_dc (f, dc); |
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 if (retval) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
331 { |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
332 if (result.nGlyphs != 1 || !result.lpGlyphs[0]) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
333 return FONT_INVALID_CODE; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
334 return result.lpGlyphs[0]; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
335 } |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
336 else |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
337 { |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
338 int i; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
339 /* 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
|
340 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
|
341 w32_font->glyph_idx = 0; |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
342 /* Clear metrics cache. */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
343 clear_cached_metrics (w32_font); |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
344 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
345 return c; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
346 } |
90869 | 347 } |
348 | |
349 /* w32 implementation of text_extents for font backend. | |
350 Perform the size computation of glyphs of FONT and fillin members | |
351 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
|
352 CODE (length NGLYPHS). Apparently metrics can be NULL, in this |
90869 | 353 case just return the overall width. */ |
91208 | 354 int |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
355 w32font_text_extents (font, code, nglyphs, metrics) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
356 struct font *font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
357 unsigned *code; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
358 int nglyphs; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
359 struct font_metrics *metrics; |
90869 | 360 { |
361 int i; | |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
362 HFONT old_font = NULL; |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
363 HDC dc = NULL; |
91208 | 364 struct frame * f; |
90869 | 365 int total_width = 0; |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
366 WORD *wcode = NULL; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
367 SIZE size; |
90869 | 368 |
369 if (metrics) | |
370 { | |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
371 struct w32font_info *w32_font = (struct w32font_info *) font; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
372 |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
373 metrics->width = 0; |
93675
7fb9a5b86fa8
(w32font_text_extents): Use font's ascent and descent.
Jason Rumney <jasonr@gnu.org>
parents:
93598
diff
changeset
|
374 metrics->ascent = font->ascent; |
7fb9a5b86fa8
(w32font_text_extents): Use font's ascent and descent.
Jason Rumney <jasonr@gnu.org>
parents:
93598
diff
changeset
|
375 metrics->descent = font->descent; |
91593
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
376 metrics->lbearing = 0; |
90869 | 377 |
378 for (i = 0; i < nglyphs; i++) | |
379 { | |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
380 struct w32_metric_cache *char_metric; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
381 int block = *(code + i) / CACHE_BLOCKSIZE; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
382 int pos_in_block = *(code + i) % CACHE_BLOCKSIZE; |
91593
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
383 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
384 if (block >= w32_font->n_cache_blocks) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
385 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
386 if (!w32_font->cached_metrics) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
387 w32_font->cached_metrics |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
388 = xmalloc ((block + 1) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
389 * sizeof (struct w32_cached_metric *)); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
390 else |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
391 w32_font->cached_metrics |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
392 = xrealloc (w32_font->cached_metrics, |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
393 (block + 1) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
394 * sizeof (struct w32_cached_metric *)); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
395 bzero (w32_font->cached_metrics + w32_font->n_cache_blocks, |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
396 ((block + 1 - w32_font->n_cache_blocks) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
397 * sizeof (struct w32_cached_metric *))); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
398 w32_font->n_cache_blocks = block + 1; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
399 } |
91593
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
400 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
401 if (!w32_font->cached_metrics[block]) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
402 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
403 w32_font->cached_metrics[block] |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
404 = xmalloc (CACHE_BLOCKSIZE * sizeof (struct font_metrics)); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
405 bzero (w32_font->cached_metrics[block], |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
406 CACHE_BLOCKSIZE * sizeof (struct font_metrics)); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
407 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
408 |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
409 char_metric = w32_font->cached_metrics[block] + pos_in_block; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
410 |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
411 if (char_metric->status == W32METRIC_NO_ATTEMPT) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
412 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
413 if (dc == NULL) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
414 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
415 /* TODO: Frames can come and go, and their fonts |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
416 outlive them. So we can't cache the frame in the |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
417 font structure. Use selected_frame until the API |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
418 is updated to pass in a frame. */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
419 f = XFRAME (selected_frame); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
420 |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
421 dc = get_frame_dc (f); |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
422 old_font = SelectObject (dc, ((W32FontStruct *) |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
423 (font->font.font))->hfont); |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
424 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
425 compute_metrics (dc, w32_font, *(code + i), char_metric); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
426 } |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
427 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
428 if (char_metric->status == W32METRIC_SUCCESS) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
429 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
430 metrics->lbearing = min (metrics->lbearing, |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
431 metrics->width + char_metric->lbearing); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
432 metrics->rbearing = max (metrics->rbearing, |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
433 metrics->width + char_metric->rbearing); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
434 metrics->width += char_metric->width; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
435 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
436 else |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
437 /* If we couldn't get metrics for a char, |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
438 use alternative method. */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
439 break; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
440 } |
91034
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 |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
455 /* For non-truetype fonts, GetGlyphOutlineW is not supported, so |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
456 fallback on other methods that will at least give some of the metric |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
457 information. */ |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
458 if (!wcode) { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
459 wcode = alloca (nglyphs * sizeof (WORD)); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
460 for (i = 0; i < nglyphs; i++) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
461 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
462 if (code[i] < 0x10000) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
463 wcode[i] = code[i]; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
464 else |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
465 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
466 /* TODO: Convert to surrogate, reallocating array if needed */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
467 wcode[i] = 0xffff; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
468 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
469 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
470 } |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
471 if (dc == NULL) |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
472 { |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
473 /* TODO: Frames can come and go, and their fonts outlive |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
474 them. So we can't cache the frame in the font structure. Use |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
475 selected_frame until the API is updated to pass in a |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
476 frame. */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
477 f = XFRAME (selected_frame); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
478 |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
479 dc = get_frame_dc (f); |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
480 old_font = SelectObject (dc, ((W32FontStruct *) |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
481 (font->font.font))->hfont); |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
482 } |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
483 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
484 if (GetTextExtentPoint32W (dc, wcode, nglyphs, &size)) |
90869 | 485 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
486 total_width = size.cx; |
90869 | 487 } |
488 | |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
489 /* On 95/98/ME, only some unicode functions are available, so fallback |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
490 on doing a dummy draw to find the total width. */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
491 if (!total_width) |
90869 | 492 { |
493 RECT rect; | |
494 rect.top = 0; rect.bottom = font->font.height; rect.left = 0; rect.right = 1; | |
495 DrawTextW (dc, wcode, nglyphs, &rect, | |
496 DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE); | |
497 total_width = rect.right; | |
498 } | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
499 |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
500 /* Give our best estimate of the metrics, based on what we know. */ |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
501 if (metrics) |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
502 { |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
503 metrics->width = total_width; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
504 metrics->lbearing = 0; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
505 metrics->rbearing = total_width |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
506 + ((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
|
507 } |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
508 |
90869 | 509 /* Restore state and release DC. */ |
510 SelectObject (dc, old_font); | |
91208 | 511 release_frame_dc (f, dc); |
90869 | 512 |
513 return total_width; | |
514 } | |
515 | |
516 /* w32 implementation of draw for font backend. | |
517 Optional. | |
518 Draw glyphs between FROM and TO of S->char2b at (X Y) pixel | |
519 position of frame F with S->FACE and S->GC. If WITH_BACKGROUND | |
520 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
|
521 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
|
522 |
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
523 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
|
524 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
|
525 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
|
526 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
|
527 */ |
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
528 |
91208 | 529 int |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
530 w32font_draw (s, from, to, x, y, with_background) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
531 struct glyph_string *s; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
532 int from, to, x, y, with_background; |
90869 | 533 { |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
534 UINT options; |
91030
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
535 HRGN orig_clip; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
536 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
|
537 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
538 options = w32font->glyph_idx; |
91030
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
539 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
540 /* Save clip region for later restoration. */ |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
541 GetClipRgn(s->hdc, orig_clip); |
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 if (s->num_clips > 0) |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
544 { |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
545 HRGN new_clip = CreateRectRgnIndirect (s->clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
546 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
547 if (s->num_clips > 1) |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
548 { |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
549 HRGN clip2 = CreateRectRgnIndirect (s->clip + 1); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
550 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
551 CombineRgn (new_clip, new_clip, clip2, RGN_OR); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
552 DeleteObject (clip2); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
553 } |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
554 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
555 SelectClipRgn (s->hdc, new_clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
556 DeleteObject (new_clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
557 } |
90869 | 558 |
91128
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
559 /* 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
|
560 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
|
561 SetBkMode (s->hdc, TRANSPARENT); |
90869 | 562 if (with_background) |
563 { | |
90908
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
564 HBRUSH brush; |
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
565 RECT rect; |
91128
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
566 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
|
567 |
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
568 brush = CreateSolidBrush (s->gc->background); |
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
569 rect.left = x; |
91128
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
570 rect.top = y - font->ascent; |
90908
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
571 rect.right = x + s->width; |
91128
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
572 rect.bottom = y + font->descent; |
90908
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
573 FillRect (s->hdc, &rect, brush); |
90915
9aac5aff0dda
(w32font_draw): Delete brush after using it.
Jason Rumney <jasonr@gnu.org>
parents:
90908
diff
changeset
|
574 DeleteObject (brush); |
90869 | 575 } |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
576 |
92187
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
577 if (s->padding_p) |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
578 { |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
579 int len = to - from, i; |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
580 |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
581 for (i = 0; i < len; i++) |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
582 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
|
583 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
|
584 } |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
585 else |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
586 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
|
587 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
588 /* Restore clip region. */ |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
589 if (s->num_clips > 0) |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
590 { |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
591 SelectClipRgn (s->hdc, orig_clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
592 } |
90869 | 593 } |
594 | |
595 /* w32 implementation of free_entity for font backend. | |
596 Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value). | |
597 Free FONT_EXTRA_INDEX field of FONT_ENTITY. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
598 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
599 w32font_free_entity (Lisp_Object entity); |
90869 | 600 */ |
601 | |
602 /* w32 implementation of prepare_face for font backend. | |
603 Optional (if FACE->extra is not used). | |
604 Prepare FACE for displaying characters by FONT on frame F by | |
605 storing some data in FACE->extra. If successful, return 0. | |
606 Otherwise, return -1. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
607 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
608 w32font_prepare_face (FRAME_PTR f, struct face *face); |
90869 | 609 */ |
610 /* w32 implementation of done_face for font backend. | |
611 Optional. | |
612 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
|
613 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
614 w32font_done_face (FRAME_PTR f, struct face *face); */ |
90869 | 615 |
616 /* w32 implementation of get_bitmap for font backend. | |
617 Optional. | |
618 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
|
619 intended that this method is called from the other font-driver |
90869 | 620 for actual drawing. |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
621 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
622 w32font_get_bitmap (struct font *font, unsigned code, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
623 struct font_bitmap *bitmap, int bits_per_pixel); |
90869 | 624 */ |
625 /* w32 implementation of free_bitmap for font backend. | |
626 Optional. | |
627 Free bitmap data in BITMAP. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
628 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
629 w32font_free_bitmap (struct font *font, struct font_bitmap *bitmap); |
90869 | 630 */ |
631 /* w32 implementation of get_outline for font backend. | |
632 Optional. | |
633 Return an outline data for glyph-code CODE of FONT. The format | |
634 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
|
635 static void * |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
636 w32font_get_outline (struct font *font, unsigned code); |
90869 | 637 */ |
638 /* w32 implementation of free_outline for font backend. | |
639 Optional. | |
640 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
|
641 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
642 w32font_free_outline (struct font *font, void *outline); |
90869 | 643 */ |
644 /* w32 implementation of anchor_point for font backend. | |
645 Optional. | |
646 Get coordinates of the INDEXth anchor point of the glyph whose | |
647 code is CODE. Store the coordinates in *X and *Y. Return 0 if | |
648 the operations was successfull. Otherwise return -1. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
649 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
650 w32font_anchor_point (struct font *font, unsigned code, |
90869 | 651 int index, int *x, int *y); |
652 */ | |
653 /* w32 implementation of otf_capability for font backend. | |
654 Optional. | |
655 Return a list describing which scripts/languages FONT | |
656 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
|
657 static Lisp_Object |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
658 w32font_otf_capability (struct font *font); |
90869 | 659 */ |
660 /* w32 implementation of otf_drive for font backend. | |
661 Optional. | |
662 Apply FONT's OTF-FEATURES to the glyph string. | |
663 | |
664 FEATURES specifies which OTF features to apply in this format: | |
665 (SCRIPT LANGSYS GSUB-FEATURE GPOS-FEATURE) | |
666 See the documentation of `font-drive-otf' for the detail. | |
667 | |
668 This method applies the specified features to the codes in the | |
669 elements of GSTRING-IN (between FROMth and TOth). The output | |
670 codes are stored in GSTRING-OUT at the IDXth element and the | |
671 following elements. | |
672 | |
673 Return the number of output codes. If none of the features are | |
674 applicable to the input data, return 0. If GSTRING-OUT is too | |
675 short, return -1. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
676 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
677 w32font_otf_drive (struct font *font, Lisp_Object features, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
678 Lisp_Object gstring_in, int from, int to, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
679 Lisp_Object gstring_out, int idx, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
680 int alternate_subst); |
90869 | 681 */ |
682 | |
91208 | 683 /* Internal implementation of w32font_list. |
684 Additional parameter opentype_only restricts the returned fonts to | |
685 opentype fonts, which can be used with the Uniscribe backend. */ | |
686 Lisp_Object | |
687 w32font_list_internal (frame, font_spec, opentype_only) | |
688 Lisp_Object frame, font_spec; | |
689 int opentype_only; | |
690 { | |
691 struct font_callback_data match_data; | |
692 HDC dc; | |
693 FRAME_PTR f = XFRAME (frame); | |
694 | |
695 match_data.orig_font_spec = font_spec; | |
696 match_data.list = Qnil; | |
697 match_data.frame = frame; | |
698 | |
699 bzero (&match_data.pattern, sizeof (LOGFONT)); | |
700 fill_in_logfont (f, &match_data.pattern, font_spec); | |
701 | |
702 match_data.opentype_only = opentype_only; | |
703 if (opentype_only) | |
704 match_data.pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; | |
705 | |
706 if (match_data.pattern.lfFaceName[0] == '\0') | |
707 { | |
708 /* EnumFontFamiliesEx does not take other fields into account if | |
709 font name is blank, so need to use two passes. */ | |
710 list_all_matching_fonts (&match_data); | |
711 } | |
712 else | |
713 { | |
714 dc = get_frame_dc (f); | |
715 | |
716 EnumFontFamiliesEx (dc, &match_data.pattern, | |
717 (FONTENUMPROC) add_font_entity_to_list, | |
718 (LPARAM) &match_data, 0); | |
719 release_frame_dc (f, dc); | |
720 } | |
721 | |
722 return NILP (match_data.list) ? null_vector : Fvconcat (1, &match_data.list); | |
723 } | |
724 | |
725 /* Internal implementation of w32font_match. | |
726 Additional parameter opentype_only restricts the returned fonts to | |
727 opentype fonts, which can be used with the Uniscribe backend. */ | |
728 Lisp_Object | |
729 w32font_match_internal (frame, font_spec, opentype_only) | |
730 Lisp_Object frame, font_spec; | |
731 int opentype_only; | |
732 { | |
733 struct font_callback_data match_data; | |
734 HDC dc; | |
735 FRAME_PTR f = XFRAME (frame); | |
736 | |
737 match_data.orig_font_spec = font_spec; | |
738 match_data.frame = frame; | |
739 match_data.list = Qnil; | |
740 | |
741 bzero (&match_data.pattern, sizeof (LOGFONT)); | |
742 fill_in_logfont (f, &match_data.pattern, font_spec); | |
743 | |
744 match_data.opentype_only = opentype_only; | |
745 if (opentype_only) | |
746 match_data.pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; | |
747 | |
748 dc = get_frame_dc (f); | |
749 | |
750 EnumFontFamiliesEx (dc, &match_data.pattern, | |
751 (FONTENUMPROC) add_one_font_entity_to_list, | |
752 (LPARAM) &match_data, 0); | |
753 release_frame_dc (f, dc); | |
754 | |
755 return NILP (match_data.list) ? Qnil : XCAR (match_data.list); | |
756 } | |
757 | |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
758 int |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
759 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
|
760 FRAME_PTR f; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
761 Lisp_Object font_entity; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
762 int pixel_size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
763 struct w32font_info *w32_font; |
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 int len, size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
766 LOGFONT logfont; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
767 HDC dc; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
768 HFONT hfont, old_font; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
769 Lisp_Object val, extra; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
770 /* For backwards compatibility. */ |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
771 W32FontStruct *compat_w32_font; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
772 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
773 struct font * font = (struct font *) w32_font; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
774 if (!font) |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
775 return 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
776 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
777 bzero (&logfont, sizeof (logfont)); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
778 fill_in_logfont (f, &logfont, font_entity); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
779 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
780 size = XINT (AREF (font_entity, FONT_SIZE_INDEX)); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
781 if (!size) |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
782 size = pixel_size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
783 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
784 logfont.lfHeight = -size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
785 hfont = CreateFontIndirect (&logfont); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
786 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
787 if (hfont == NULL) |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
788 return 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
789 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
790 /* Get the metrics for this font. */ |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
791 dc = get_frame_dc (f); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
792 old_font = SelectObject (dc, hfont); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
793 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
794 GetTextMetrics (dc, &w32_font->metrics); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
795 |
92712
fb1da73bc0c4
(w32font_full_name): Use floor to round.
Jason Rumney <jasonr@gnu.org>
parents:
92539
diff
changeset
|
796 w32_font->glyph_idx = ETO_GLYPH_INDEX; |
fb1da73bc0c4
(w32font_full_name): Use floor to round.
Jason Rumney <jasonr@gnu.org>
parents:
92539
diff
changeset
|
797 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
798 w32_font->cached_metrics = NULL; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
799 w32_font->n_cache_blocks = 0; |
92411
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
800 |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
801 SelectObject (dc, old_font); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
802 release_frame_dc (f, dc); |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
803 |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
804 /* 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
|
805 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
|
806 font->font.font = xmalloc (sizeof (W32FontStruct)); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
807 compat_w32_font = (W32FontStruct *) font->font.font; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
808 bzero (compat_w32_font, sizeof (W32FontStruct)); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
809 compat_w32_font->font_type = UNICODE_FONT; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
810 /* Duplicate the text metrics. */ |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
811 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
|
812 compat_w32_font->hfont = hfont; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
813 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
814 len = strlen (logfont.lfFaceName); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
815 font->font.name = (char *) xmalloc (len + 1); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
816 bcopy (logfont.lfFaceName, font->font.name, len); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
817 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
|
818 |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
819 { |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
820 char *name; |
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 /* 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
|
823 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
|
824 len = 96; |
91521
e96ff7166c81
(w32font_open_internal): Use xmalloc, xrealloc, xfree.
Jason Rumney <jasonr@gnu.org>
parents:
91496
diff
changeset
|
825 name = xmalloc (len); |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
826 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
|
827 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
|
828 { |
91521
e96ff7166c81
(w32font_open_internal): Use xmalloc, xrealloc, xfree.
Jason Rumney <jasonr@gnu.org>
parents:
91496
diff
changeset
|
829 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
|
830 |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
831 if (! new) |
91521
e96ff7166c81
(w32font_open_internal): Use xmalloc, xrealloc, xfree.
Jason Rumney <jasonr@gnu.org>
parents:
91496
diff
changeset
|
832 xfree (name); |
91496
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
833 name = new; |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
834 } |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
835 if (name) |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
836 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
|
837 else |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
838 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
|
839 } |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
840 font->font.charset = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
841 font->font.codepage = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
842 font->font.size = w32_font->metrics.tmMaxCharWidth; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
843 font->font.height = w32_font->metrics.tmHeight |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
844 + w32_font->metrics.tmExternalLeading; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
845 font->font.space_width = font->font.average_width |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
846 = w32_font->metrics.tmAveCharWidth; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
847 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
848 font->font.vertical_centering = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
849 font->font.encoding_type = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
850 font->font.baseline_offset = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
851 font->font.relative_compose = 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
852 font->font.default_ascent = w32_font->metrics.tmAscent; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
853 font->font.font_encoder = NULL; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
854 font->entity = font_entity; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
855 font->pixel_size = size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
856 font->driver = &w32font_driver; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
857 /* 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
|
858 here is incomplete. */ |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
859 extra = AREF (font_entity, FONT_EXTRA_INDEX); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
860 if (CONSP (extra)) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
861 { |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
862 val = assq_no_quit (QCformat, extra); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
863 if (CONSP (val)) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
864 font->format = XCDR (val); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
865 else |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
866 font->format = Qunknown; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
867 } |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
868 else |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
869 font->format = Qunknown; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
870 |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
871 font->file_name = NULL; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
872 font->encoding_charset = -1; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
873 font->repertory_charset = -1; |
91545
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
874 /* 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
|
875 font->min_width = font->font.space_width; |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
876 font->ascent = w32_font->metrics.tmAscent; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
877 font->descent = w32_font->metrics.tmDescent; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
878 font->scalable = w32_font->metrics.tmPitchAndFamily & TMPF_VECTOR; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
879 |
91545
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
880 /* 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
|
881 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
|
882 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
|
883 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
|
884 reallocation necessary. */ |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
885 { |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
886 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
|
887 dpyinfo->n_fonts++; |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
888 |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
889 if (dpyinfo->n_fonts == 1) |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
890 { |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
891 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
|
892 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
|
893 } |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
894 else |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
895 { |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
896 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
|
897 { |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
898 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
|
899 fonts_changed_p |= 1; |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
900 } |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
901 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
|
902 { |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
903 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
|
904 fonts_changed_p |= 1; |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
905 } |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
906 } |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
907 } |
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
908 |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
909 return 1; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
910 } |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
911 |
90869 | 912 /* Callback function for EnumFontFamiliesEx. |
913 * 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
|
914 static int CALLBACK |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
915 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
|
916 ENUMLOGFONTEX *logical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
917 NEWTEXTMETRICEX *physical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
918 DWORD font_type; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
919 LPARAM list_object; |
90869 | 920 { |
921 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
|
922 Lisp_Object family; |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
923 |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
924 /* 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
|
925 if (logical_font->elfLogFont.lfFaceName[0] == '@') |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
926 return 1; |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
927 |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
928 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
|
929 strlen (logical_font->elfLogFont.lfFaceName)); |
90869 | 930 if (! memq_no_quit (family, *list)) |
931 *list = Fcons (family, *list); | |
932 | |
933 return 1; | |
934 } | |
935 | |
936 /* 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
|
937 static Lisp_Object |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
938 w32_enumfont_pattern_entity (frame, logical_font, physical_font, |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
939 font_type, requested_font, backend) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
940 Lisp_Object frame; |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
941 ENUMLOGFONTEX *logical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
942 NEWTEXTMETRICEX *physical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
943 DWORD font_type; |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
944 LOGFONT *requested_font; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
945 Lisp_Object backend; |
90869 | 946 { |
947 Lisp_Object entity, tem; | |
948 LOGFONT *lf = (LOGFONT*) logical_font; | |
949 BYTE generic_type; | |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
950 DWORD full_type = physical_font->ntmTm.ntmFlags; |
90869 | 951 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
952 entity = Fmake_vector (make_number (FONT_ENTITY_MAX), Qnil); |
90869 | 953 |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
954 ASET (entity, FONT_TYPE_INDEX, backend); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
955 ASET (entity, FONT_FRAME_INDEX, frame); |
92539
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
956 ASET (entity, FONT_REGISTRY_INDEX, w32_registry (lf->lfCharSet, font_type)); |
90869 | 957 ASET (entity, FONT_OBJLIST_INDEX, Qnil); |
958 | |
959 /* 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
|
960 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
|
961 generic. Thes values make xflds compatible with Emacs 22. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
962 if (lf->lfOutPrecision == OUT_STRING_PRECIS) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
963 tem = Qraster; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
964 else if (lf->lfOutPrecision == OUT_STROKE_PRECIS) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
965 tem = Qoutline; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
966 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
967 tem = Qunknown; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
968 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
969 ASET (entity, FONT_FOUNDRY_INDEX, tem); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
970 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
971 /* 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
|
972 useful to users looking for a close match. */ |
90869 | 973 generic_type = physical_font->ntmTm.tmPitchAndFamily & 0xF0; |
974 if (generic_type == FF_DECORATIVE) | |
975 tem = Qdecorative; | |
976 else if (generic_type == FF_MODERN) | |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
977 tem = Qmono; |
90869 | 978 else if (generic_type == FF_ROMAN) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
979 tem = Qserif; |
90869 | 980 else if (generic_type == FF_SCRIPT) |
981 tem = Qscript; | |
982 else if (generic_type == FF_SWISS) | |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
983 tem = Qsans; |
90869 | 984 else |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
985 tem = null_string; |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
986 |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
987 ASET (entity, FONT_ADSTYLE_INDEX, tem); |
90869 | 988 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
989 if (physical_font->ntmTm.tmPitchAndFamily & 0x01) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
990 font_put_extra (entity, QCspacing, make_number (FONT_SPACING_PROPORTIONAL)); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
991 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
992 font_put_extra (entity, QCspacing, make_number (FONT_SPACING_MONO)); |
90869 | 993 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
994 if (requested_font->lfQuality != DEFAULT_QUALITY) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
995 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
996 font_put_extra (entity, QCantialias, |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
997 lispy_antialias_type (requested_font->lfQuality)); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
998 } |
90869 | 999 ASET (entity, FONT_FAMILY_INDEX, |
1000 intern_downcase (lf->lfFaceName, strlen (lf->lfFaceName))); | |
1001 | |
1002 ASET (entity, FONT_WEIGHT_INDEX, make_number (lf->lfWeight)); | |
1003 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
|
1004 /* 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
|
1005 to get it. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1006 ASET (entity, FONT_WIDTH_INDEX, make_number (100)); |
90869 | 1007 |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1008 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
|
1009 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
|
1010 else |
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1011 ASET (entity, FONT_SIZE_INDEX, make_number (0)); |
90869 | 1012 |
1013 /* Cache unicode codepoints covered by this font, as there is no other way | |
1014 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
|
1015 if (font_type & TRUETYPE_FONTTYPE) |
90869 | 1016 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1017 font_put_extra (entity, QCscript, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1018 font_supported_scripts (&physical_font->ntmFontSig)); |
90869 | 1019 } |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1020 |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1021 /* This information is not fully available when opening fonts, so |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1022 save it here. Only Windows 2000 and later return information |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1023 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
|
1024 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
|
1025 have obtained later. */ |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1026 if (EQ (backend, Quniscribe) && (full_type & NTMFLAGS_OPENTYPE)) |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1027 tem = intern ("opentype"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1028 else if (font_type & TRUETYPE_FONTTYPE) |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1029 tem = intern ("truetype"); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1030 else if (full_type & NTM_PS_OPENTYPE) |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1031 tem = intern ("postscript"); |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1032 else if (full_type & NTM_TYPE1) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1033 tem = intern ("type1"); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1034 else if (font_type & RASTER_FONTTYPE) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1035 tem = intern ("w32bitmap"); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1036 else |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1037 tem = intern ("w32vector"); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1038 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1039 font_put_extra (entity, QCformat, tem); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1040 |
90869 | 1041 return entity; |
1042 } | |
1043 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1044 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1045 /* Convert generic families to the family portion of lfPitchAndFamily. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1046 BYTE |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1047 w32_generic_family (Lisp_Object name) |
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 /* Generic families. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1050 if (EQ (name, Qmonospace) || EQ (name, Qmono)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1051 return FF_MODERN; |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1052 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
|
1053 return FF_SWISS; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1054 else if (EQ (name, Qserif)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1055 return FF_ROMAN; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1056 else if (EQ (name, Qdecorative)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1057 return FF_DECORATIVE; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1058 else if (EQ (name, Qscript)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1059 return FF_SCRIPT; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1060 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1061 return FF_DONTCARE; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1062 } |
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 static int |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1065 logfonts_match (font, pattern) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1066 LOGFONT *font, *pattern; |
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 /* Only check height for raster fonts. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1069 if (pattern->lfHeight && font->lfOutPrecision == OUT_STRING_PRECIS |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1070 && font->lfHeight != pattern->lfHeight) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1071 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1072 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1073 /* Have some flexibility with weights. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1074 if (pattern->lfWeight |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1075 && ((font->lfWeight < (pattern->lfWeight - 150)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1076 || font->lfWeight > (pattern->lfWeight + 150))) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1077 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1078 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1079 /* 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
|
1080 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
|
1081 return 1; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1082 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1083 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1084 static int |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1085 font_matches_spec (type, font, spec, backend, logfont) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1086 DWORD type; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1087 NEWTEXTMETRICEX *font; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1088 Lisp_Object spec; |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1089 Lisp_Object backend; |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1090 LOGFONT *logfont; |
90869 | 1091 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1092 Lisp_Object extra, val; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1093 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1094 /* 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
|
1095 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
|
1096 val = AREF (spec, FONT_SLANT_INDEX); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1097 if (INTEGERP (val)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1098 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1099 int slant = XINT (val); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1100 if ((slant > 150 && !font->ntmTm.tmItalic) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1101 || (slant <= 150 && font->ntmTm.tmItalic)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1102 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1103 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1104 |
91264
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1105 /* Check adstyle against generic family. */ |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1106 val = AREF (spec, FONT_ADSTYLE_INDEX); |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1107 if (!NILP (val)) |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1108 { |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1109 BYTE family = w32_generic_family (val); |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1110 if (family != FF_DONTCARE |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1111 && family != (font->ntmTm.tmPitchAndFamily & 0xF0)) |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1112 return 0; |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1113 } |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1114 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1115 /* Check extra parameters. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1116 for (extra = AREF (spec, FONT_EXTRA_INDEX); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1117 CONSP (extra); extra = XCDR (extra)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1118 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1119 Lisp_Object extra_entry; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1120 extra_entry = XCAR (extra); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1121 if (CONSP (extra_entry)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1122 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1123 Lisp_Object key = XCAR (extra_entry); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1124 val = XCDR (extra_entry); |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1125 if (EQ (key, QCspacing)) |
90906
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 int proportional; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1128 if (INTEGERP (val)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1129 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1130 int spacing = XINT (val); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1131 proportional = (spacing < FONT_SPACING_MONO); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1132 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1133 else if (EQ (val, Qp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1134 proportional = 1; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1135 else if (EQ (val, Qc) || EQ (val, Qm)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1136 proportional = 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1137 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1138 return 0; /* Bad font spec. */ |
90869 | 1139 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1140 if ((proportional && !(font->ntmTm.tmPitchAndFamily & 0x01)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1141 || (!proportional && (font->ntmTm.tmPitchAndFamily & 0x01))) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1142 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1143 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1144 else if (EQ (key, QCscript) && SYMBOLP (val)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1145 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1146 /* Only truetype fonts will have information about what |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1147 scripts they support. This probably means the user |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1148 will have to force Emacs to use raster, postscript |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1149 or atm fonts for non-ASCII text. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1150 if (type & TRUETYPE_FONTTYPE) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1151 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1152 Lisp_Object support |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1153 = font_supported_scripts (&font->ntmFontSig); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1154 if (! memq_no_quit (val, support)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1155 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1156 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1157 else |
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 /* Return specific matches, but play it safe. Fonts |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1160 that cover more than their charset would suggest |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1161 are likely to be truetype or opentype fonts, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1162 covered above. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1163 if (EQ (val, Qlatin)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1164 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1165 /* Although every charset but symbol, thai and |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1166 arabic contains the basic ASCII set of latin |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1167 characters, Emacs expects much more. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1168 if (font->ntmTm.tmCharSet != ANSI_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1169 return 0; |
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 else if (EQ (val, Qsymbol)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1172 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1173 if (font->ntmTm.tmCharSet != SYMBOL_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1174 return 0; |
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 else if (EQ (val, Qcyrillic)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1177 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1178 if (font->ntmTm.tmCharSet != RUSSIAN_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1179 return 0; |
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 else if (EQ (val, Qgreek)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1182 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1183 if (font->ntmTm.tmCharSet != GREEK_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1184 return 0; |
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 else if (EQ (val, Qarabic)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1187 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1188 if (font->ntmTm.tmCharSet != ARABIC_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1189 return 0; |
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 else if (EQ (val, Qhebrew)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1192 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1193 if (font->ntmTm.tmCharSet != HEBREW_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1194 return 0; |
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 else if (EQ (val, Qthai)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1197 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1198 if (font->ntmTm.tmCharSet != THAI_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1199 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1200 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1201 else if (EQ (val, Qkana)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1202 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1203 if (font->ntmTm.tmCharSet != SHIFTJIS_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1204 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1205 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1206 else if (EQ (val, Qbopomofo)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1207 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1208 if (font->ntmTm.tmCharSet != CHINESEBIG5_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1209 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1210 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1211 else if (EQ (val, Qhangul)) |
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 if (font->ntmTm.tmCharSet != HANGUL_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1214 && font->ntmTm.tmCharSet != JOHAB_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1215 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1216 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1217 else if (EQ (val, Qhan)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1218 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1219 if (font->ntmTm.tmCharSet != CHINESEBIG5_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1220 && font->ntmTm.tmCharSet != GB2312_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1221 && font->ntmTm.tmCharSet != HANGUL_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1222 && font->ntmTm.tmCharSet != JOHAB_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1223 && font->ntmTm.tmCharSet != SHIFTJIS_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1224 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1225 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1226 else |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1227 /* Other scripts unlikely to be handled by non-truetype |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1228 fonts. */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1229 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1230 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1231 } |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1232 else if (EQ (key, QClanguage) && SYMBOLP (val)) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1233 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1234 /* Just handle the CJK languages here, as the language |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1235 parameter is used to select a font with appropriate |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1236 glyphs in the cjk unified ideographs block. Other fonts |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1237 support for a language can be solely determined by |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1238 its character coverage. */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1239 if (EQ (val, Qja)) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1240 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1241 if (font->ntmTm.tmCharSet != SHIFTJIS_CHARSET) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1242 return 0; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1243 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1244 else if (EQ (val, Qko)) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1245 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1246 if (font->ntmTm.tmCharSet != HANGUL_CHARSET |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1247 && font->ntmTm.tmCharSet != JOHAB_CHARSET) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1248 return 0; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1249 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1250 else if (EQ (val, Qzh)) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1251 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1252 if (font->ntmTm.tmCharSet != GB2312_CHARSET |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1253 && font->ntmTm.tmCharSet != CHINESEBIG5_CHARSET) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1254 return 0; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1255 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1256 else |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1257 /* Any other language, we don't recognize it. Fontset |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1258 spec should have a fallback, as some backends do |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1259 not recognize language at all. */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1260 return 0; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1261 } |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1262 else if (EQ (key, QCotf) && CONSP (val)) |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1263 { |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1264 /* OTF features only supported by the uniscribe backend. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1265 if (EQ (backend, Quniscribe)) |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1266 { |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1267 if (!uniscribe_check_otf (logfont, val)) |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1268 return 0; |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1269 } |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1270 else |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1271 return 0; |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1272 } |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1273 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1274 } |
90869 | 1275 return 1; |
1276 } | |
1277 | |
92539
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1278 static int |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1279 w32font_coverage_ok (coverage, charset) |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1280 FONTSIGNATURE * coverage; |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1281 BYTE charset; |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1282 { |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1283 DWORD subrange1 = coverage->fsUsb[1]; |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1284 |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1285 #define SUBRANGE1_HAN_MASK 0x08000000 |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1286 #define SUBRANGE1_HANGEUL_MASK 0x01000000 |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1287 #define SUBRANGE1_JAPANESE_MASK (0x00060000 | SUBRANGE1_HAN_MASK) |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1288 |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1289 if (charset == GB2312_CHARSET || charset == CHINESEBIG5_CHARSET) |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1290 { |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1291 return (subrange1 & SUBRANGE1_HAN_MASK) == SUBRANGE1_HAN_MASK; |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1292 } |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1293 else if (charset == SHIFTJIS_CHARSET) |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1294 { |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1295 return (subrange1 & SUBRANGE1_JAPANESE_MASK) == SUBRANGE1_JAPANESE_MASK; |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1296 } |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1297 else if (charset == HANGEUL_CHARSET) |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1298 { |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1299 return (subrange1 & SUBRANGE1_HANGEUL_MASK) == SUBRANGE1_HANGEUL_MASK; |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1300 } |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1301 |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1302 return 1; |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1303 } |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1304 |
90869 | 1305 /* Callback function for EnumFontFamiliesEx. |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1306 * 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
|
1307 * 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
|
1308 * 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
|
1309 * 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
|
1310 static int CALLBACK |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1311 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
|
1312 ENUMLOGFONTEX *logical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1313 NEWTEXTMETRICEX *physical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1314 DWORD font_type; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1315 LPARAM lParam; |
90869 | 1316 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1317 struct font_callback_data *match_data |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1318 = (struct font_callback_data *) lParam; |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1319 Lisp_Object backend = match_data->opentype_only ? Quniscribe : Qgdi; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1320 |
91208 | 1321 if ((!match_data->opentype_only |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1322 || (physical_font->ntmTm.ntmFlags & NTMFLAGS_OPENTYPE) |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1323 || (font_type & TRUETYPE_FONTTYPE)) |
91208 | 1324 && logfonts_match (&logical_font->elfLogFont, &match_data->pattern) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1325 && font_matches_spec (font_type, physical_font, |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1326 match_data->orig_font_spec, backend, |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1327 &logical_font->elfLogFont) |
92539
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1328 && w32font_coverage_ok (&physical_font->ntmFontSig, |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1329 match_data->pattern.lfCharSet) |
91264
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1330 /* 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
|
1331 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
|
1332 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
|
1333 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
|
1334 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
|
1335 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
|
1336 anywhere within the full name. */ |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1337 && (logical_font->elfLogFont.lfOutPrecision != OUT_STRING_PRECIS |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1338 || strstr (logical_font->elfFullName, |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1339 logical_font->elfLogFont.lfFaceName))) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1340 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1341 Lisp_Object entity |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1342 = 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
|
1343 physical_font, font_type, |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1344 &match_data->pattern, |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1345 backend); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1346 if (!NILP (entity)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1347 match_data->list = Fcons (entity, match_data->list); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1348 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1349 return 1; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1350 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1351 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1352 /* Callback function for EnumFontFamiliesEx. |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1353 * Terminates the search once we have a match. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1354 static int CALLBACK |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1355 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
|
1356 ENUMLOGFONTEX *logical_font; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1357 NEWTEXTMETRICEX *physical_font; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1358 DWORD font_type; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1359 LPARAM lParam; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1360 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1361 struct font_callback_data *match_data |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1362 = (struct font_callback_data *) lParam; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1363 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
|
1364 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1365 /* 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
|
1366 return !NILP (match_data->list); |
90869 | 1367 } |
1368 | |
1369 /* 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
|
1370 static LONG |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1371 registry_to_w32_charset (charset) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1372 Lisp_Object charset; |
90869 | 1373 { |
1374 if (EQ (charset, Qiso10646_1) || EQ (charset, Qunicode_bmp) | |
1375 || EQ (charset, Qunicode_sip)) | |
1376 return DEFAULT_CHARSET; /* UNICODE_CHARSET not defined in MingW32 */ | |
1377 else if (EQ (charset, Qiso8859_1)) | |
1378 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
|
1379 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
|
1380 return x_to_w32_charset (SDATA (SYMBOL_NAME (charset))); |
90869 | 1381 else |
1382 return DEFAULT_CHARSET; | |
1383 } | |
1384 | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1385 static Lisp_Object |
92539
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1386 w32_registry (w32_charset, font_type) |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1387 LONG w32_charset; |
92539
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1388 DWORD font_type; |
90869 | 1389 { |
92539
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1390 /* If charset is defaulted, use ANSI (unicode for truetype fonts). */ |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1391 if (w32_charset == DEFAULT_CHARSET) |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1392 w32_charset = ANSI_CHARSET; |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1393 |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1394 if (font_type == TRUETYPE_FONTTYPE && w32_charset == ANSI_CHARSET) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1395 return Qiso10646_1; |
90869 | 1396 else |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1397 { |
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1398 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
|
1399 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
|
1400 } |
90869 | 1401 } |
1402 | |
1403 /* 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
|
1404 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1405 fill_in_logfont (f, logfont, font_spec) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1406 FRAME_PTR f; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1407 LOGFONT *logfont; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1408 Lisp_Object font_spec; |
90869 | 1409 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1410 Lisp_Object tmp, extra; |
90869 | 1411 int dpi = FRAME_W32_DISPLAY_INFO (f)->resy; |
1412 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1413 extra = AREF (font_spec, FONT_EXTRA_INDEX); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1414 /* Allow user to override dpi settings. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1415 if (CONSP (extra)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1416 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1417 tmp = assq_no_quit (QCdpi, extra); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1418 if (CONSP (tmp) && INTEGERP (XCDR (tmp))) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1419 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1420 dpi = XINT (XCDR (tmp)); |
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 (CONSP (tmp) && FLOATP (XCDR (tmp))) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1423 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1424 dpi = (int) (XFLOAT_DATA (XCDR (tmp)) + 0.5); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1425 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1426 } |
90869 | 1427 |
1428 /* Height */ | |
1429 tmp = AREF (font_spec, FONT_SIZE_INDEX); | |
1430 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
|
1431 logfont->lfHeight = -1 * XINT (tmp); |
90869 | 1432 else if (FLOATP (tmp)) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1433 logfont->lfHeight = (int) (-1.0 * dpi * XFLOAT_DATA (tmp) / 72.27 + 0.5); |
90869 | 1434 |
1435 /* Escapement */ | |
1436 | |
1437 /* Orientation */ | |
1438 | |
1439 /* Weight */ | |
1440 tmp = AREF (font_spec, FONT_WEIGHT_INDEX); | |
1441 if (INTEGERP (tmp)) | |
1442 logfont->lfWeight = XINT (tmp); | |
1443 | |
1444 /* Italic */ | |
1445 tmp = AREF (font_spec, FONT_SLANT_INDEX); | |
1446 if (INTEGERP (tmp)) | |
1447 { | |
1448 int slant = XINT (tmp); | |
1449 logfont->lfItalic = slant > 150 ? 1 : 0; | |
1450 } | |
1451 | |
1452 /* Underline */ | |
1453 | |
1454 /* Strikeout */ | |
1455 | |
1456 /* Charset */ | |
1457 tmp = AREF (font_spec, FONT_REGISTRY_INDEX); | |
1458 if (! NILP (tmp)) | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1459 logfont->lfCharSet = registry_to_w32_charset (tmp); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1460 else |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1461 logfont->lfCharSet = DEFAULT_CHARSET; |
90869 | 1462 |
1463 /* Out Precision */ | |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1464 |
90869 | 1465 /* Clip Precision */ |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1466 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1467 /* Quality */ |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1468 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
|
1469 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1470 /* Generic Family and Face Name */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1471 logfont->lfPitchAndFamily = FF_DONTCARE | DEFAULT_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1472 |
90869 | 1473 tmp = AREF (font_spec, FONT_FAMILY_INDEX); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1474 if (! NILP (tmp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1475 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1476 logfont->lfPitchAndFamily = w32_generic_family (tmp) | DEFAULT_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1477 if ((logfont->lfPitchAndFamily & 0xF0) != FF_DONTCARE) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1478 ; /* Font name was generic, don't fill in font name. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1479 /* 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
|
1480 user input. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1481 else if (SYMBOLP (tmp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1482 strncpy (logfont->lfFaceName, SDATA (SYMBOL_NAME (tmp)), LF_FACESIZE); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1483 } |
90869 | 1484 |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1485 tmp = AREF (font_spec, FONT_ADSTYLE_INDEX); |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1486 if (!NILP (tmp)) |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1487 { |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1488 /* Override generic family. */ |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1489 BYTE family = w32_generic_family (tmp); |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1490 if (family != FF_DONTCARE) |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1491 logfont->lfPitchAndFamily = family | DEFAULT_PITCH; |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1492 } |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1493 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1494 /* Process EXTRA info. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1495 for ( ; CONSP (extra); extra = XCDR (extra)) |
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 tmp = XCAR (extra); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1498 if (CONSP (tmp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1499 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1500 Lisp_Object key, val; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1501 key = XCAR (tmp), val = XCDR (tmp); |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1502 if (EQ (key, QCspacing)) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1503 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1504 /* Set pitch based on the spacing property. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1505 if (INTEGERP (val)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1506 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1507 int spacing = XINT (val); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1508 if (spacing < FONT_SPACING_MONO) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1509 logfont->lfPitchAndFamily |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1510 = logfont->lfPitchAndFamily & 0xF0 | VARIABLE_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1511 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1512 logfont->lfPitchAndFamily |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1513 = logfont->lfPitchAndFamily & 0xF0 | FIXED_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1514 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1515 else if (EQ (val, Qp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1516 logfont->lfPitchAndFamily |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1517 = logfont->lfPitchAndFamily & 0xF0 | VARIABLE_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1518 else if (EQ (val, Qc) || EQ (val, Qm)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1519 logfont->lfPitchAndFamily |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1520 = logfont->lfPitchAndFamily & 0xF0 | FIXED_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1521 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1522 /* 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
|
1523 and a single script is specified. This is rather crude, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1524 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
|
1525 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
|
1526 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
|
1527 them. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1528 else if (EQ (key, QCscript) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1529 && logfont->lfCharSet == DEFAULT_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1530 && SYMBOLP (val)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1531 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1532 if (EQ (val, Qgreek)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1533 logfont->lfCharSet = GREEK_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1534 else if (EQ (val, Qhangul)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1535 logfont->lfCharSet = HANGUL_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1536 else if (EQ (val, Qkana) || EQ (val, Qkanbun)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1537 logfont->lfCharSet = SHIFTJIS_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1538 else if (EQ (val, Qbopomofo)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1539 logfont->lfCharSet = CHINESEBIG5_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1540 /* GB 18030 supports tibetan, yi, mongolian, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1541 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
|
1542 GB2312 fonts. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1543 else if (EQ (val, Qtibetan) || EQ (val, Qyi) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1544 || EQ (val, Qmongolian)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1545 logfont->lfCharSet = GB2312_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1546 else if (EQ (val, Qhebrew)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1547 logfont->lfCharSet = HEBREW_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1548 else if (EQ (val, Qarabic)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1549 logfont->lfCharSet = ARABIC_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1550 else if (EQ (val, Qthai)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1551 logfont->lfCharSet = THAI_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1552 else if (EQ (val, Qsymbol)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1553 logfont->lfCharSet = SYMBOL_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1554 } |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1555 else if (EQ (key, QCantialias) && SYMBOLP (val)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1556 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1557 logfont->lfQuality = w32_antialias_type (val); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1558 } |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1559 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1560 } |
90869 | 1561 } |
1562 | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1563 static void |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1564 list_all_matching_fonts (match_data) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1565 struct font_callback_data *match_data; |
90869 | 1566 { |
1567 HDC dc; | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1568 Lisp_Object families = w32font_list_family (match_data->frame); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1569 struct frame *f = XFRAME (match_data->frame); |
90869 | 1570 |
1571 dc = get_frame_dc (f); | |
1572 | |
1573 while (!NILP (families)) | |
1574 { | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1575 /* 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
|
1576 handle non-ASCII font names. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1577 char *name; |
90869 | 1578 Lisp_Object family = CAR (families); |
1579 families = CDR (families); | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1580 if (NILP (family)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1581 continue; |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1582 else if (SYMBOLP (family)) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1583 name = SDATA (SYMBOL_NAME (family)); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1584 else |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1585 continue; |
90869 | 1586 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1587 strncpy (match_data->pattern.lfFaceName, name, LF_FACESIZE); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1588 match_data->pattern.lfFaceName[LF_FACESIZE - 1] = '\0'; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1589 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1590 EnumFontFamiliesEx (dc, &match_data->pattern, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1591 (FONTENUMPROC) add_font_entity_to_list, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1592 (LPARAM) match_data, 0); |
90869 | 1593 } |
1594 | |
1595 release_frame_dc (f, dc); | |
1596 } | |
1597 | |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1598 static Lisp_Object |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1599 lispy_antialias_type (type) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1600 BYTE type; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1601 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1602 Lisp_Object lispy; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1603 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1604 switch (type) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1605 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1606 case NONANTIALIASED_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1607 lispy = Qnone; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1608 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1609 case ANTIALIASED_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1610 lispy = Qstandard; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1611 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1612 case CLEARTYPE_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1613 lispy = Qsubpixel; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1614 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1615 case CLEARTYPE_NATURAL_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1616 lispy = Qnatural; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1617 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1618 default: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1619 lispy = Qnil; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1620 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1621 } |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1622 return lispy; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1623 } |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1624 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1625 /* Convert antialiasing symbols to lfQuality */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1626 static BYTE |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1627 w32_antialias_type (type) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1628 Lisp_Object type; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1629 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1630 if (EQ (type, Qnone)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1631 return NONANTIALIASED_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1632 else if (EQ (type, Qstandard)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1633 return ANTIALIASED_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1634 else if (EQ (type, Qsubpixel)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1635 return CLEARTYPE_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1636 else if (EQ (type, Qnatural)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1637 return CLEARTYPE_NATURAL_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1638 else |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1639 return DEFAULT_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1640 } |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1641 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1642 /* 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
|
1643 static Lisp_Object |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1644 font_supported_scripts (FONTSIGNATURE * sig) |
90869 | 1645 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1646 DWORD * subranges = sig->fsUsb; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1647 Lisp_Object supported = Qnil; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1648 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1649 /* 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
|
1650 #define SUBRANGE(n,sym) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1651 if (subranges[(n) / 32] & (1 << ((n) % 32))) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1652 supported = Fcons ((sym), supported) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1653 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1654 /* 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
|
1655 subranges[0 - 3]. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1656 #define MASK_ANY(mask0,mask1,mask2,mask3,sym) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1657 if ((subranges[0] & (mask0)) || (subranges[1] & (mask1)) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1658 || (subranges[2] & (mask2)) || (subranges[3] & (mask3))) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1659 supported = Fcons ((sym), supported) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1660 |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1661 SUBRANGE (0, Qlatin); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1662 /* The following count as latin too, ASCII should be present in these fonts, |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1663 so don't need to mark them separately. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1664 /* 1: Latin-1 supplement, 2: Latin Extended A, 3: Latin Extended B. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1665 SUBRANGE (4, Qphonetic); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1666 /* 5: Spacing and tone modifiers, 6: Combining Diacriticals. */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1667 SUBRANGE (7, Qgreek); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1668 SUBRANGE (8, Qcoptic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1669 SUBRANGE (9, Qcyrillic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1670 SUBRANGE (10, Qarmenian); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1671 SUBRANGE (11, Qhebrew); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1672 SUBRANGE (13, Qarabic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1673 SUBRANGE (14, Qnko); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1674 SUBRANGE (15, Qdevanagari); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1675 SUBRANGE (16, Qbengali); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1676 SUBRANGE (17, Qgurmukhi); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1677 SUBRANGE (18, Qgujarati); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1678 SUBRANGE (19, Qoriya); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1679 SUBRANGE (20, Qtamil); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1680 SUBRANGE (21, Qtelugu); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1681 SUBRANGE (22, Qkannada); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1682 SUBRANGE (23, Qmalayalam); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1683 SUBRANGE (24, Qthai); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1684 SUBRANGE (25, Qlao); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1685 SUBRANGE (26, Qgeorgian); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1686 SUBRANGE (27, Qbalinese); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1687 /* 28: Hangul Jamo. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1688 /* 29: Latin Extended, 30: Greek Extended, 31: Punctuation. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1689 /* 32-47: Symbols (defined below). */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1690 SUBRANGE (48, Qcjk_misc); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1691 /* Match either 49: katakana or 50: hiragana for kana. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1692 MASK_ANY (0, 0x00060000, 0, 0, Qkana); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1693 SUBRANGE (51, Qbopomofo); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1694 /* 52: Compatibility Jamo */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1695 SUBRANGE (53, Qphags_pa); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1696 /* 54: Enclosed CJK letters and months, 55: CJK Compatibility. */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1697 SUBRANGE (56, Qhangul); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1698 /* 57: Surrogates. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1699 SUBRANGE (58, Qphoenician); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1700 SUBRANGE (59, Qhan); /* There are others, but this is the main one. */ |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1701 SUBRANGE (59, Qideographic_description); /* Windows lumps this in. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1702 SUBRANGE (59, Qkanbun); /* And this. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1703 /* 60: Private use, 61: CJK strokes and compatibility. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1704 /* 62: Alphabetic Presentation, 63: Arabic Presentation A. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1705 /* 64: Combining half marks, 65: Vertical and CJK compatibility. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1706 /* 66: Small forms, 67: Arabic Presentation B, 68: Half and Full width. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1707 /* 69: Specials. */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1708 SUBRANGE (70, Qtibetan); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1709 SUBRANGE (71, Qsyriac); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1710 SUBRANGE (72, Qthaana); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1711 SUBRANGE (73, Qsinhala); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1712 SUBRANGE (74, Qmyanmar); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1713 SUBRANGE (75, Qethiopic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1714 SUBRANGE (76, Qcherokee); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1715 SUBRANGE (77, Qcanadian_aboriginal); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1716 SUBRANGE (78, Qogham); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1717 SUBRANGE (79, Qrunic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1718 SUBRANGE (80, Qkhmer); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1719 SUBRANGE (81, Qmongolian); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1720 SUBRANGE (82, Qbraille); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1721 SUBRANGE (83, Qyi); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1722 SUBRANGE (84, Qbuhid); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1723 SUBRANGE (84, Qhanunoo); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1724 SUBRANGE (84, Qtagalog); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1725 SUBRANGE (84, Qtagbanwa); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1726 SUBRANGE (85, Qold_italic); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1727 SUBRANGE (86, Qgothic); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1728 SUBRANGE (87, Qdeseret); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1729 SUBRANGE (88, Qbyzantine_musical_symbol); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1730 SUBRANGE (88, Qmusical_symbol); /* Windows doesn't distinguish these. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1731 SUBRANGE (89, Qmathematical); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1732 /* 90: Private use, 91: Variation selectors, 92: Tags. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1733 SUBRANGE (93, Qlimbu); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1734 SUBRANGE (94, Qtai_le); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1735 /* 95: New Tai Le */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1736 SUBRANGE (90, Qbuginese); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1737 SUBRANGE (97, Qglagolitic); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1738 SUBRANGE (98, Qtifinagh); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1739 /* 99: Yijing Hexagrams. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1740 SUBRANGE (100, Qsyloti_nagri); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1741 SUBRANGE (101, Qlinear_b); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1742 /* 102: Ancient Greek Numbers. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1743 SUBRANGE (103, Qugaritic); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1744 SUBRANGE (104, Qold_persian); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1745 SUBRANGE (105, Qshavian); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1746 SUBRANGE (106, Qosmanya); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1747 SUBRANGE (107, Qcypriot); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1748 SUBRANGE (108, Qkharoshthi); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1749 /* 109: Tai Xuan Jing. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1750 SUBRANGE (110, Qcuneiform); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1751 /* 111: Counting Rods. */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1752 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1753 /* 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
|
1754 relevant range is set. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1755 MASK_ANY (0x8000000, 0x0000FFFF, 0, 0, Qsymbol); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1756 |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1757 /* Missing: Tai Viet (U+AA80) and Cham (U+AA00) . */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1758 #undef SUBRANGE |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1759 #undef MASK_ANY |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1760 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1761 return supported; |
90869 | 1762 } |
1763 | |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1764 /* Generate a full name for a Windows font. |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1765 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
|
1766 specified if they are not "normal". */ |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1767 static int |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1768 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
|
1769 LOGFONT * font; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1770 Lisp_Object font_obj; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1771 int pixel_size; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1772 char *name; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1773 int nbytes; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1774 { |
92394
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1775 int len, height, outline; |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1776 char *p; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1777 Lisp_Object antialiasing, weight = Qnil; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1778 |
92394
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1779 len = strlen (font->lfFaceName); |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1780 |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1781 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
|
1782 |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1783 /* 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
|
1784 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
|
1785 if (outline) |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1786 len += 11; /* -SIZE */ |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1787 else |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1788 len = strlen (font->lfFaceName) + 21; |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1789 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1790 if (font->lfItalic) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1791 len += 7; /* :italic */ |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1792 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1793 if (font->lfWeight && font->lfWeight != FW_NORMAL) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1794 { |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1795 weight = font_symbolic_weight (font_obj); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1796 len += 8 + SBYTES (SYMBOL_NAME (weight)); /* :weight=NAME */ |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1797 } |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1798 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1799 antialiasing = lispy_antialias_type (font->lfQuality); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1800 if (! NILP (antialiasing)) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1801 len += 11 + SBYTES (SYMBOL_NAME (antialiasing)); /* :antialias=NAME */ |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1802 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1803 /* Check that the buffer is big enough */ |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1804 if (len > nbytes) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1805 return -1; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1806 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1807 p = name; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1808 p += sprintf (p, "%s", font->lfFaceName); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1809 |
92394
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1810 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
|
1811 |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1812 if (height > 0) |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1813 { |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1814 if (outline) |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1815 { |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1816 float pointsize = height * 72.0 / one_w32_display_info.resy; |
92712
fb1da73bc0c4
(w32font_full_name): Use floor to round.
Jason Rumney <jasonr@gnu.org>
parents:
92539
diff
changeset
|
1817 /* Round to nearest half point. floor is used, since round is not |
fb1da73bc0c4
(w32font_full_name): Use floor to round.
Jason Rumney <jasonr@gnu.org>
parents:
92539
diff
changeset
|
1818 supported in MS library. */ |
fb1da73bc0c4
(w32font_full_name): Use floor to round.
Jason Rumney <jasonr@gnu.org>
parents:
92539
diff
changeset
|
1819 pointsize = floor (pointsize * 2 + 0.5) / 2; |
92394
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1820 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
|
1821 } |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1822 else |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
1823 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
|
1824 } |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1825 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1826 if (font->lfItalic) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1827 p += sprintf (p, ":italic"); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1828 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1829 if (SYMBOLP (weight) && ! NILP (weight)) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1830 p += sprintf (p, ":weight=%s", SDATA (SYMBOL_NAME (weight))); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1831 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1832 if (SYMBOLP (antialiasing) && ! NILP (antialiasing)) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1833 p += sprintf (p, ":antialias=%s", SDATA (SYMBOL_NAME (antialiasing))); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1834 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1835 return (p - name); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
1836 } |
90869 | 1837 |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1838 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1839 static void compute_metrics (dc, w32_font, code, metrics) |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1840 HDC dc; |
92411
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
1841 struct w32font_info *w32_font; |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1842 unsigned int code; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1843 struct w32_metric_cache *metrics; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1844 { |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1845 GLYPHMETRICS gm; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1846 MAT2 transform; |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1847 unsigned int options = GGO_METRICS; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1848 |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1849 if (w32_font->glyph_idx) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1850 options |= GGO_GLYPH_INDEX; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1851 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1852 bzero (&transform, sizeof (transform)); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1853 transform.eM11.value = 1; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1854 transform.eM22.value = 1; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1855 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1856 if (GetGlyphOutlineW (dc, code, options, &gm, 0, NULL, &transform) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1857 != GDI_ERROR) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1858 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1859 metrics->lbearing = gm.gmptGlyphOrigin.x; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1860 metrics->rbearing = gm.gmptGlyphOrigin.x + gm.gmBlackBoxX; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1861 metrics->width = gm.gmCellIncX; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1862 metrics->status = W32METRIC_SUCCESS; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1863 } |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1864 else |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1865 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1866 if (w32_font->glyph_idx) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1867 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1868 /* Can't use glyph indexes after all. |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1869 Avoid it in future, and clear any metrics that were based on |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1870 glyph indexes. */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1871 w32_font->glyph_idx = 0; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1872 clear_cached_metrics (w32_font); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1873 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1874 metrics->status = W32METRIC_FAIL; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1875 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1876 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1877 |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1878 static void |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1879 clear_cached_metrics (w32_font) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1880 struct w32font_info *w32_font; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1881 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1882 int i; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1883 for (i = 0; i < w32_font->n_cache_blocks; i++) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1884 bzero (w32_font->cached_metrics[i], |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1885 CACHE_BLOCKSIZE * sizeof (struct font_metrics)); |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1886 } |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1887 |
90869 | 1888 struct font_driver w32font_driver = |
1889 { | |
90964 | 1890 0, /* Qgdi */ |
90869 | 1891 w32font_get_cache, |
1892 w32font_list, | |
1893 w32font_match, | |
1894 w32font_list_family, | |
1895 NULL, /* free_entity */ | |
1896 w32font_open, | |
1897 w32font_close, | |
1898 NULL, /* prepare_face */ | |
1899 NULL, /* done_face */ | |
1900 w32font_has_char, | |
1901 w32font_encode_char, | |
1902 w32font_text_extents, | |
1903 w32font_draw, | |
1904 NULL, /* get_bitmap */ | |
1905 NULL, /* free_bitmap */ | |
1906 NULL, /* get_outline */ | |
1907 NULL, /* free_outline */ | |
1908 NULL, /* anchor_point */ | |
1909 NULL, /* otf_capability */ | |
91158
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
1910 NULL, /* otf_drive */ |
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
1911 NULL, /* start_for_frame */ |
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
1912 NULL, /* end_for_frame */ |
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
1913 NULL /* shape */ |
90869 | 1914 }; |
1915 | |
1916 | |
1917 /* Initialize state that does not change between invocations. This is only | |
1918 called when Emacs is dumped. */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1919 void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1920 syms_of_w32font () |
90869 | 1921 { |
90964 | 1922 DEFSYM (Qgdi, "gdi"); |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1923 DEFSYM (Quniscribe, "uniscribe"); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1924 DEFSYM (QCformat, ":format"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1925 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1926 /* Generic font families. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1927 DEFSYM (Qmonospace, "monospace"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1928 DEFSYM (Qserif, "serif"); |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1929 DEFSYM (Qsansserif, "sansserif"); |
90869 | 1930 DEFSYM (Qscript, "script"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1931 DEFSYM (Qdecorative, "decorative"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1932 /* Aliases. */ |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1933 DEFSYM (Qsans_serif, "sans_serif"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1934 DEFSYM (Qsans, "sans"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1935 DEFSYM (Qmono, "mono"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1936 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1937 /* Fake foundries. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1938 DEFSYM (Qraster, "raster"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1939 DEFSYM (Qoutline, "outline"); |
90869 | 1940 DEFSYM (Qunknown, "unknown"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1941 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1942 /* Antialiasing. */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1943 DEFSYM (Qstandard, "standard"); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1944 DEFSYM (Qsubpixel, "subpixel"); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1945 DEFSYM (Qnatural, "natural"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1946 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1947 /* Languages */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1948 DEFSYM (Qja, "ja"); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1949 DEFSYM (Qko, "ko"); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1950 DEFSYM (Qzh, "zh"); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1951 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1952 /* Scripts */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1953 DEFSYM (Qlatin, "latin"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1954 DEFSYM (Qgreek, "greek"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1955 DEFSYM (Qcoptic, "coptic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1956 DEFSYM (Qcyrillic, "cyrillic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1957 DEFSYM (Qarmenian, "armenian"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1958 DEFSYM (Qhebrew, "hebrew"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1959 DEFSYM (Qarabic, "arabic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1960 DEFSYM (Qsyriac, "syriac"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1961 DEFSYM (Qnko, "nko"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1962 DEFSYM (Qthaana, "thaana"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1963 DEFSYM (Qdevanagari, "devanagari"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1964 DEFSYM (Qbengali, "bengali"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1965 DEFSYM (Qgurmukhi, "gurmukhi"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1966 DEFSYM (Qgujarati, "gujarati"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1967 DEFSYM (Qoriya, "oriya"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1968 DEFSYM (Qtamil, "tamil"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1969 DEFSYM (Qtelugu, "telugu"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1970 DEFSYM (Qkannada, "kannada"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1971 DEFSYM (Qmalayalam, "malayalam"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1972 DEFSYM (Qsinhala, "sinhala"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1973 DEFSYM (Qthai, "thai"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1974 DEFSYM (Qlao, "lao"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1975 DEFSYM (Qtibetan, "tibetan"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1976 DEFSYM (Qmyanmar, "myanmar"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1977 DEFSYM (Qgeorgian, "georgian"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1978 DEFSYM (Qhangul, "hangul"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1979 DEFSYM (Qethiopic, "ethiopic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1980 DEFSYM (Qcherokee, "cherokee"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1981 DEFSYM (Qcanadian_aboriginal, "canadian-aboriginal"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1982 DEFSYM (Qogham, "ogham"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1983 DEFSYM (Qrunic, "runic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1984 DEFSYM (Qkhmer, "khmer"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1985 DEFSYM (Qmongolian, "mongolian"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1986 DEFSYM (Qsymbol, "symbol"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1987 DEFSYM (Qbraille, "braille"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1988 DEFSYM (Qhan, "han"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1989 DEFSYM (Qideographic_description, "ideographic-description"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1990 DEFSYM (Qcjk_misc, "cjk-misc"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1991 DEFSYM (Qkana, "kana"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1992 DEFSYM (Qbopomofo, "bopomofo"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1993 DEFSYM (Qkanbun, "kanbun"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1994 DEFSYM (Qyi, "yi"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1995 DEFSYM (Qbyzantine_musical_symbol, "byzantine-musical-symbol"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1996 DEFSYM (Qmusical_symbol, "musical-symbol"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1997 DEFSYM (Qmathematical, "mathematical"); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1998 DEFSYM (Qphonetic, "phonetic"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1999 DEFSYM (Qbalinese, "balinese"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2000 DEFSYM (Qbuginese, "buginese"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2001 DEFSYM (Qbuhid, "buhid"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2002 DEFSYM (Qcuneiform, "cuneiform"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2003 DEFSYM (Qcypriot, "cypriot"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2004 DEFSYM (Qdeseret, "deseret"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2005 DEFSYM (Qglagolitic, "glagolitic"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2006 DEFSYM (Qgothic, "gothic"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2007 DEFSYM (Qhanunoo, "hanunoo"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2008 DEFSYM (Qkharoshthi, "kharoshthi"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2009 DEFSYM (Qlimbu, "limbu"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2010 DEFSYM (Qlinear_b, "linear_b"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2011 DEFSYM (Qold_italic, "old_italic"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2012 DEFSYM (Qold_persian, "old_persian"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2013 DEFSYM (Qosmanya, "osmanya"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2014 DEFSYM (Qphags_pa, "phags-pa"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2015 DEFSYM (Qphoenician, "phoenician"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2016 DEFSYM (Qshavian, "shavian"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2017 DEFSYM (Qsyloti_nagri, "syloti_nagri"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2018 DEFSYM (Qtagalog, "tagalog"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2019 DEFSYM (Qtagbanwa, "tagbanwa"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2020 DEFSYM (Qtai_le, "tai_le"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2021 DEFSYM (Qtifinagh, "tifinagh"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2022 DEFSYM (Qugaritic, "ugaritic"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2023 |
90964 | 2024 w32font_driver.type = Qgdi; |
90869 | 2025 register_font_driver (&w32font_driver, NULL); |
2026 } | |
92472
dba28a9d071a
Wrap in USE_FONT_BACKEND conditional
Jason Rumney <jasonr@gnu.org>
parents:
92413
diff
changeset
|
2027 #endif /* USE_FONT_BACKEND */ |
90898 | 2028 |
2029 /* arch-tag: 65b8a3cd-46aa-4c0d-a1f3-99e75b9c07ee | |
2030 (do not change this comment) */ |