Mercurial > emacs
annotate src/w32font.c @ 103025:fdccf299eae0
* emacsclient.c (print_help_and_exit): Clarify argument placement
for short option names.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Mon, 20 Apr 2009 02:52:56 +0000 |
parents | 387b4a4bbc9b |
children | ab4ac86c9209 |
rev | line source |
---|---|
90869 | 1 /* Font backend for the Microsoft W32 API. |
100951 | 2 Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. |
90869 | 3 |
4 This file is part of GNU Emacs. | |
5 | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94914
diff
changeset
|
6 GNU Emacs is free software: you can redistribute it and/or modify |
90869 | 7 it under the terms of the GNU General Public License as published by |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94914
diff
changeset
|
8 the Free Software Foundation, either version 3 of the License, or |
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94914
diff
changeset
|
9 (at your option) any later version. |
90869 | 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 | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94914
diff
changeset
|
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
90869 | 18 |
19 #include <config.h> | |
20 #include <windows.h> | |
92413 | 21 #include <math.h> |
95846 | 22 #include <ctype.h> |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
23 #include <commdlg.h> |
90869 | 24 |
25 #include "lisp.h" | |
26 #include "w32term.h" | |
27 #include "frame.h" | |
28 #include "dispextern.h" | |
29 #include "character.h" | |
30 #include "charset.h" | |
100409
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
31 #include "coding.h" |
90869 | 32 #include "fontset.h" |
33 #include "font.h" | |
91208 | 34 #include "w32font.h" |
90869 | 35 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
36 /* 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
|
37 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
|
38 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
|
39 */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
40 #ifndef CLEARTYPE_QUALITY |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
41 #define CLEARTYPE_QUALITY 5 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
42 #endif |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
43 #ifndef CLEARTYPE_NATURAL_QUALITY |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
44 #define CLEARTYPE_NATURAL_QUALITY 6 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
45 #endif |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
46 |
96385
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
47 /* VIETNAMESE_CHARSET and JOHAB_CHARSET are not defined in some versions |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
48 of MSVC headers. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
49 #ifndef VIETNAMESE_CHARSET |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
50 #define VIETNAMESE_CHARSET 163 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
51 #endif |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
52 #ifndef JOHAB_CHARSET |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
53 #define JOHAB_CHARSET 130 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
54 #endif |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
55 |
90869 | 56 extern struct font_driver w32font_driver; |
57 | |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
58 Lisp_Object Qgdi; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
59 Lisp_Object Quniscribe; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
60 static Lisp_Object QCformat; |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
61 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
|
62 static Lisp_Object Qserif, Qscript, Qdecorative; |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
63 static Lisp_Object Qraster, Qoutline, Qunknown; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
64 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
65 /* antialiasing */ |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
66 extern Lisp_Object QCantialias, QCotf, QClang; /* defined in font.c */ |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
67 extern Lisp_Object Qnone; /* reuse from w32fns.c */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
68 static Lisp_Object Qstandard, Qsubpixel, Qnatural; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
69 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
70 /* languages */ |
103012
387b4a4bbc9b
* w32font.c (Qja, Qko): Remove declarations.
Juanma Barranquero <lekktu@gmail.com>
parents:
101979
diff
changeset
|
71 static Lisp_Object Qzh; |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
72 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
73 /* scripts */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
74 static Lisp_Object Qlatin, Qgreek, Qcoptic, Qcyrillic, Qarmenian, Qhebrew; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
75 static Lisp_Object Qarabic, Qsyriac, Qnko, Qthaana, Qdevanagari, Qbengali; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
76 static Lisp_Object Qgurmukhi, Qgujarati, Qoriya, Qtamil, Qtelugu; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
77 static Lisp_Object Qkannada, Qmalayalam, Qsinhala, Qthai, Qlao; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
78 static Lisp_Object Qtibetan, Qmyanmar, Qgeorgian, Qhangul, Qethiopic; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
79 static Lisp_Object Qcherokee, Qcanadian_aboriginal, Qogham, Qrunic; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
80 static Lisp_Object Qkhmer, Qmongolian, Qsymbol, Qbraille, Qhan; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
81 static Lisp_Object Qideographic_description, Qcjk_misc, Qkana, Qbopomofo; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
82 static Lisp_Object Qkanbun, Qyi, Qbyzantine_musical_symbol; |
100323 | 83 static Lisp_Object Qmusical_symbol, Qmathematical, Qcham, Qphonetic; |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
84 /* 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
|
85 static Lisp_Object Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot; |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
86 static Lisp_Object Qdeseret, Qglagolitic, Qgothic, Qhanunoo, Qkharoshthi; |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
87 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
|
88 static Lisp_Object Qphags_pa, Qphoenician, Qshavian, Qsyloti_nagri; |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
89 static Lisp_Object Qtagalog, Qtagbanwa, Qtai_le, Qtifinagh, Qugaritic; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
90 |
96385
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
91 /* W32 charsets: for use in Vw32_charset_info_alist. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
92 static Lisp_Object Qw32_charset_ansi, Qw32_charset_default; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
93 static Lisp_Object Qw32_charset_symbol, Qw32_charset_shiftjis; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
94 static Lisp_Object Qw32_charset_hangeul, Qw32_charset_gb2312; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
95 static Lisp_Object Qw32_charset_chinesebig5, Qw32_charset_oem; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
96 static Lisp_Object Qw32_charset_easteurope, Qw32_charset_turkish; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
97 static Lisp_Object Qw32_charset_baltic, Qw32_charset_russian; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
98 static Lisp_Object Qw32_charset_arabic, Qw32_charset_greek; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
99 static Lisp_Object Qw32_charset_hebrew, Qw32_charset_vietnamese; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
100 static Lisp_Object Qw32_charset_thai, Qw32_charset_johab, Qw32_charset_mac; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
101 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
102 /* Associative list linking character set strings to Windows codepages. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
103 static Lisp_Object Vw32_charset_info_alist; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
104 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
105 /* Font spacing symbols - defined in font.c. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
106 extern Lisp_Object Qc, Qp, Qm; |
90869 | 107 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
108 static void fill_in_logfont P_ ((FRAME_PTR, LOGFONT *, Lisp_Object)); |
90869 | 109 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
110 static BYTE w32_antialias_type P_ ((Lisp_Object)); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
111 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
|
112 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
113 static Lisp_Object font_supported_scripts P_ ((FONTSIGNATURE *)); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
114 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
|
115 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
|
116 struct w32_metric_cache *)); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
117 static void clear_cached_metrics P_ ((struct w32font_info *)); |
90869 | 118 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
119 static Lisp_Object w32_registry P_ ((LONG, DWORD)); |
90869 | 120 |
121 /* EnumFontFamiliesEx callbacks. */ | |
122 static int CALLBACK add_font_entity_to_list P_ ((ENUMLOGFONTEX *, | |
123 NEWTEXTMETRICEX *, | |
124 DWORD, LPARAM)); | |
125 static int CALLBACK add_one_font_entity_to_list P_ ((ENUMLOGFONTEX *, | |
126 NEWTEXTMETRICEX *, | |
127 DWORD, LPARAM)); | |
128 static int CALLBACK add_font_name_to_list P_ ((ENUMLOGFONTEX *, | |
129 NEWTEXTMETRICEX *, | |
130 DWORD, LPARAM)); | |
131 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
132 /* 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
|
133 of what we really want. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
134 struct font_callback_data |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
135 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
136 /* The logfont we are matching against. EnumFontFamiliesEx only matches |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
137 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
|
138 in the callback function. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
139 LOGFONT pattern; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
140 /* The original font spec or entity. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
141 Lisp_Object orig_font_spec; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
142 /* The frame the font is being loaded on. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
143 Lisp_Object frame; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
144 /* The list to add matches to. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
145 Lisp_Object list; |
91208 | 146 /* Whether to match only opentype fonts. */ |
147 int opentype_only; | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
148 }; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
149 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
150 /* Handles the problem that EnumFontFamiliesEx will not return all |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
151 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
|
152 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
|
153 |
90869 | 154 |
155 static int | |
156 memq_no_quit (elt, list) | |
157 Lisp_Object elt, list; | |
158 { | |
159 while (CONSP (list) && ! EQ (XCAR (list), elt)) | |
160 list = XCDR (list); | |
161 return (CONSP (list)); | |
162 } | |
163 | |
100409
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
164 Lisp_Object |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
165 intern_font_name (string) |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
166 char * string; |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
167 { |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
168 Lisp_Object obarray, tem, str; |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
169 int len; |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
170 |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
171 str = DECODE_SYSTEM (build_string (string)); |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
172 len = SCHARS (str); |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
173 |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
174 /* The following code is copied from the function intern (in lread.c). */ |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
175 obarray = Vobarray; |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
176 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
177 obarray = check_obarray (obarray); |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
178 tem = oblookup (obarray, SDATA (str), len, len); |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
179 if (SYMBOLP (tem)) |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
180 return tem; |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
181 return Fintern (str, obarray); |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
182 } |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
183 |
90869 | 184 /* w32 implementation of get_cache for font backend. |
185 Return a cache of font-entities on FRAME. The cache must be a | |
186 cons whose cdr part is the actual cache area. */ | |
91208 | 187 Lisp_Object |
91246
3a1805edf0b5
(w32font_get_cache): Adjust the argument type.
Kenichi Handa <handa@m17n.org>
parents:
91211
diff
changeset
|
188 w32font_get_cache (f) |
3a1805edf0b5
(w32font_get_cache): Adjust the argument type.
Kenichi Handa <handa@m17n.org>
parents:
91211
diff
changeset
|
189 FRAME_PTR f; |
90869 | 190 { |
91246
3a1805edf0b5
(w32font_get_cache): Adjust the argument type.
Kenichi Handa <handa@m17n.org>
parents:
91211
diff
changeset
|
191 struct w32_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
90869 | 192 |
193 return (dpyinfo->name_list_element); | |
194 } | |
195 | |
196 /* w32 implementation of list for font backend. | |
197 List fonts exactly matching with FONT_SPEC on FRAME. The value | |
198 is a vector of font-entities. This is the sole API that | |
199 allocates font-entities. */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
200 static Lisp_Object |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
201 w32font_list (frame, font_spec) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
202 Lisp_Object frame, font_spec; |
90869 | 203 { |
96071
0f831953ffb8
Add font logging to list and match functions.
Jason Rumney <jasonr@gnu.org>
parents:
96005
diff
changeset
|
204 Lisp_Object fonts = w32font_list_internal (frame, font_spec, 0); |
0f831953ffb8
Add font logging to list and match functions.
Jason Rumney <jasonr@gnu.org>
parents:
96005
diff
changeset
|
205 font_add_log ("w32font-list", font_spec, fonts); |
0f831953ffb8
Add font logging to list and match functions.
Jason Rumney <jasonr@gnu.org>
parents:
96005
diff
changeset
|
206 return fonts; |
90869 | 207 } |
208 | |
209 /* w32 implementation of match for font backend. | |
210 Return a font entity most closely matching with FONT_SPEC on | |
211 FRAME. The closeness is detemined by the font backend, thus | |
212 `face-font-selection-order' is ignored here. */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
213 static Lisp_Object |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
214 w32font_match (frame, font_spec) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
215 Lisp_Object frame, font_spec; |
90869 | 216 { |
96071
0f831953ffb8
Add font logging to list and match functions.
Jason Rumney <jasonr@gnu.org>
parents:
96005
diff
changeset
|
217 Lisp_Object entity = w32font_match_internal (frame, font_spec, 0); |
0f831953ffb8
Add font logging to list and match functions.
Jason Rumney <jasonr@gnu.org>
parents:
96005
diff
changeset
|
218 font_add_log ("w32font-match", font_spec, entity); |
0f831953ffb8
Add font logging to list and match functions.
Jason Rumney <jasonr@gnu.org>
parents:
96005
diff
changeset
|
219 return entity; |
90869 | 220 } |
221 | |
222 /* w32 implementation of list_family for font backend. | |
223 List available families. The value is a list of family names | |
224 (symbols). */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
225 static Lisp_Object |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
226 w32font_list_family (frame) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
227 Lisp_Object frame; |
90869 | 228 { |
229 Lisp_Object list = Qnil; | |
230 LOGFONT font_match_pattern; | |
231 HDC dc; | |
232 FRAME_PTR f = XFRAME (frame); | |
233 | |
234 bzero (&font_match_pattern, sizeof (font_match_pattern)); | |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
235 font_match_pattern.lfCharSet = DEFAULT_CHARSET; |
90869 | 236 |
237 dc = get_frame_dc (f); | |
238 | |
239 EnumFontFamiliesEx (dc, &font_match_pattern, | |
240 (FONTENUMPROC) add_font_name_to_list, | |
241 (LPARAM) &list, 0); | |
242 release_frame_dc (f, dc); | |
243 | |
244 return list; | |
245 } | |
246 | |
247 /* w32 implementation of open for font backend. | |
248 Open a font specified by FONT_ENTITY on frame F. | |
249 If the font is scalable, open it with PIXEL_SIZE. */ | |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
250 static Lisp_Object |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
251 w32font_open (f, font_entity, pixel_size) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
252 FRAME_PTR f; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
253 Lisp_Object font_entity; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
254 int pixel_size; |
90869 | 255 { |
97135
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
256 Lisp_Object font_object |
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
257 = font_make_object (VECSIZE (struct w32font_info), |
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
258 font_entity, pixel_size); |
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
259 struct w32font_info *w32_font |
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
260 = (struct w32font_info *) XFONT_OBJECT (font_object); |
90869 | 261 |
96937
7f7286fdbf06
* w32font.c (w32font_open): Set font type to gdi.
Jason Rumney <jasonr@gnu.org>
parents:
96934
diff
changeset
|
262 ASET (font_object, FONT_TYPE_INDEX, Qgdi); |
90869 | 263 |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
264 if (!w32font_open_internal (f, font_entity, pixel_size, font_object)) |
90869 | 265 { |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
266 return Qnil; |
90869 | 267 } |
268 | |
97135
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
269 /* GDI backend does not use glyph indices. */ |
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
270 w32_font->glyph_idx = 0; |
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
271 |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
272 return font_object; |
90869 | 273 } |
274 | |
275 /* w32 implementation of close for font_backend. | |
276 Close FONT on frame F. */ | |
91208 | 277 void |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
278 w32font_close (f, font) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
279 FRAME_PTR f; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
280 struct font *font; |
90869 | 281 { |
96343
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
282 int i; |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
283 struct w32font_info *w32_font = (struct w32font_info *) font; |
96343
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
284 |
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
285 /* Delete the GDI font object. */ |
96327
2fc5aff56d81
* w32bdf.c, w32bdf.h: Remove obsolete files.
Jason Rumney <jasonr@gnu.org>
parents:
96111
diff
changeset
|
286 DeleteObject (w32_font->hfont); |
96343
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
287 |
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
288 /* Free all the cached metrics. */ |
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
289 if (w32_font->cached_metrics) |
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
290 { |
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
291 for (i = 0; i < w32_font->n_cache_blocks; i++) |
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
292 { |
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
293 if (w32_font->cached_metrics[i]) |
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
294 xfree (w32_font->cached_metrics[i]); |
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
295 } |
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
296 xfree (w32_font->cached_metrics); |
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
297 w32_font->cached_metrics = NULL; |
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
298 } |
90869 | 299 } |
300 | |
301 /* w32 implementation of has_char for font backend. | |
302 Optional. | |
303 If FONT_ENTITY has a glyph for character C (Unicode code point), | |
304 return 1. If not, return 0. If a font must be opened to check | |
305 it, return -1. */ | |
91208 | 306 int |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
307 w32font_has_char (entity, c) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
308 Lisp_Object entity; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
309 int c; |
90869 | 310 { |
100465
471df3e0268b
(w32font_has_char): Always return -1.
Jason Rumney <jasonr@gnu.org>
parents:
100409
diff
changeset
|
311 /* We can't be certain about which characters a font will support until |
471df3e0268b
(w32font_has_char): Always return -1.
Jason Rumney <jasonr@gnu.org>
parents:
100409
diff
changeset
|
312 we open it. Checking the scripts that the font supports turns out |
471df3e0268b
(w32font_has_char): Always return -1.
Jason Rumney <jasonr@gnu.org>
parents:
100409
diff
changeset
|
313 to not be reliable. */ |
471df3e0268b
(w32font_has_char): Always return -1.
Jason Rumney <jasonr@gnu.org>
parents:
100409
diff
changeset
|
314 return -1; |
471df3e0268b
(w32font_has_char): Always return -1.
Jason Rumney <jasonr@gnu.org>
parents:
100409
diff
changeset
|
315 |
471df3e0268b
(w32font_has_char): Always return -1.
Jason Rumney <jasonr@gnu.org>
parents:
100409
diff
changeset
|
316 #if 0 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
317 Lisp_Object supported_scripts, extra, script; |
90869 | 318 DWORD mask; |
319 | |
90887
aa7f1d212e78
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90879
diff
changeset
|
320 extra = AREF (entity, FONT_EXTRA_INDEX); |
aa7f1d212e78
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90879
diff
changeset
|
321 if (!CONSP (extra)) |
aa7f1d212e78
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90879
diff
changeset
|
322 return -1; |
aa7f1d212e78
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90879
diff
changeset
|
323 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
324 supported_scripts = assq_no_quit (QCscript, extra); |
97024
c46e4c1d8339
(w32font_has_char): Handle the case where we can't
Jason Rumney <jasonr@gnu.org>
parents:
97004
diff
changeset
|
325 /* If font doesn't claim to support any scripts, then we can't be certain |
c46e4c1d8339
(w32font_has_char): Handle the case where we can't
Jason Rumney <jasonr@gnu.org>
parents:
97004
diff
changeset
|
326 until we open it. */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
327 if (!CONSP (supported_scripts)) |
90869 | 328 return -1; |
329 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
330 supported_scripts = XCDR (supported_scripts); |
90869 | 331 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
332 script = CHAR_TABLE_REF (Vchar_script_table, c); |
90869 | 333 |
97024
c46e4c1d8339
(w32font_has_char): Handle the case where we can't
Jason Rumney <jasonr@gnu.org>
parents:
97004
diff
changeset
|
334 /* If we don't know what script the character is from, then we can't be |
c46e4c1d8339
(w32font_has_char): Handle the case where we can't
Jason Rumney <jasonr@gnu.org>
parents:
97004
diff
changeset
|
335 certain until we open it. Also if the font claims support for the script |
c46e4c1d8339
(w32font_has_char): Handle the case where we can't
Jason Rumney <jasonr@gnu.org>
parents:
97004
diff
changeset
|
336 the character is from, it may only have partial coverage, so we still |
c46e4c1d8339
(w32font_has_char): Handle the case where we can't
Jason Rumney <jasonr@gnu.org>
parents:
97004
diff
changeset
|
337 can't be certain until we open the font. */ |
c46e4c1d8339
(w32font_has_char): Handle the case where we can't
Jason Rumney <jasonr@gnu.org>
parents:
97004
diff
changeset
|
338 if (NILP (script) || memq_no_quit (script, supported_scripts)) |
c46e4c1d8339
(w32font_has_char): Handle the case where we can't
Jason Rumney <jasonr@gnu.org>
parents:
97004
diff
changeset
|
339 return -1; |
c46e4c1d8339
(w32font_has_char): Handle the case where we can't
Jason Rumney <jasonr@gnu.org>
parents:
97004
diff
changeset
|
340 |
c46e4c1d8339
(w32font_has_char): Handle the case where we can't
Jason Rumney <jasonr@gnu.org>
parents:
97004
diff
changeset
|
341 /* Font reports what scripts it supports, and none of them are the script |
100465
471df3e0268b
(w32font_has_char): Always return -1.
Jason Rumney <jasonr@gnu.org>
parents:
100409
diff
changeset
|
342 the character is from. But we still can't be certain, as some fonts |
471df3e0268b
(w32font_has_char): Always return -1.
Jason Rumney <jasonr@gnu.org>
parents:
100409
diff
changeset
|
343 will contain some/most/all of the characters in that script without |
471df3e0268b
(w32font_has_char): Always return -1.
Jason Rumney <jasonr@gnu.org>
parents:
100409
diff
changeset
|
344 claiming support for it. */ |
471df3e0268b
(w32font_has_char): Always return -1.
Jason Rumney <jasonr@gnu.org>
parents:
100409
diff
changeset
|
345 return -1; |
471df3e0268b
(w32font_has_char): Always return -1.
Jason Rumney <jasonr@gnu.org>
parents:
100409
diff
changeset
|
346 #endif |
90869 | 347 } |
348 | |
349 /* w32 implementation of encode_char for font backend. | |
350 Return a glyph code of FONT for characer C (Unicode code point). | |
97135
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
351 If FONT doesn't have such a glyph, return FONT_INVALID_CODE. |
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
352 |
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
353 For speed, the gdi backend uses unicode (Emacs calls encode_char |
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
354 far too often for it to be efficient). But we still need to detect |
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
355 which characters are not supported by the font. |
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
356 */ |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
357 static unsigned |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
358 w32font_encode_char (font, c) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
359 struct font *font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
360 int c; |
90869 | 361 { |
97135
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
362 struct w32font_info * w32_font = (struct w32font_info *)font; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
363 |
97135
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
364 if (c < w32_font->metrics.tmFirstChar |
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
365 || c > w32_font->metrics.tmLastChar) |
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
366 return FONT_INVALID_CODE; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
367 else |
97135
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
368 return c; |
90869 | 369 } |
370 | |
371 /* w32 implementation of text_extents for font backend. | |
372 Perform the size computation of glyphs of FONT and fillin members | |
373 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
|
374 CODE (length NGLYPHS). Apparently metrics can be NULL, in this |
90869 | 375 case just return the overall width. */ |
91208 | 376 int |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
377 w32font_text_extents (font, code, nglyphs, metrics) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
378 struct font *font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
379 unsigned *code; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
380 int nglyphs; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
381 struct font_metrics *metrics; |
90869 | 382 { |
383 int i; | |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
384 HFONT old_font = NULL; |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
385 HDC dc = NULL; |
91208 | 386 struct frame * f; |
90869 | 387 int total_width = 0; |
97004
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
388 WORD *wcode; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
389 SIZE size; |
90869 | 390 |
96327
2fc5aff56d81
* w32bdf.c, w32bdf.h: Remove obsolete files.
Jason Rumney <jasonr@gnu.org>
parents:
96111
diff
changeset
|
391 struct w32font_info *w32_font = (struct w32font_info *) font; |
2fc5aff56d81
* w32bdf.c, w32bdf.h: Remove obsolete files.
Jason Rumney <jasonr@gnu.org>
parents:
96111
diff
changeset
|
392 |
90869 | 393 if (metrics) |
394 { | |
95307
7d02dd821410
(w32font_text_extents): Zero whole metrics struct first.
Jason Rumney <jasonr@gnu.org>
parents:
95190
diff
changeset
|
395 bzero (metrics, sizeof (struct font_metrics)); |
93675
7fb9a5b86fa8
(w32font_text_extents): Use font's ascent and descent.
Jason Rumney <jasonr@gnu.org>
parents:
93598
diff
changeset
|
396 metrics->ascent = font->ascent; |
7fb9a5b86fa8
(w32font_text_extents): Use font's ascent and descent.
Jason Rumney <jasonr@gnu.org>
parents:
93598
diff
changeset
|
397 metrics->descent = font->descent; |
90869 | 398 |
399 for (i = 0; i < nglyphs; i++) | |
400 { | |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
401 struct w32_metric_cache *char_metric; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
402 int block = *(code + i) / CACHE_BLOCKSIZE; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
403 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
|
404 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
405 if (block >= w32_font->n_cache_blocks) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
406 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
407 if (!w32_font->cached_metrics) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
408 w32_font->cached_metrics |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
409 = xmalloc ((block + 1) |
97070
32466fc89674
(w32font_text_extents): Use w32_metric_cache consistently.
Jason Rumney <jasonr@gnu.org>
parents:
97024
diff
changeset
|
410 * sizeof (struct w32_metric_cache *)); |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
411 else |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
412 w32_font->cached_metrics |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
413 = xrealloc (w32_font->cached_metrics, |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
414 (block + 1) |
97070
32466fc89674
(w32font_text_extents): Use w32_metric_cache consistently.
Jason Rumney <jasonr@gnu.org>
parents:
97024
diff
changeset
|
415 * sizeof (struct w32_metric_cache *)); |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
416 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
|
417 ((block + 1 - w32_font->n_cache_blocks) |
97070
32466fc89674
(w32font_text_extents): Use w32_metric_cache consistently.
Jason Rumney <jasonr@gnu.org>
parents:
97024
diff
changeset
|
418 * sizeof (struct w32_metric_cache *))); |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
419 w32_font->n_cache_blocks = block + 1; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
420 } |
91593
3081b8f848bc
* w32font.c (w32font_text_extents): Fill in lbearing metric.
Jason Rumney <jasonr@gnu.org>
parents:
91545
diff
changeset
|
421 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
422 if (!w32_font->cached_metrics[block]) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
423 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
424 w32_font->cached_metrics[block] |
97070
32466fc89674
(w32font_text_extents): Use w32_metric_cache consistently.
Jason Rumney <jasonr@gnu.org>
parents:
97024
diff
changeset
|
425 = xmalloc (CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache)); |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
426 bzero (w32_font->cached_metrics[block], |
97070
32466fc89674
(w32font_text_extents): Use w32_metric_cache consistently.
Jason Rumney <jasonr@gnu.org>
parents:
97024
diff
changeset
|
427 CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache)); |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
428 } |
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 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
|
431 |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
432 if (char_metric->status == W32METRIC_NO_ATTEMPT) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
433 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
434 if (dc == NULL) |
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 /* TODO: Frames can come and go, and their fonts |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
437 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
|
438 font structure. Use selected_frame until the API |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
439 is updated to pass in a frame. */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
440 f = XFRAME (selected_frame); |
95341
5602389abb69
(compute_metrics): Rewrite an "else { if () ... else ... }"
Juanma Barranquero <lekktu@gmail.com>
parents:
95339
diff
changeset
|
441 |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
442 dc = get_frame_dc (f); |
96327
2fc5aff56d81
* w32bdf.c, w32bdf.h: Remove obsolete files.
Jason Rumney <jasonr@gnu.org>
parents:
96111
diff
changeset
|
443 old_font = SelectObject (dc, w32_font->hfont); |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
444 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
445 compute_metrics (dc, w32_font, *(code + i), char_metric); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
446 } |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
447 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
448 if (char_metric->status == W32METRIC_SUCCESS) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
449 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
450 metrics->lbearing = min (metrics->lbearing, |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
451 metrics->width + char_metric->lbearing); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
452 metrics->rbearing = max (metrics->rbearing, |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
453 metrics->width + char_metric->rbearing); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
454 metrics->width += char_metric->width; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
455 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
456 else |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
457 /* If we couldn't get metrics for a char, |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
458 use alternative method. */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
459 break; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
460 } |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
461 /* 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
|
462 if (i == nglyphs) |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
463 { |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
464 if (dc != NULL) |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
465 { |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
466 /* Restore state and release DC. */ |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
467 SelectObject (dc, old_font); |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
468 release_frame_dc (f, dc); |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
469 } |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
470 |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
471 return metrics->width; |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
472 } |
90869 | 473 } |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
474 |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
475 /* For non-truetype fonts, GetGlyphOutlineW is not supported, so |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
476 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
|
477 information. */ |
99989
fed2622a8def
* w32font.c (add_font_entity_to_list): Pass the right LOGFONT
Juanma Barranquero <lekktu@gmail.com>
parents:
99960
diff
changeset
|
478 |
97004
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
479 /* Make array big enough to hold surrogates. */ |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
480 wcode = alloca (nglyphs * sizeof (WORD) * 2); |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
481 for (i = 0; i < nglyphs; i++) |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
482 { |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
483 if (code[i] < 0x10000) |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
484 wcode[i] = code[i]; |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
485 else |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
486 { |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
487 DWORD surrogate = code[i] - 0x10000; |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
488 |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
489 /* High surrogate: U+D800 - U+DBFF. */ |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
490 wcode[i++] = 0xD800 + ((surrogate >> 10) & 0x03FF); |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
491 /* Low surrogate: U+DC00 - U+DFFF. */ |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
492 wcode[i] = 0xDC00 + (surrogate & 0x03FF); |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
493 /* An extra glyph. wcode is already double the size of code to |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
494 cope with this. */ |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
495 nglyphs++; |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
496 } |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
497 } |
1b8d15c8653f
* w32font.c (w32font_encode_char): Encode characters outside BMP as
Jason Rumney <jasonr@gnu.org>
parents:
96997
diff
changeset
|
498 |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
499 if (dc == NULL) |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
500 { |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
501 /* 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
|
502 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
|
503 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
|
504 frame. */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
505 f = XFRAME (selected_frame); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
506 |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
507 dc = get_frame_dc (f); |
96327
2fc5aff56d81
* w32bdf.c, w32bdf.h: Remove obsolete files.
Jason Rumney <jasonr@gnu.org>
parents:
96111
diff
changeset
|
508 old_font = SelectObject (dc, w32_font->hfont); |
92151
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
509 } |
664a09af03dc
(w32font_text_extents): Avoid getting HDC and selecting
Jason Rumney <jasonr@gnu.org>
parents:
91593
diff
changeset
|
510 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
511 if (GetTextExtentPoint32W (dc, wcode, nglyphs, &size)) |
90869 | 512 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
513 total_width = size.cx; |
90869 | 514 } |
515 | |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
516 /* 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
|
517 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
|
518 if (!total_width) |
90869 | 519 { |
520 RECT rect; | |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
521 rect.top = 0; rect.bottom = font->height; rect.left = 0; rect.right = 1; |
90869 | 522 DrawTextW (dc, wcode, nglyphs, &rect, |
523 DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE); | |
524 total_width = rect.right; | |
525 } | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
526 |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
527 /* 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
|
528 if (metrics) |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
529 { |
96472
04655c344174
(w32font_text_extents): Don't count overhang as part of width.
Jason Rumney <jasonr@gnu.org>
parents:
96385
diff
changeset
|
530 metrics->width = total_width - w32_font->metrics.tmOverhang; |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
531 metrics->lbearing = 0; |
96472
04655c344174
(w32font_text_extents): Don't count overhang as part of width.
Jason Rumney <jasonr@gnu.org>
parents:
96385
diff
changeset
|
532 metrics->rbearing = total_width; |
91034
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
533 } |
fe9053c62d68
(w32font_text_extents): Calculate metrics for the whole string.
Jason Rumney <jasonr@gnu.org>
parents:
91030
diff
changeset
|
534 |
90869 | 535 /* Restore state and release DC. */ |
536 SelectObject (dc, old_font); | |
91208 | 537 release_frame_dc (f, dc); |
90869 | 538 |
539 return total_width; | |
540 } | |
541 | |
542 /* w32 implementation of draw for font backend. | |
543 Optional. | |
544 Draw glyphs between FROM and TO of S->char2b at (X Y) pixel | |
545 position of frame F with S->FACE and S->GC. If WITH_BACKGROUND | |
546 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
|
547 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
|
548 |
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
549 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
|
550 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
|
551 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
|
552 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
|
553 */ |
bbdb7226d848
(add_font_entity_to_list): Compare only the beginning of full name.
Jason Rumney <jasonr@gnu.org>
parents:
91158
diff
changeset
|
554 |
91208 | 555 int |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
556 w32font_draw (s, from, to, x, y, with_background) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
557 struct glyph_string *s; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
558 int from, to, x, y, with_background; |
90869 | 559 { |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
560 UINT options; |
100211
555a00476e3a
(w32font_draw): Initialize orig_clip before getting it, and delete it
Jason Rumney <jasonr@gnu.org>
parents:
99989
diff
changeset
|
561 HRGN orig_clip = NULL; |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
562 struct w32font_info *w32font = (struct w32font_info *) s->font; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
563 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
564 options = w32font->glyph_idx; |
91030
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
565 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
566 if (s->num_clips > 0) |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
567 { |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
568 HRGN new_clip = CreateRectRgnIndirect (s->clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
569 |
100211
555a00476e3a
(w32font_draw): Initialize orig_clip before getting it, and delete it
Jason Rumney <jasonr@gnu.org>
parents:
99989
diff
changeset
|
570 /* Save clip region for later restoration. */ |
555a00476e3a
(w32font_draw): Initialize orig_clip before getting it, and delete it
Jason Rumney <jasonr@gnu.org>
parents:
99989
diff
changeset
|
571 orig_clip = CreateRectRgn (0, 0, 0, 0); |
555a00476e3a
(w32font_draw): Initialize orig_clip before getting it, and delete it
Jason Rumney <jasonr@gnu.org>
parents:
99989
diff
changeset
|
572 if (!GetClipRgn(s->hdc, orig_clip)) |
555a00476e3a
(w32font_draw): Initialize orig_clip before getting it, and delete it
Jason Rumney <jasonr@gnu.org>
parents:
99989
diff
changeset
|
573 { |
555a00476e3a
(w32font_draw): Initialize orig_clip before getting it, and delete it
Jason Rumney <jasonr@gnu.org>
parents:
99989
diff
changeset
|
574 DeleteObject (orig_clip); |
555a00476e3a
(w32font_draw): Initialize orig_clip before getting it, and delete it
Jason Rumney <jasonr@gnu.org>
parents:
99989
diff
changeset
|
575 orig_clip = NULL; |
555a00476e3a
(w32font_draw): Initialize orig_clip before getting it, and delete it
Jason Rumney <jasonr@gnu.org>
parents:
99989
diff
changeset
|
576 } |
555a00476e3a
(w32font_draw): Initialize orig_clip before getting it, and delete it
Jason Rumney <jasonr@gnu.org>
parents:
99989
diff
changeset
|
577 |
91030
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
578 if (s->num_clips > 1) |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
579 { |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
580 HRGN clip2 = CreateRectRgnIndirect (s->clip + 1); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
581 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
582 CombineRgn (new_clip, new_clip, clip2, RGN_OR); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
583 DeleteObject (clip2); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
584 } |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
585 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
586 SelectClipRgn (s->hdc, new_clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
587 DeleteObject (new_clip); |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
588 } |
90869 | 589 |
91128
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
590 /* 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
|
591 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
|
592 SetBkMode (s->hdc, TRANSPARENT); |
90869 | 593 if (with_background) |
594 { | |
90908
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
595 HBRUSH brush; |
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
596 RECT rect; |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
597 struct font *font = s->font; |
90908
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
598 |
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
599 brush = CreateSolidBrush (s->gc->background); |
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
600 rect.left = x; |
91128
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
601 rect.top = y - font->ascent; |
90908
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
602 rect.right = x + s->width; |
91128
8eb56b57e4a0
(w32font_draw): Fill background manually.
Jason Rumney <jasonr@gnu.org>
parents:
91124
diff
changeset
|
603 rect.bottom = y + font->descent; |
90908
523a5c7f67ea
(w32font_open): Don't set font_idx.
Jason Rumney <jasonr@gnu.org>
parents:
90906
diff
changeset
|
604 FillRect (s->hdc, &rect, brush); |
90915
9aac5aff0dda
(w32font_draw): Delete brush after using it.
Jason Rumney <jasonr@gnu.org>
parents:
90908
diff
changeset
|
605 DeleteObject (brush); |
90869 | 606 } |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
607 |
92187
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
608 if (s->padding_p) |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
609 { |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
610 int len = to - from, i; |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
611 |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
612 for (i = 0; i < len; i++) |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
613 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
|
614 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
|
615 } |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
616 else |
b7277e09e943
(w32font_draw): Pay attention to s->padding_p.
Kenichi Handa <handa@m17n.org>
parents:
92151
diff
changeset
|
617 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
|
618 |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
619 /* Restore clip region. */ |
8be09e8e2c97
(w32font_draw): Do clipping here.
Jason Rumney <jasonr@gnu.org>
parents:
90964
diff
changeset
|
620 if (s->num_clips > 0) |
100211
555a00476e3a
(w32font_draw): Initialize orig_clip before getting it, and delete it
Jason Rumney <jasonr@gnu.org>
parents:
99989
diff
changeset
|
621 SelectClipRgn (s->hdc, orig_clip); |
555a00476e3a
(w32font_draw): Initialize orig_clip before getting it, and delete it
Jason Rumney <jasonr@gnu.org>
parents:
99989
diff
changeset
|
622 |
555a00476e3a
(w32font_draw): Initialize orig_clip before getting it, and delete it
Jason Rumney <jasonr@gnu.org>
parents:
99989
diff
changeset
|
623 if (orig_clip) |
555a00476e3a
(w32font_draw): Initialize orig_clip before getting it, and delete it
Jason Rumney <jasonr@gnu.org>
parents:
99989
diff
changeset
|
624 DeleteObject (orig_clip); |
90869 | 625 } |
626 | |
627 /* w32 implementation of free_entity for font backend. | |
628 Optional (if FONT_EXTRA_INDEX is not Lisp_Save_Value). | |
629 Free FONT_EXTRA_INDEX field of FONT_ENTITY. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
630 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
631 w32font_free_entity (Lisp_Object entity); |
90869 | 632 */ |
633 | |
634 /* w32 implementation of prepare_face for font backend. | |
635 Optional (if FACE->extra is not used). | |
636 Prepare FACE for displaying characters by FONT on frame F by | |
637 storing some data in FACE->extra. If successful, return 0. | |
638 Otherwise, return -1. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
639 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
640 w32font_prepare_face (FRAME_PTR f, struct face *face); |
90869 | 641 */ |
642 /* w32 implementation of done_face for font backend. | |
643 Optional. | |
644 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
|
645 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
646 w32font_done_face (FRAME_PTR f, struct face *face); */ |
90869 | 647 |
648 /* w32 implementation of get_bitmap for font backend. | |
649 Optional. | |
650 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
|
651 intended that this method is called from the other font-driver |
90869 | 652 for actual drawing. |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
653 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
654 w32font_get_bitmap (struct font *font, unsigned code, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
655 struct font_bitmap *bitmap, int bits_per_pixel); |
90869 | 656 */ |
657 /* w32 implementation of free_bitmap for font backend. | |
658 Optional. | |
659 Free bitmap data in BITMAP. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
660 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
661 w32font_free_bitmap (struct font *font, struct font_bitmap *bitmap); |
90869 | 662 */ |
663 /* w32 implementation of get_outline for font backend. | |
664 Optional. | |
665 Return an outline data for glyph-code CODE of FONT. The format | |
666 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
|
667 static void * |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
668 w32font_get_outline (struct font *font, unsigned code); |
90869 | 669 */ |
670 /* w32 implementation of free_outline for font backend. | |
671 Optional. | |
672 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
|
673 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
674 w32font_free_outline (struct font *font, void *outline); |
90869 | 675 */ |
676 /* w32 implementation of anchor_point for font backend. | |
677 Optional. | |
678 Get coordinates of the INDEXth anchor point of the glyph whose | |
679 code is CODE. Store the coordinates in *X and *Y. Return 0 if | |
680 the operations was successfull. Otherwise return -1. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
681 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
682 w32font_anchor_point (struct font *font, unsigned code, |
90869 | 683 int index, int *x, int *y); |
684 */ | |
685 /* w32 implementation of otf_capability for font backend. | |
686 Optional. | |
687 Return a list describing which scripts/languages FONT | |
688 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
|
689 static Lisp_Object |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
690 w32font_otf_capability (struct font *font); |
90869 | 691 */ |
692 /* w32 implementation of otf_drive for font backend. | |
693 Optional. | |
694 Apply FONT's OTF-FEATURES to the glyph string. | |
695 | |
696 FEATURES specifies which OTF features to apply in this format: | |
697 (SCRIPT LANGSYS GSUB-FEATURE GPOS-FEATURE) | |
698 See the documentation of `font-drive-otf' for the detail. | |
699 | |
700 This method applies the specified features to the codes in the | |
701 elements of GSTRING-IN (between FROMth and TOth). The output | |
702 codes are stored in GSTRING-OUT at the IDXth element and the | |
703 following elements. | |
704 | |
705 Return the number of output codes. If none of the features are | |
706 applicable to the input data, return 0. If GSTRING-OUT is too | |
707 short, return -1. | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
708 static int |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
709 w32font_otf_drive (struct font *font, Lisp_Object features, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
710 Lisp_Object gstring_in, int from, int to, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
711 Lisp_Object gstring_out, int idx, |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
712 int alternate_subst); |
90869 | 713 */ |
714 | |
91208 | 715 /* Internal implementation of w32font_list. |
716 Additional parameter opentype_only restricts the returned fonts to | |
717 opentype fonts, which can be used with the Uniscribe backend. */ | |
718 Lisp_Object | |
719 w32font_list_internal (frame, font_spec, opentype_only) | |
720 Lisp_Object frame, font_spec; | |
721 int opentype_only; | |
722 { | |
723 struct font_callback_data match_data; | |
724 HDC dc; | |
725 FRAME_PTR f = XFRAME (frame); | |
726 | |
727 match_data.orig_font_spec = font_spec; | |
728 match_data.list = Qnil; | |
729 match_data.frame = frame; | |
730 | |
731 bzero (&match_data.pattern, sizeof (LOGFONT)); | |
732 fill_in_logfont (f, &match_data.pattern, font_spec); | |
733 | |
101518
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
734 /* If the charset is unrecognized, then we won't find a font, so don't |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
735 waste time looking for one. */ |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
736 if (match_data.pattern.lfCharSet == DEFAULT_CHARSET) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
737 { |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
738 Lisp_Object spec_charset = AREF (font_spec, FONT_REGISTRY_INDEX); |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
739 if (!NILP (spec_charset) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
740 && !EQ (spec_charset, Qiso10646_1) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
741 && !EQ (spec_charset, Qunicode_bmp) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
742 && !EQ (spec_charset, Qunicode_sip) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
743 && !EQ (spec_charset, Qunknown)) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
744 return Qnil; |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
745 } |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
746 |
91208 | 747 match_data.opentype_only = opentype_only; |
748 if (opentype_only) | |
749 match_data.pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; | |
750 | |
751 if (match_data.pattern.lfFaceName[0] == '\0') | |
752 { | |
753 /* EnumFontFamiliesEx does not take other fields into account if | |
754 font name is blank, so need to use two passes. */ | |
755 list_all_matching_fonts (&match_data); | |
756 } | |
757 else | |
758 { | |
759 dc = get_frame_dc (f); | |
760 | |
761 EnumFontFamiliesEx (dc, &match_data.pattern, | |
762 (FONTENUMPROC) add_font_entity_to_list, | |
763 (LPARAM) &match_data, 0); | |
764 release_frame_dc (f, dc); | |
765 } | |
766 | |
101518
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
767 return match_data.list; |
91208 | 768 } |
769 | |
770 /* Internal implementation of w32font_match. | |
771 Additional parameter opentype_only restricts the returned fonts to | |
772 opentype fonts, which can be used with the Uniscribe backend. */ | |
773 Lisp_Object | |
774 w32font_match_internal (frame, font_spec, opentype_only) | |
775 Lisp_Object frame, font_spec; | |
776 int opentype_only; | |
777 { | |
778 struct font_callback_data match_data; | |
779 HDC dc; | |
780 FRAME_PTR f = XFRAME (frame); | |
781 | |
782 match_data.orig_font_spec = font_spec; | |
783 match_data.frame = frame; | |
784 match_data.list = Qnil; | |
785 | |
786 bzero (&match_data.pattern, sizeof (LOGFONT)); | |
787 fill_in_logfont (f, &match_data.pattern, font_spec); | |
788 | |
789 match_data.opentype_only = opentype_only; | |
790 if (opentype_only) | |
791 match_data.pattern.lfOutPrecision = OUT_OUTLINE_PRECIS; | |
792 | |
793 dc = get_frame_dc (f); | |
794 | |
795 EnumFontFamiliesEx (dc, &match_data.pattern, | |
796 (FONTENUMPROC) add_one_font_entity_to_list, | |
797 (LPARAM) &match_data, 0); | |
798 release_frame_dc (f, dc); | |
799 | |
800 return NILP (match_data.list) ? Qnil : XCAR (match_data.list); | |
801 } | |
802 | |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
803 int |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
804 w32font_open_internal (f, font_entity, pixel_size, font_object) |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
805 FRAME_PTR f; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
806 Lisp_Object font_entity; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
807 int pixel_size; |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
808 Lisp_Object font_object; |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
809 { |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
810 int len, size, i; |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
811 LOGFONT logfont; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
812 HDC dc; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
813 HFONT hfont, old_font; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
814 Lisp_Object val, extra; |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
815 struct w32font_info *w32_font; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
816 struct font * font; |
97135
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
817 OUTLINETEXTMETRICW* metrics = NULL; |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
818 |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
819 w32_font = (struct w32font_info *) XFONT_OBJECT (font_object); |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
820 font = (struct font *) w32_font; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
821 |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
822 if (!font) |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
823 return 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
824 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
825 bzero (&logfont, sizeof (logfont)); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
826 fill_in_logfont (f, &logfont, font_entity); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
827 |
95384
c510339c1817
(w32font_open_internal): Prefer truetype fonts unless
Jason Rumney <jasonr@gnu.org>
parents:
95341
diff
changeset
|
828 /* Prefer truetype fonts, to avoid known problems with type1 fonts, and |
c510339c1817
(w32font_open_internal): Prefer truetype fonts unless
Jason Rumney <jasonr@gnu.org>
parents:
95341
diff
changeset
|
829 limitations in bitmap fonts. */ |
c510339c1817
(w32font_open_internal): Prefer truetype fonts unless
Jason Rumney <jasonr@gnu.org>
parents:
95341
diff
changeset
|
830 val = AREF (font_entity, FONT_FOUNDRY_INDEX); |
c510339c1817
(w32font_open_internal): Prefer truetype fonts unless
Jason Rumney <jasonr@gnu.org>
parents:
95341
diff
changeset
|
831 if (!EQ (val, Qraster)) |
c510339c1817
(w32font_open_internal): Prefer truetype fonts unless
Jason Rumney <jasonr@gnu.org>
parents:
95341
diff
changeset
|
832 logfont.lfOutPrecision = OUT_TT_PRECIS; |
c510339c1817
(w32font_open_internal): Prefer truetype fonts unless
Jason Rumney <jasonr@gnu.org>
parents:
95341
diff
changeset
|
833 |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
834 size = XINT (AREF (font_entity, FONT_SIZE_INDEX)); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
835 if (!size) |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
836 size = pixel_size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
837 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
838 logfont.lfHeight = -size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
839 hfont = CreateFontIndirect (&logfont); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
840 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
841 if (hfont == NULL) |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
842 return 0; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
843 |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
844 /* Get the metrics for this font. */ |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
845 dc = get_frame_dc (f); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
846 old_font = SelectObject (dc, hfont); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
847 |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
848 /* Try getting the outline metrics (only works for truetype fonts). */ |
97135
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
849 len = GetOutlineTextMetricsW (dc, 0, NULL); |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
850 if (len) |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
851 { |
97135
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
852 metrics = (OUTLINETEXTMETRICW *) alloca (len); |
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
853 if (GetOutlineTextMetricsW (dc, len, metrics)) |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
854 bcopy (&metrics->otmTextMetrics, &w32_font->metrics, |
97135
09abb4487286
* w32font.h (struct w32font_info): Use unicode version of textmetrics.
Jason Rumney <jasonr@gnu.org>
parents:
97070
diff
changeset
|
855 sizeof (TEXTMETRICW)); |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
856 else |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
857 metrics = NULL; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
858 } |
95339
48f990d65758
(w32font_open_internal): Determine if glyph indices are likely to work here.
Jason Rumney <jasonr@gnu.org>
parents:
95315
diff
changeset
|
859 |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
860 if (!metrics) |
99854
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
861 GetTextMetricsW (dc, &w32_font->metrics); |
99989
fed2622a8def
* w32font.c (add_font_entity_to_list): Pass the right LOGFONT
Juanma Barranquero <lekktu@gmail.com>
parents:
99960
diff
changeset
|
862 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
863 w32_font->cached_metrics = NULL; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
864 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
|
865 |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
866 SelectObject (dc, old_font); |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
867 release_frame_dc (f, dc); |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
868 |
96327
2fc5aff56d81
* w32bdf.c, w32bdf.h: Remove obsolete files.
Jason Rumney <jasonr@gnu.org>
parents:
96111
diff
changeset
|
869 w32_font->hfont = hfont; |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
870 |
91496
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
871 { |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
872 char *name; |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
873 |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
874 /* 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
|
875 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
|
876 len = 96; |
96343
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
877 name = alloca (len); |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
878 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
|
879 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
|
880 { |
96343
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
881 len += 32; |
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
882 name = alloca (len); |
91496
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
883 } |
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
884 if (name) |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
885 font->props[FONT_FULLNAME_INDEX] |
100409
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
886 = DECODE_SYSTEM (build_string (name)); |
91496
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
887 else |
100409
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
888 font->props[FONT_FULLNAME_INDEX] |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
889 = DECODE_SYSTEM (build_string (logfont.lfFaceName)); |
91496
d3d1ab7e6e35
(w32font_open_internal): Use font_unparse_fcname to set full_name.
Jason Rumney <jasonr@gnu.org>
parents:
91447
diff
changeset
|
890 } |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
891 |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
892 font->max_width = w32_font->metrics.tmMaxCharWidth; |
99989
fed2622a8def
* w32font.c (add_font_entity_to_list): Pass the right LOGFONT
Juanma Barranquero <lekktu@gmail.com>
parents:
99960
diff
changeset
|
893 /* Parts of Emacs display assume that height = ascent + descent... |
99960
eff40549740c
(w32font_open_internal): Don't include external leading in font height.
Jason Rumney <jasonr@gnu.org>
parents:
99869
diff
changeset
|
894 so height is defined later, after ascent and descent. |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
895 font->height = w32_font->metrics.tmHeight |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
896 + w32_font->metrics.tmExternalLeading; |
99960
eff40549740c
(w32font_open_internal): Don't include external leading in font height.
Jason Rumney <jasonr@gnu.org>
parents:
99869
diff
changeset
|
897 */ |
eff40549740c
(w32font_open_internal): Don't include external leading in font height.
Jason Rumney <jasonr@gnu.org>
parents:
99869
diff
changeset
|
898 |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
899 font->space_width = font->average_width = w32_font->metrics.tmAveCharWidth; |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
900 |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
901 font->vertical_centering = 0; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
902 font->encoding_type = 0; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
903 font->baseline_offset = 0; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
904 font->relative_compose = 0; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
905 font->default_ascent = w32_font->metrics.tmAscent; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
906 font->font_encoder = NULL; |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
907 font->pixel_size = size; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
908 font->driver = &w32font_driver; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
909 /* 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
|
910 here is incomplete. */ |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
911 extra = AREF (font_entity, FONT_EXTRA_INDEX); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
912 if (CONSP (extra)) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
913 { |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
914 val = assq_no_quit (QCformat, extra); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
915 if (CONSP (val)) |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
916 font->props[FONT_FORMAT_INDEX] = XCDR (val); |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
917 else |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
918 font->props[FONT_FORMAT_INDEX] = Qunknown; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
919 } |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
920 else |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
921 font->props[FONT_FORMAT_INDEX] = Qunknown; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
922 |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
923 font->props[FONT_FILE_INDEX] = Qnil; |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
924 font->encoding_charset = -1; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
925 font->repertory_charset = -1; |
91545
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
926 /* TODO: do we really want the minimum width here, which could be negative? */ |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
927 font->min_width = font->space_width; |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
928 font->ascent = w32_font->metrics.tmAscent; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
929 font->descent = w32_font->metrics.tmDescent; |
99960
eff40549740c
(w32font_open_internal): Don't include external leading in font height.
Jason Rumney <jasonr@gnu.org>
parents:
99869
diff
changeset
|
930 font->height = font->ascent + font->descent; |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
931 |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
932 if (metrics) |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
933 { |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
934 font->underline_thickness = metrics->otmsUnderscoreSize; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
935 font->underline_position = -metrics->otmsUnderscorePosition; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
936 } |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
937 else |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
938 { |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
939 font->underline_thickness = 0; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
940 font->underline_position = -1; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
941 } |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
942 |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
943 /* For temporary compatibility with legacy code that expects the |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
944 name to be usable in x-list-fonts. Eventually we expect to change |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
945 x-list-fonts and other places that use fonts so that this can be |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
946 an fcname or similar. */ |
95190 | 947 font->props[FONT_NAME_INDEX] = Ffont_xlfd_name (font_object, Qnil); |
91545
572ea0c7c071
(w32font_open_internal): Fill min_width with tmAveCharWidth.
Jason Rumney <jasonr@gnu.org>
parents:
91521
diff
changeset
|
948 |
91211
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
949 return 1; |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
950 } |
abd06276f55a
(w32font_open_internal): New function.
Jason Rumney <jasonr@gnu.org>
parents:
91208
diff
changeset
|
951 |
90869 | 952 /* Callback function for EnumFontFamiliesEx. |
953 * 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
|
954 static int CALLBACK |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
955 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
|
956 ENUMLOGFONTEX *logical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
957 NEWTEXTMETRICEX *physical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
958 DWORD font_type; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
959 LPARAM list_object; |
90869 | 960 { |
961 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
|
962 Lisp_Object family; |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
963 |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
964 /* 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
|
965 if (logical_font->elfLogFont.lfFaceName[0] == '@') |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
966 return 1; |
2060802cc53f
(add_font_name_to_list): Avoid vertical fonts.
Jason Rumney <jasonr@gnu.org>
parents:
91034
diff
changeset
|
967 |
100409
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
968 family = intern_font_name (logical_font->elfLogFont.lfFaceName); |
90869 | 969 if (! memq_no_quit (family, *list)) |
970 *list = Fcons (family, *list); | |
971 | |
972 return 1; | |
973 } | |
974 | |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
975 static int w32_decode_weight P_ ((int)); |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
976 static int w32_encode_weight P_ ((int)); |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
977 |
90869 | 978 /* 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
|
979 static Lisp_Object |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
980 w32_enumfont_pattern_entity (frame, logical_font, physical_font, |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
981 font_type, requested_font, backend) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
982 Lisp_Object frame; |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
983 ENUMLOGFONTEX *logical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
984 NEWTEXTMETRICEX *physical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
985 DWORD font_type; |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
986 LOGFONT *requested_font; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
987 Lisp_Object backend; |
90869 | 988 { |
989 Lisp_Object entity, tem; | |
990 LOGFONT *lf = (LOGFONT*) logical_font; | |
991 BYTE generic_type; | |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
992 DWORD full_type = physical_font->ntmTm.ntmFlags; |
90869 | 993 |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
994 entity = font_make_entity (); |
90869 | 995 |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
996 ASET (entity, FONT_TYPE_INDEX, backend); |
92539
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
997 ASET (entity, FONT_REGISTRY_INDEX, w32_registry (lf->lfCharSet, font_type)); |
90869 | 998 ASET (entity, FONT_OBJLIST_INDEX, Qnil); |
999 | |
1000 /* 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
|
1001 But Emacs crashes if it is not set, so set it to something more |
95341
5602389abb69
(compute_metrics): Rewrite an "else { if () ... else ... }"
Juanma Barranquero <lekktu@gmail.com>
parents:
95339
diff
changeset
|
1002 generic. These values make xlfds compatible with Emacs 22. */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1003 if (lf->lfOutPrecision == OUT_STRING_PRECIS) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1004 tem = Qraster; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1005 else if (lf->lfOutPrecision == OUT_STROKE_PRECIS) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1006 tem = Qoutline; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1007 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1008 tem = Qunknown; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1009 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1010 ASET (entity, FONT_FOUNDRY_INDEX, tem); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1011 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1012 /* 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
|
1013 useful to users looking for a close match. */ |
90869 | 1014 generic_type = physical_font->ntmTm.tmPitchAndFamily & 0xF0; |
1015 if (generic_type == FF_DECORATIVE) | |
1016 tem = Qdecorative; | |
1017 else if (generic_type == FF_MODERN) | |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1018 tem = Qmono; |
90869 | 1019 else if (generic_type == FF_ROMAN) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1020 tem = Qserif; |
90869 | 1021 else if (generic_type == FF_SCRIPT) |
1022 tem = Qscript; | |
1023 else if (generic_type == FF_SWISS) | |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1024 tem = Qsans; |
90869 | 1025 else |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1026 tem = Qnil; |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1027 |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1028 ASET (entity, FONT_ADSTYLE_INDEX, tem); |
90869 | 1029 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1030 if (physical_font->ntmTm.tmPitchAndFamily & 0x01) |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1031 ASET (entity, FONT_SPACING_INDEX, make_number (FONT_SPACING_PROPORTIONAL)); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1032 else |
95315
3d4da4481f75
(w32_weight_table): Remove unused variable.
Jason Rumney <jasonr@gnu.org>
parents:
95310
diff
changeset
|
1033 ASET (entity, FONT_SPACING_INDEX, make_number (FONT_SPACING_CHARCELL)); |
90869 | 1034 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1035 if (requested_font->lfQuality != DEFAULT_QUALITY) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1036 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1037 font_put_extra (entity, QCantialias, |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1038 lispy_antialias_type (requested_font->lfQuality)); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1039 } |
90869 | 1040 ASET (entity, FONT_FAMILY_INDEX, |
100409
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
1041 intern_font_name (lf->lfFaceName)); |
90869 | 1042 |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1043 FONT_SET_STYLE (entity, FONT_WEIGHT_INDEX, |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1044 make_number (w32_decode_weight (lf->lfWeight))); |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1045 FONT_SET_STYLE (entity, FONT_SLANT_INDEX, |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1046 make_number (lf->lfItalic ? 200 : 100)); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1047 /* 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
|
1048 to get it. */ |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1049 FONT_SET_STYLE (entity, FONT_WIDTH_INDEX, make_number (100)); |
90869 | 1050 |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1051 if (font_type & RASTER_FONTTYPE) |
96934
59f723e2168b
(w32_enumfont_pattern_entity): Return height consistent with opened font.
Jason Rumney <jasonr@gnu.org>
parents:
96563
diff
changeset
|
1052 ASET (entity, FONT_SIZE_INDEX, |
59f723e2168b
(w32_enumfont_pattern_entity): Return height consistent with opened font.
Jason Rumney <jasonr@gnu.org>
parents:
96563
diff
changeset
|
1053 make_number (physical_font->ntmTm.tmHeight |
59f723e2168b
(w32_enumfont_pattern_entity): Return height consistent with opened font.
Jason Rumney <jasonr@gnu.org>
parents:
96563
diff
changeset
|
1054 + physical_font->ntmTm.tmExternalLeading)); |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1055 else |
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1056 ASET (entity, FONT_SIZE_INDEX, make_number (0)); |
90869 | 1057 |
1058 /* Cache unicode codepoints covered by this font, as there is no other way | |
1059 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
|
1060 if (font_type & TRUETYPE_FONTTYPE) |
90869 | 1061 { |
95468
19ee88719d52
(w32_enumfont_pattern_entity): Use requested registry.
Jason Rumney <jasonr@gnu.org>
parents:
95388
diff
changeset
|
1062 tem = font_supported_scripts (&physical_font->ntmFontSig); |
19ee88719d52
(w32_enumfont_pattern_entity): Use requested registry.
Jason Rumney <jasonr@gnu.org>
parents:
95388
diff
changeset
|
1063 if (!NILP (tem)) |
19ee88719d52
(w32_enumfont_pattern_entity): Use requested registry.
Jason Rumney <jasonr@gnu.org>
parents:
95388
diff
changeset
|
1064 font_put_extra (entity, QCscript, tem); |
90869 | 1065 } |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1066 |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1067 /* This information is not fully available when opening fonts, so |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1068 save it here. Only Windows 2000 and later return information |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1069 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
|
1070 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
|
1071 have obtained later. */ |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1072 if (EQ (backend, Quniscribe) && (full_type & NTMFLAGS_OPENTYPE)) |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1073 tem = intern ("opentype"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1074 else if (font_type & TRUETYPE_FONTTYPE) |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1075 tem = intern ("truetype"); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1076 else if (full_type & NTM_PS_OPENTYPE) |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1077 tem = intern ("postscript"); |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1078 else if (full_type & NTM_TYPE1) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1079 tem = intern ("type1"); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1080 else if (font_type & RASTER_FONTTYPE) |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1081 tem = intern ("w32bitmap"); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1082 else |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1083 tem = intern ("w32vector"); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1084 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1085 font_put_extra (entity, QCformat, tem); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
1086 |
90869 | 1087 return entity; |
1088 } | |
1089 | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1090 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1091 /* Convert generic families to the family portion of lfPitchAndFamily. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1092 BYTE |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1093 w32_generic_family (Lisp_Object name) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1094 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1095 /* Generic families. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1096 if (EQ (name, Qmonospace) || EQ (name, Qmono)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1097 return FF_MODERN; |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1098 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
|
1099 return FF_SWISS; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1100 else if (EQ (name, Qserif)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1101 return FF_ROMAN; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1102 else if (EQ (name, Qdecorative)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1103 return FF_DECORATIVE; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1104 else if (EQ (name, Qscript)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1105 return FF_SCRIPT; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1106 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1107 return FF_DONTCARE; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1108 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1109 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1110 static int |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1111 logfonts_match (font, pattern) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1112 LOGFONT *font, *pattern; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1113 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1114 /* Only check height for raster fonts. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1115 if (pattern->lfHeight && font->lfOutPrecision == OUT_STRING_PRECIS |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1116 && font->lfHeight != pattern->lfHeight) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1117 return 0; |
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 /* Have some flexibility with weights. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1120 if (pattern->lfWeight |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1121 && ((font->lfWeight < (pattern->lfWeight - 150)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1122 || font->lfWeight > (pattern->lfWeight + 150))) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1123 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1124 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1125 /* 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
|
1126 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
|
1127 return 1; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1128 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1129 |
96111
365321a44102
(font_matches_spec): Use csb bitfield from font signature to determine
Jason Rumney <jasonr@gnu.org>
parents:
96071
diff
changeset
|
1130 /* Codepage Bitfields in FONTSIGNATURE struct. */ |
365321a44102
(font_matches_spec): Use csb bitfield from font signature to determine
Jason Rumney <jasonr@gnu.org>
parents:
96071
diff
changeset
|
1131 #define CSB_JAPANESE (1 << 17) |
365321a44102
(font_matches_spec): Use csb bitfield from font signature to determine
Jason Rumney <jasonr@gnu.org>
parents:
96071
diff
changeset
|
1132 #define CSB_KOREAN ((1 << 19) | (1 << 21)) |
365321a44102
(font_matches_spec): Use csb bitfield from font signature to determine
Jason Rumney <jasonr@gnu.org>
parents:
96071
diff
changeset
|
1133 #define CSB_CHINESE ((1 << 18) | (1 << 20)) |
365321a44102
(font_matches_spec): Use csb bitfield from font signature to determine
Jason Rumney <jasonr@gnu.org>
parents:
96071
diff
changeset
|
1134 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1135 static int |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1136 font_matches_spec (type, font, spec, backend, logfont) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1137 DWORD type; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1138 NEWTEXTMETRICEX *font; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1139 Lisp_Object spec; |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1140 Lisp_Object backend; |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1141 LOGFONT *logfont; |
90869 | 1142 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1143 Lisp_Object extra, val; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1144 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1145 /* 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
|
1146 so there is no difference between "non-italic" and "don't care". */ |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1147 { |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1148 int slant = FONT_SLANT_NUMERIC (spec); |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1149 |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1150 if (slant >= 0 |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1151 && ((slant > 150 && !font->ntmTm.tmItalic) |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1152 || (slant <= 150 && font->ntmTm.tmItalic))) |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1153 return 0; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1154 } |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1155 |
91264
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1156 /* Check adstyle against generic family. */ |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1157 val = AREF (spec, FONT_ADSTYLE_INDEX); |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1158 if (!NILP (val)) |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1159 { |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1160 BYTE family = w32_generic_family (val); |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1161 if (family != FF_DONTCARE |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1162 && family != (font->ntmTm.tmPitchAndFamily & 0xF0)) |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1163 return 0; |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1164 } |
9112e263c11f
(logfonts_match): Don't check adstyle here.
Jason Rumney <jasonr@gnu.org>
parents:
91260
diff
changeset
|
1165 |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1166 /* Check spacing */ |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1167 val = AREF (spec, FONT_SPACING_INDEX); |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1168 if (INTEGERP (val)) |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1169 { |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1170 int spacing = XINT (val); |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1171 int proportional = (spacing < FONT_SPACING_MONO); |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1172 |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1173 if ((proportional && !(font->ntmTm.tmPitchAndFamily & 0x01)) |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1174 || (!proportional && (font->ntmTm.tmPitchAndFamily & 0x01))) |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1175 return 0; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1176 } |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1177 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1178 /* Check extra parameters. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1179 for (extra = AREF (spec, FONT_EXTRA_INDEX); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1180 CONSP (extra); extra = XCDR (extra)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1181 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1182 Lisp_Object extra_entry; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1183 extra_entry = XCAR (extra); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1184 if (CONSP (extra_entry)) |
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 Lisp_Object key = XCAR (extra_entry); |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1187 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1188 val = XCDR (extra_entry); |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1189 if (EQ (key, QCscript) && SYMBOLP (val)) |
90906
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 /* Only truetype fonts will have information about what |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1192 scripts they support. This probably means the user |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1193 will have to force Emacs to use raster, postscript |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1194 or atm fonts for non-ASCII text. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1195 if (type & TRUETYPE_FONTTYPE) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1196 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1197 Lisp_Object support |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1198 = font_supported_scripts (&font->ntmFontSig); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1199 if (! memq_no_quit (val, support)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1200 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1201 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1202 else |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1203 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1204 /* Return specific matches, but play it safe. Fonts |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1205 that cover more than their charset would suggest |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1206 are likely to be truetype or opentype fonts, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1207 covered above. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1208 if (EQ (val, Qlatin)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1209 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1210 /* Although every charset but symbol, thai and |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1211 arabic contains the basic ASCII set of latin |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1212 characters, Emacs expects much more. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1213 if (font->ntmTm.tmCharSet != ANSI_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1214 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1215 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1216 else if (EQ (val, Qsymbol)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1217 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1218 if (font->ntmTm.tmCharSet != SYMBOL_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1219 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1220 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1221 else if (EQ (val, Qcyrillic)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1222 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1223 if (font->ntmTm.tmCharSet != RUSSIAN_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 if (EQ (val, Qgreek)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1227 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1228 if (font->ntmTm.tmCharSet != GREEK_CHARSET) |
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 else if (EQ (val, Qarabic)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1232 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1233 if (font->ntmTm.tmCharSet != ARABIC_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1234 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1235 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1236 else if (EQ (val, Qhebrew)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1237 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1238 if (font->ntmTm.tmCharSet != HEBREW_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1239 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1240 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1241 else if (EQ (val, Qthai)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1242 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1243 if (font->ntmTm.tmCharSet != THAI_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1244 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1245 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1246 else if (EQ (val, Qkana)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1247 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1248 if (font->ntmTm.tmCharSet != SHIFTJIS_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1249 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1250 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1251 else if (EQ (val, Qbopomofo)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1252 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1253 if (font->ntmTm.tmCharSet != CHINESEBIG5_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1254 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1255 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1256 else if (EQ (val, Qhangul)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1257 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1258 if (font->ntmTm.tmCharSet != HANGUL_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1259 && font->ntmTm.tmCharSet != JOHAB_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1260 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1261 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1262 else if (EQ (val, Qhan)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1263 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1264 if (font->ntmTm.tmCharSet != CHINESEBIG5_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1265 && font->ntmTm.tmCharSet != GB2312_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1266 && font->ntmTm.tmCharSet != HANGUL_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1267 && font->ntmTm.tmCharSet != JOHAB_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1268 && font->ntmTm.tmCharSet != SHIFTJIS_CHARSET) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1269 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1270 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1271 else |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1272 /* Other scripts unlikely to be handled by non-truetype |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1273 fonts. */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1274 return 0; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1275 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1276 } |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1277 else if (EQ (key, QClang) && SYMBOLP (val)) |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1278 { |
96111
365321a44102
(font_matches_spec): Use csb bitfield from font signature to determine
Jason Rumney <jasonr@gnu.org>
parents:
96071
diff
changeset
|
1279 /* Just handle the CJK languages here, as the lang |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1280 parameter is used to select a font with appropriate |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1281 glyphs in the cjk unified ideographs block. Other fonts |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1282 support for a language can be solely determined by |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1283 its character coverage. */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1284 if (EQ (val, Qja)) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1285 { |
96111
365321a44102
(font_matches_spec): Use csb bitfield from font signature to determine
Jason Rumney <jasonr@gnu.org>
parents:
96071
diff
changeset
|
1286 if (!(font->ntmFontSig.fsCsb[0] & CSB_JAPANESE)) |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1287 return 0; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1288 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1289 else if (EQ (val, Qko)) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1290 { |
96111
365321a44102
(font_matches_spec): Use csb bitfield from font signature to determine
Jason Rumney <jasonr@gnu.org>
parents:
96071
diff
changeset
|
1291 if (!(font->ntmFontSig.fsCsb[0] & CSB_KOREAN)) |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1292 return 0; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1293 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1294 else if (EQ (val, Qzh)) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1295 { |
96111
365321a44102
(font_matches_spec): Use csb bitfield from font signature to determine
Jason Rumney <jasonr@gnu.org>
parents:
96071
diff
changeset
|
1296 if (!(font->ntmFontSig.fsCsb[0] & CSB_CHINESE)) |
365321a44102
(font_matches_spec): Use csb bitfield from font signature to determine
Jason Rumney <jasonr@gnu.org>
parents:
96071
diff
changeset
|
1297 return 0; |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1298 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1299 else |
96111
365321a44102
(font_matches_spec): Use csb bitfield from font signature to determine
Jason Rumney <jasonr@gnu.org>
parents:
96071
diff
changeset
|
1300 /* Any other language, we don't recognize it. Only the above |
365321a44102
(font_matches_spec): Use csb bitfield from font signature to determine
Jason Rumney <jasonr@gnu.org>
parents:
96071
diff
changeset
|
1301 currently appear in fontset.el, so it isn't worth |
365321a44102
(font_matches_spec): Use csb bitfield from font signature to determine
Jason Rumney <jasonr@gnu.org>
parents:
96071
diff
changeset
|
1302 creating a mapping table of codepages/scripts to languages |
365321a44102
(font_matches_spec): Use csb bitfield from font signature to determine
Jason Rumney <jasonr@gnu.org>
parents:
96071
diff
changeset
|
1303 or opening the font to see if there are any language tags |
365321a44102
(font_matches_spec): Use csb bitfield from font signature to determine
Jason Rumney <jasonr@gnu.org>
parents:
96071
diff
changeset
|
1304 in it that the W32 API does not expose. Fontset |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1305 spec should have a fallback, as some backends do |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1306 not recognize language at all. */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1307 return 0; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
1308 } |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1309 else if (EQ (key, QCotf) && CONSP (val)) |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1310 { |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1311 /* OTF features only supported by the uniscribe backend. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1312 if (EQ (backend, Quniscribe)) |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1313 { |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1314 if (!uniscribe_check_otf (logfont, val)) |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1315 return 0; |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1316 } |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1317 else |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1318 return 0; |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1319 } |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1320 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1321 } |
90869 | 1322 return 1; |
1323 } | |
1324 | |
92539
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1325 static int |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1326 w32font_coverage_ok (coverage, charset) |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1327 FONTSIGNATURE * coverage; |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1328 BYTE charset; |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1329 { |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1330 DWORD subrange1 = coverage->fsUsb[1]; |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1331 |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1332 #define SUBRANGE1_HAN_MASK 0x08000000 |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1333 #define SUBRANGE1_HANGEUL_MASK 0x01000000 |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1334 #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
|
1335 |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1336 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
|
1337 { |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1338 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
|
1339 } |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1340 else if (charset == SHIFTJIS_CHARSET) |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1341 { |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1342 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
|
1343 } |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1344 else if (charset == HANGEUL_CHARSET) |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1345 { |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1346 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
|
1347 } |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1348 |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1349 return 1; |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1350 } |
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1351 |
99854
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1352 |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1353 static int |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1354 check_face_name (font, full_name) |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1355 LOGFONT *font; |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1356 char *full_name; |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1357 { |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1358 char full_iname[LF_FULLFACESIZE+1]; |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1359 |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1360 /* Just check for names known to cause problems, since the full name |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1361 can contain expanded abbreviations, prefixed foundry, postfixed |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1362 style, the latter of which sometimes differs from the style indicated |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1363 in the shorter name (eg Lt becomes Light or even Extra Light) */ |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1364 |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1365 /* Helvetica is mapped to Arial in Windows, but if a Type-1 Helvetica is |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1366 installed, we run into problems with the Uniscribe backend which tries |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1367 to avoid non-truetype fonts, and ends up mixing the Type-1 Helvetica |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1368 with Arial's characteristics, since that attempt to use Truetype works |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1369 some places, but not others. */ |
99869
a63d3e2ae30c
(check_face_name): Use xstrcasecmp. Avoid compiler warning.
Jason Rumney <jasonr@gnu.org>
parents:
99854
diff
changeset
|
1370 if (!xstrcasecmp (font->lfFaceName, "helvetica")) |
99854
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1371 { |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1372 strncpy (full_iname, full_name, LF_FULLFACESIZE); |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1373 full_iname[LF_FULLFACESIZE] = 0; |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1374 _strlwr (full_iname); |
99869
a63d3e2ae30c
(check_face_name): Use xstrcasecmp. Avoid compiler warning.
Jason Rumney <jasonr@gnu.org>
parents:
99854
diff
changeset
|
1375 return strstr ("helvetica", full_iname) != NULL; |
99854
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1376 } |
101979
1c96a8f3d1d7
(check_face_name): Check for fake helv. (Bug#2275)
Jason Rumney <jasonr@gnu.org>
parents:
101975
diff
changeset
|
1377 /* Same for Helv. */ |
1c96a8f3d1d7
(check_face_name): Check for fake helv. (Bug#2275)
Jason Rumney <jasonr@gnu.org>
parents:
101975
diff
changeset
|
1378 if (!xstrcasecmp (font->lfFaceName, "helv")) |
1c96a8f3d1d7
(check_face_name): Check for fake helv. (Bug#2275)
Jason Rumney <jasonr@gnu.org>
parents:
101975
diff
changeset
|
1379 { |
1c96a8f3d1d7
(check_face_name): Check for fake helv. (Bug#2275)
Jason Rumney <jasonr@gnu.org>
parents:
101975
diff
changeset
|
1380 strncpy (full_iname, full_name, LF_FULLFACESIZE); |
1c96a8f3d1d7
(check_face_name): Check for fake helv. (Bug#2275)
Jason Rumney <jasonr@gnu.org>
parents:
101975
diff
changeset
|
1381 full_iname[LF_FULLFACESIZE] = 0; |
1c96a8f3d1d7
(check_face_name): Check for fake helv. (Bug#2275)
Jason Rumney <jasonr@gnu.org>
parents:
101975
diff
changeset
|
1382 _strlwr (full_iname); |
1c96a8f3d1d7
(check_face_name): Check for fake helv. (Bug#2275)
Jason Rumney <jasonr@gnu.org>
parents:
101975
diff
changeset
|
1383 return strstr ("helv", full_iname) != NULL; |
1c96a8f3d1d7
(check_face_name): Check for fake helv. (Bug#2275)
Jason Rumney <jasonr@gnu.org>
parents:
101975
diff
changeset
|
1384 } |
99869
a63d3e2ae30c
(check_face_name): Use xstrcasecmp. Avoid compiler warning.
Jason Rumney <jasonr@gnu.org>
parents:
99854
diff
changeset
|
1385 |
a63d3e2ae30c
(check_face_name): Use xstrcasecmp. Avoid compiler warning.
Jason Rumney <jasonr@gnu.org>
parents:
99854
diff
changeset
|
1386 /* Since Times is mapped to Times New Roman, a substring |
a63d3e2ae30c
(check_face_name): Use xstrcasecmp. Avoid compiler warning.
Jason Rumney <jasonr@gnu.org>
parents:
99854
diff
changeset
|
1387 match is not sufficient to filter out the bogus match. */ |
a63d3e2ae30c
(check_face_name): Use xstrcasecmp. Avoid compiler warning.
Jason Rumney <jasonr@gnu.org>
parents:
99854
diff
changeset
|
1388 else if (!xstrcasecmp (font->lfFaceName, "times")) |
a63d3e2ae30c
(check_face_name): Use xstrcasecmp. Avoid compiler warning.
Jason Rumney <jasonr@gnu.org>
parents:
99854
diff
changeset
|
1389 return xstrcasecmp (full_name, "times") == 0; |
99854
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1390 |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1391 return 1; |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1392 } |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1393 |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1394 |
90869 | 1395 /* Callback function for EnumFontFamiliesEx. |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1396 * 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
|
1397 * 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
|
1398 * 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
|
1399 * 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
|
1400 static int CALLBACK |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1401 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
|
1402 ENUMLOGFONTEX *logical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1403 NEWTEXTMETRICEX *physical_font; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1404 DWORD font_type; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1405 LPARAM lParam; |
90869 | 1406 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1407 struct font_callback_data *match_data |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1408 = (struct font_callback_data *) lParam; |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1409 Lisp_Object backend = match_data->opentype_only ? Quniscribe : Qgdi; |
101518
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1410 Lisp_Object entity; |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1411 |
101518
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1412 int is_unicode = physical_font->ntmFontSig.fsUsb[3] |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1413 || physical_font->ntmFontSig.fsUsb[2] |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1414 || physical_font->ntmFontSig.fsUsb[1] |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1415 || physical_font->ntmFontSig.fsUsb[0] & 0x3fffffff; |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1416 |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1417 /* Skip non matching fonts. */ |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1418 |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1419 /* For uniscribe backend, consider only truetype or opentype fonts |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1420 that have some unicode coverage. */ |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1421 if (match_data->opentype_only |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1422 && ((!physical_font->ntmTm.ntmFlags & NTMFLAGS_OPENTYPE |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1423 && !(font_type & TRUETYPE_FONTTYPE)) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1424 || !is_unicode)) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1425 return 1; |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1426 |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1427 /* Ensure a match. */ |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1428 if (!logfonts_match (&logical_font->elfLogFont, &match_data->pattern) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1429 || !font_matches_spec (font_type, physical_font, |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1430 match_data->orig_font_spec, backend, |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1431 &logical_font->elfLogFont) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1432 || !w32font_coverage_ok (&physical_font->ntmFontSig, |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1433 match_data->pattern.lfCharSet)) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1434 return 1; |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1435 |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1436 /* Avoid substitutions involving raster fonts (eg Helv -> MS Sans Serif) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1437 We limit this to raster fonts, because the test can catch some |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1438 genuine fonts (eg the full name of DejaVu Sans Mono Light is actually |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1439 DejaVu Sans Mono ExtraLight). Helvetica -> Arial substitution will |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1440 therefore get through this test. Since full names can be prefixed |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1441 by a foundry, we accept raster fonts if the font name is found |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1442 anywhere within the full name. */ |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1443 if ((logical_font->elfLogFont.lfOutPrecision == OUT_STRING_PRECIS |
101975
a36cf7879fb6
(add_font_entity_to_list): Fix check for substituted
Jason Rumney <jasonr@gnu.org>
parents:
101518
diff
changeset
|
1444 && !strstr (logical_font->elfFullName, |
a36cf7879fb6
(add_font_entity_to_list): Fix check for substituted
Jason Rumney <jasonr@gnu.org>
parents:
101518
diff
changeset
|
1445 logical_font->elfLogFont.lfFaceName)) |
99854
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1446 /* Check for well known substitutions that mess things up in the |
528e53849f51
(check_face_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
97243
diff
changeset
|
1447 presence of Type-1 fonts of the same name. */ |
101979
1c96a8f3d1d7
(check_face_name): Check for fake helv. (Bug#2275)
Jason Rumney <jasonr@gnu.org>
parents:
101975
diff
changeset
|
1448 || (!check_face_name (&logical_font->elfLogFont, |
1c96a8f3d1d7
(check_face_name): Check for fake helv. (Bug#2275)
Jason Rumney <jasonr@gnu.org>
parents:
101975
diff
changeset
|
1449 logical_font->elfFullName))) |
101518
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1450 return 1; |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1451 |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1452 /* Make a font entity for the font. */ |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1453 entity = w32_enumfont_pattern_entity (match_data->frame, logical_font, |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1454 physical_font, font_type, |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1455 &match_data->pattern, |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1456 backend); |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1457 |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1458 if (!NILP (entity)) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1459 { |
101518
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1460 Lisp_Object spec_charset = AREF (match_data->orig_font_spec, |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1461 FONT_REGISTRY_INDEX); |
95468
19ee88719d52
(w32_enumfont_pattern_entity): Use requested registry.
Jason Rumney <jasonr@gnu.org>
parents:
95388
diff
changeset
|
1462 |
101518
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1463 /* iso10646-1 fonts must contain unicode mapping tables. */ |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1464 if (EQ (spec_charset, Qiso10646_1)) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1465 { |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1466 if (!is_unicode) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1467 return 1; |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1468 } |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1469 /* unicode-bmp fonts must contain characters from the BMP. */ |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1470 else if (EQ (spec_charset, Qunicode_bmp)) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1471 { |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1472 if (!physical_font->ntmFontSig.fsUsb[3] |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1473 && !(physical_font->ntmFontSig.fsUsb[2] & 0xFFFFFF9E) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1474 && !(physical_font->ntmFontSig.fsUsb[1] & 0xE81FFFFF) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1475 && !(physical_font->ntmFontSig.fsUsb[0] & 0x007F001F)) |
100325
c28823ea450a
(add_font_entity_to_list): Limit unicode-sip fonts to those that
Jason Rumney <jasonr@gnu.org>
parents:
100323
diff
changeset
|
1476 return 1; |
101518
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1477 } |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1478 /* unicode-sip fonts must contain characters in unicode plane 2. |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1479 so look for bit 57 (surrogates) in the Unicode subranges, plus |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1480 the bits for CJK ranges that include those characters. */ |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1481 else if (EQ (spec_charset, Qunicode_sip)) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1482 { |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1483 if (!physical_font->ntmFontSig.fsUsb[1] & 0x02000000 |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1484 || !physical_font->ntmFontSig.fsUsb[1] & 0x28000000) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1485 return 1; |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1486 } |
95468
19ee88719d52
(w32_enumfont_pattern_entity): Use requested registry.
Jason Rumney <jasonr@gnu.org>
parents:
95388
diff
changeset
|
1487 |
101518
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1488 /* This font matches. */ |
95468
19ee88719d52
(w32_enumfont_pattern_entity): Use requested registry.
Jason Rumney <jasonr@gnu.org>
parents:
95388
diff
changeset
|
1489 |
101518
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1490 /* If registry was specified, ensure it is reported as the same. */ |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1491 if (!NILP (spec_charset)) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1492 ASET (entity, FONT_REGISTRY_INDEX, spec_charset); |
95468
19ee88719d52
(w32_enumfont_pattern_entity): Use requested registry.
Jason Rumney <jasonr@gnu.org>
parents:
95388
diff
changeset
|
1493 |
101518
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1494 /* Otherwise if using the uniscribe backend, report ANSI and DEFAULT |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1495 fonts as unicode and skip other charsets. */ |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1496 else if (match_data->opentype_only) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1497 { |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1498 if (logical_font->elfLogFont.lfCharSet == ANSI_CHARSET |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1499 || logical_font->elfLogFont.lfCharSet == DEFAULT_CHARSET) |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1500 ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1); |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1501 else |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1502 return 1; |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1503 } |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1504 |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1505 /* Add this font to the list. */ |
280a537a4f06
(w32font_list_internal): Return quickly if registry is
Jason Rumney <jasonr@gnu.org>
parents:
101035
diff
changeset
|
1506 match_data->list = Fcons (entity, match_data->list); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1507 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1508 return 1; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1509 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1510 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1511 /* Callback function for EnumFontFamiliesEx. |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1512 * Terminates the search once we have a match. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1513 static int CALLBACK |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1514 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
|
1515 ENUMLOGFONTEX *logical_font; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1516 NEWTEXTMETRICEX *physical_font; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1517 DWORD font_type; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1518 LPARAM lParam; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1519 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1520 struct font_callback_data *match_data |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1521 = (struct font_callback_data *) lParam; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1522 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
|
1523 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1524 /* If we have a font in the list, terminate the search. */ |
101035
21dea33fa8fd
(add_font_entity_to_list): Don't report unknown
Jason Rumney <jasonr@gnu.org>
parents:
100951
diff
changeset
|
1525 return NILP (match_data->list); |
90869 | 1526 } |
1527 | |
96385
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1528 /* Old function to convert from x to w32 charset, from w32fns.c. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1529 static LONG |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1530 x_to_w32_charset (lpcs) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1531 char * lpcs; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1532 { |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1533 Lisp_Object this_entry, w32_charset; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1534 char *charset; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1535 int len = strlen (lpcs); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1536 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1537 /* Support "*-#nnn" format for unknown charsets. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1538 if (strncmp (lpcs, "*-#", 3) == 0) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1539 return atoi (lpcs + 3); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1540 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1541 /* All Windows fonts qualify as unicode. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1542 if (!strncmp (lpcs, "iso10646", 8)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1543 return DEFAULT_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1544 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1545 /* Handle wildcards by ignoring them; eg. treat "big5*-*" as "big5". */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1546 charset = alloca (len + 1); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1547 strcpy (charset, lpcs); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1548 lpcs = strchr (charset, '*'); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1549 if (lpcs) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1550 *lpcs = '\0'; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1551 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1552 /* Look through w32-charset-info-alist for the character set. |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1553 Format of each entry is |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1554 (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)). |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1555 */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1556 this_entry = Fassoc (build_string (charset), Vw32_charset_info_alist); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1557 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1558 if (NILP (this_entry)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1559 { |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1560 /* At startup, we want iso8859-1 fonts to come up properly. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1561 if (xstrcasecmp (charset, "iso8859-1") == 0) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1562 return ANSI_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1563 else |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1564 return DEFAULT_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1565 } |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1566 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1567 w32_charset = Fcar (Fcdr (this_entry)); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1568 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1569 /* Translate Lisp symbol to number. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1570 if (EQ (w32_charset, Qw32_charset_ansi)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1571 return ANSI_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1572 if (EQ (w32_charset, Qw32_charset_symbol)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1573 return SYMBOL_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1574 if (EQ (w32_charset, Qw32_charset_shiftjis)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1575 return SHIFTJIS_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1576 if (EQ (w32_charset, Qw32_charset_hangeul)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1577 return HANGEUL_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1578 if (EQ (w32_charset, Qw32_charset_chinesebig5)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1579 return CHINESEBIG5_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1580 if (EQ (w32_charset, Qw32_charset_gb2312)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1581 return GB2312_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1582 if (EQ (w32_charset, Qw32_charset_oem)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1583 return OEM_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1584 if (EQ (w32_charset, Qw32_charset_johab)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1585 return JOHAB_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1586 if (EQ (w32_charset, Qw32_charset_easteurope)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1587 return EASTEUROPE_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1588 if (EQ (w32_charset, Qw32_charset_turkish)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1589 return TURKISH_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1590 if (EQ (w32_charset, Qw32_charset_baltic)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1591 return BALTIC_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1592 if (EQ (w32_charset, Qw32_charset_russian)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1593 return RUSSIAN_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1594 if (EQ (w32_charset, Qw32_charset_arabic)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1595 return ARABIC_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1596 if (EQ (w32_charset, Qw32_charset_greek)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1597 return GREEK_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1598 if (EQ (w32_charset, Qw32_charset_hebrew)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1599 return HEBREW_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1600 if (EQ (w32_charset, Qw32_charset_vietnamese)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1601 return VIETNAMESE_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1602 if (EQ (w32_charset, Qw32_charset_thai)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1603 return THAI_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1604 if (EQ (w32_charset, Qw32_charset_mac)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1605 return MAC_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1606 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1607 return DEFAULT_CHARSET; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1608 } |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1609 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1610 |
90869 | 1611 /* 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
|
1612 static LONG |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1613 registry_to_w32_charset (charset) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1614 Lisp_Object charset; |
90869 | 1615 { |
1616 if (EQ (charset, Qiso10646_1) || EQ (charset, Qunicode_bmp) | |
1617 || EQ (charset, Qunicode_sip)) | |
1618 return DEFAULT_CHARSET; /* UNICODE_CHARSET not defined in MingW32 */ | |
1619 else if (EQ (charset, Qiso8859_1)) | |
1620 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
|
1621 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
|
1622 return x_to_w32_charset (SDATA (SYMBOL_NAME (charset))); |
90869 | 1623 else |
1624 return DEFAULT_CHARSET; | |
1625 } | |
1626 | |
96385
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1627 /* Old function to convert from w32 to x charset, from w32fns.c. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1628 static char * |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1629 w32_to_x_charset (fncharset, matching) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1630 int fncharset; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1631 char *matching; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1632 { |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1633 static char buf[32]; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1634 Lisp_Object charset_type; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1635 int match_len = 0; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1636 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1637 if (matching) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1638 { |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1639 /* If fully specified, accept it as it is. Otherwise use a |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1640 substring match. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1641 char *wildcard = strchr (matching, '*'); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1642 if (wildcard) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1643 *wildcard = '\0'; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1644 else if (strchr (matching, '-')) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1645 return matching; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1646 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1647 match_len = strlen (matching); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1648 } |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1649 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1650 switch (fncharset) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1651 { |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1652 case ANSI_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1653 /* Handle startup case of w32-charset-info-alist not |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1654 being set up yet. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1655 if (NILP (Vw32_charset_info_alist)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1656 return "iso8859-1"; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1657 charset_type = Qw32_charset_ansi; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1658 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1659 case DEFAULT_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1660 charset_type = Qw32_charset_default; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1661 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1662 case SYMBOL_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1663 charset_type = Qw32_charset_symbol; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1664 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1665 case SHIFTJIS_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1666 charset_type = Qw32_charset_shiftjis; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1667 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1668 case HANGEUL_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1669 charset_type = Qw32_charset_hangeul; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1670 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1671 case GB2312_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1672 charset_type = Qw32_charset_gb2312; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1673 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1674 case CHINESEBIG5_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1675 charset_type = Qw32_charset_chinesebig5; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1676 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1677 case OEM_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1678 charset_type = Qw32_charset_oem; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1679 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1680 case EASTEUROPE_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1681 charset_type = Qw32_charset_easteurope; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1682 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1683 case TURKISH_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1684 charset_type = Qw32_charset_turkish; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1685 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1686 case BALTIC_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1687 charset_type = Qw32_charset_baltic; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1688 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1689 case RUSSIAN_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1690 charset_type = Qw32_charset_russian; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1691 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1692 case ARABIC_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1693 charset_type = Qw32_charset_arabic; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1694 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1695 case GREEK_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1696 charset_type = Qw32_charset_greek; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1697 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1698 case HEBREW_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1699 charset_type = Qw32_charset_hebrew; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1700 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1701 case VIETNAMESE_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1702 charset_type = Qw32_charset_vietnamese; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1703 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1704 case THAI_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1705 charset_type = Qw32_charset_thai; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1706 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1707 case MAC_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1708 charset_type = Qw32_charset_mac; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1709 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1710 case JOHAB_CHARSET: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1711 charset_type = Qw32_charset_johab; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1712 break; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1713 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1714 default: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1715 /* Encode numerical value of unknown charset. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1716 sprintf (buf, "*-#%u", fncharset); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1717 return buf; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1718 } |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1719 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1720 { |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1721 Lisp_Object rest; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1722 char * best_match = NULL; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1723 int matching_found = 0; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1724 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1725 /* Look through w32-charset-info-alist for the character set. |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1726 Prefer ISO codepages, and prefer lower numbers in the ISO |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1727 range. Only return charsets for codepages which are installed. |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1728 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1729 Format of each entry is |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1730 (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)). |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1731 */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1732 for (rest = Vw32_charset_info_alist; CONSP (rest); rest = XCDR (rest)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1733 { |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1734 char * x_charset; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1735 Lisp_Object w32_charset; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1736 Lisp_Object codepage; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1737 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1738 Lisp_Object this_entry = XCAR (rest); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1739 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1740 /* Skip invalid entries in alist. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1741 if (!CONSP (this_entry) || !STRINGP (XCAR (this_entry)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1742 || !CONSP (XCDR (this_entry)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1743 || !SYMBOLP (XCAR (XCDR (this_entry)))) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1744 continue; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1745 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1746 x_charset = SDATA (XCAR (this_entry)); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1747 w32_charset = XCAR (XCDR (this_entry)); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1748 codepage = XCDR (XCDR (this_entry)); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1749 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1750 /* Look for Same charset and a valid codepage (or non-int |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1751 which means ignore). */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1752 if (EQ (w32_charset, charset_type) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1753 && (!INTEGERP (codepage) || XINT (codepage) == CP_DEFAULT |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1754 || IsValidCodePage (XINT (codepage)))) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1755 { |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1756 /* If we don't have a match already, then this is the |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1757 best. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1758 if (!best_match) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1759 { |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1760 best_match = x_charset; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1761 if (matching && !strnicmp (x_charset, matching, match_len)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1762 matching_found = 1; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1763 } |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1764 /* If we already found a match for MATCHING, then |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1765 only consider other matches. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1766 else if (matching_found |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1767 && strnicmp (x_charset, matching, match_len)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1768 continue; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1769 /* If this matches what we want, and the best so far doesn't, |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1770 then this is better. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1771 else if (!matching_found && matching |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1772 && !strnicmp (x_charset, matching, match_len)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1773 { |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1774 best_match = x_charset; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1775 matching_found = 1; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1776 } |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1777 /* If this is fully specified, and the best so far isn't, |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1778 then this is better. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1779 else if ((!strchr (best_match, '-') && strchr (x_charset, '-')) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1780 /* If this is an ISO codepage, and the best so far isn't, |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1781 then this is better, but only if it fully specifies the |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1782 encoding. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1783 || (strnicmp (best_match, "iso", 3) != 0 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1784 && strnicmp (x_charset, "iso", 3) == 0 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1785 && strchr (x_charset, '-'))) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1786 best_match = x_charset; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1787 /* If both are ISO8859 codepages, choose the one with the |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1788 lowest number in the encoding field. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1789 else if (strnicmp (best_match, "iso8859-", 8) == 0 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1790 && strnicmp (x_charset, "iso8859-", 8) == 0) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1791 { |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1792 int best_enc = atoi (best_match + 8); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1793 int this_enc = atoi (x_charset + 8); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1794 if (this_enc > 0 && this_enc < best_enc) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1795 best_match = x_charset; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1796 } |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1797 } |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1798 } |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1799 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1800 /* If no match, encode the numeric value. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1801 if (!best_match) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1802 { |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1803 sprintf (buf, "*-#%u", fncharset); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1804 return buf; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1805 } |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1806 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1807 strncpy (buf, best_match, 31); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1808 /* If the charset is not fully specified, put -0 on the end. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1809 if (!strchr (best_match, '-')) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1810 { |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1811 int pos = strlen (best_match); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1812 /* Charset specifiers shouldn't be very long. If it is a made |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1813 up one, truncating it should not do any harm since it isn't |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1814 recognized anyway. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1815 if (pos > 29) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1816 pos = 29; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1817 strcpy (buf + pos, "-0"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1818 } |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1819 buf[31] = '\0'; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1820 return buf; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1821 } |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1822 } |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
1823 |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1824 static Lisp_Object |
92539
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1825 w32_registry (w32_charset, font_type) |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1826 LONG w32_charset; |
92539
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1827 DWORD font_type; |
90869 | 1828 { |
95468
19ee88719d52
(w32_enumfont_pattern_entity): Use requested registry.
Jason Rumney <jasonr@gnu.org>
parents:
95388
diff
changeset
|
1829 char *charset; |
92539
d4cf72c99c2f
(w32_registry): Take font_type argument. Use ANSI
Jason Rumney <jasonr@gnu.org>
parents:
92472
diff
changeset
|
1830 |
95468
19ee88719d52
(w32_enumfont_pattern_entity): Use requested registry.
Jason Rumney <jasonr@gnu.org>
parents:
95388
diff
changeset
|
1831 /* If charset is defaulted, charset is unicode or unknown, depending on |
19ee88719d52
(w32_enumfont_pattern_entity): Use requested registry.
Jason Rumney <jasonr@gnu.org>
parents:
95388
diff
changeset
|
1832 font type. */ |
19ee88719d52
(w32_enumfont_pattern_entity): Use requested registry.
Jason Rumney <jasonr@gnu.org>
parents:
95388
diff
changeset
|
1833 if (w32_charset == DEFAULT_CHARSET) |
19ee88719d52
(w32_enumfont_pattern_entity): Use requested registry.
Jason Rumney <jasonr@gnu.org>
parents:
95388
diff
changeset
|
1834 return font_type == TRUETYPE_FONTTYPE ? Qiso10646_1 : Qunknown; |
19ee88719d52
(w32_enumfont_pattern_entity): Use requested registry.
Jason Rumney <jasonr@gnu.org>
parents:
95388
diff
changeset
|
1835 |
19ee88719d52
(w32_enumfont_pattern_entity): Use requested registry.
Jason Rumney <jasonr@gnu.org>
parents:
95388
diff
changeset
|
1836 charset = w32_to_x_charset (w32_charset, NULL); |
95744
abc12b93e2dd
(add_font_name_to_list): Adjusted for
Kenichi Handa <handa@m17n.org>
parents:
95468
diff
changeset
|
1837 return font_intern_prop (charset, strlen(charset), 1); |
90869 | 1838 } |
1839 | |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1840 static int |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1841 w32_decode_weight (fnweight) |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1842 int fnweight; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1843 { |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1844 if (fnweight >= FW_HEAVY) return 210; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1845 if (fnweight >= FW_EXTRABOLD) return 205; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1846 if (fnweight >= FW_BOLD) return 200; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1847 if (fnweight >= FW_SEMIBOLD) return 180; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1848 if (fnweight >= FW_NORMAL) return 100; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1849 if (fnweight >= FW_LIGHT) return 50; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1850 if (fnweight >= FW_EXTRALIGHT) return 40; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1851 if (fnweight > FW_THIN) return 20; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1852 return 0; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1853 } |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1854 |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1855 static int |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1856 w32_encode_weight (n) |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1857 int n; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1858 { |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1859 if (n >= 210) return FW_HEAVY; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1860 if (n >= 205) return FW_EXTRABOLD; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1861 if (n >= 200) return FW_BOLD; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1862 if (n >= 180) return FW_SEMIBOLD; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1863 if (n >= 100) return FW_NORMAL; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1864 if (n >= 50) return FW_LIGHT; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1865 if (n >= 40) return FW_EXTRALIGHT; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1866 if (n >= 20) return FW_THIN; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1867 return 0; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1868 } |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1869 |
96005
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
1870 /* Convert a Windows font weight into one of the weights supported |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
1871 by fontconfig (see font.c:font_parse_fcname). */ |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
1872 static Lisp_Object |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
1873 w32_to_fc_weight (n) |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
1874 int n; |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
1875 { |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
1876 if (n >= FW_EXTRABOLD) return intern ("black"); |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
1877 if (n >= FW_BOLD) return intern ("bold"); |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
1878 if (n >= FW_SEMIBOLD) return intern ("demibold"); |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
1879 if (n >= FW_NORMAL) return intern ("medium"); |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
1880 return intern ("light"); |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
1881 } |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
1882 |
90869 | 1883 /* 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
|
1884 static void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1885 fill_in_logfont (f, logfont, font_spec) |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1886 FRAME_PTR f; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1887 LOGFONT *logfont; |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
1888 Lisp_Object font_spec; |
90869 | 1889 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1890 Lisp_Object tmp, extra; |
90869 | 1891 int dpi = FRAME_W32_DISPLAY_INFO (f)->resy; |
1892 | |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1893 tmp = AREF (font_spec, FONT_DPI_INDEX); |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1894 if (INTEGERP (tmp)) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1895 { |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1896 dpi = XINT (tmp); |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1897 } |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1898 else if (FLOATP (tmp)) |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1899 { |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1900 dpi = (int) (XFLOAT_DATA (tmp) + 0.5); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1901 } |
90869 | 1902 |
1903 /* Height */ | |
1904 tmp = AREF (font_spec, FONT_SIZE_INDEX); | |
1905 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
|
1906 logfont->lfHeight = -1 * XINT (tmp); |
90869 | 1907 else if (FLOATP (tmp)) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1908 logfont->lfHeight = (int) (-1.0 * dpi * XFLOAT_DATA (tmp) / 72.27 + 0.5); |
90869 | 1909 |
1910 /* Escapement */ | |
1911 | |
1912 /* Orientation */ | |
1913 | |
1914 /* Weight */ | |
1915 tmp = AREF (font_spec, FONT_WEIGHT_INDEX); | |
1916 if (INTEGERP (tmp)) | |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1917 logfont->lfWeight = w32_encode_weight (FONT_WEIGHT_NUMERIC (font_spec)); |
90869 | 1918 |
1919 /* Italic */ | |
1920 tmp = AREF (font_spec, FONT_SLANT_INDEX); | |
1921 if (INTEGERP (tmp)) | |
1922 { | |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1923 int slant = FONT_SLANT_NUMERIC (font_spec); |
90869 | 1924 logfont->lfItalic = slant > 150 ? 1 : 0; |
1925 } | |
1926 | |
1927 /* Underline */ | |
1928 | |
1929 /* Strikeout */ | |
1930 | |
1931 /* Charset */ | |
1932 tmp = AREF (font_spec, FONT_REGISTRY_INDEX); | |
1933 if (! NILP (tmp)) | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1934 logfont->lfCharSet = registry_to_w32_charset (tmp); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1935 else |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
1936 logfont->lfCharSet = DEFAULT_CHARSET; |
90869 | 1937 |
1938 /* Out Precision */ | |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1939 |
90869 | 1940 /* Clip Precision */ |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1941 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
1942 /* Quality */ |
90879
82b86c925f88
* w32font.c (w32font_open): Handle size, height and pixel_size better.
Jason Rumney <jasonr@gnu.org>
parents:
90869
diff
changeset
|
1943 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
|
1944 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1945 /* Generic Family and Face Name */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1946 logfont->lfPitchAndFamily = FF_DONTCARE | DEFAULT_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1947 |
90869 | 1948 tmp = AREF (font_spec, FONT_FAMILY_INDEX); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1949 if (! NILP (tmp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1950 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1951 logfont->lfPitchAndFamily = w32_generic_family (tmp) | DEFAULT_PITCH; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1952 if ((logfont->lfPitchAndFamily & 0xF0) != FF_DONTCARE) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1953 ; /* Font name was generic, don't fill in font name. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1954 /* 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
|
1955 user input. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1956 else if (SYMBOLP (tmp)) |
100409
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
1957 strncpy (logfont->lfFaceName, |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
1958 SDATA (ENCODE_SYSTEM (SYMBOL_NAME (tmp))), LF_FACESIZE); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1959 } |
90869 | 1960 |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1961 tmp = AREF (font_spec, FONT_ADSTYLE_INDEX); |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1962 if (!NILP (tmp)) |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1963 { |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1964 /* Override generic family. */ |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1965 BYTE family = w32_generic_family (tmp); |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1966 if (family != FF_DONTCARE) |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1967 logfont->lfPitchAndFamily = family | DEFAULT_PITCH; |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1968 } |
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
1969 |
95341
5602389abb69
(compute_metrics): Rewrite an "else { if () ... else ... }"
Juanma Barranquero <lekktu@gmail.com>
parents:
95339
diff
changeset
|
1970 |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1971 /* Set pitch based on the spacing property. */ |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1972 tmp = AREF (font_spec, FONT_SPACING_INDEX); |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1973 if (INTEGERP (tmp)) |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1974 { |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1975 int spacing = XINT (tmp); |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1976 if (spacing < FONT_SPACING_MONO) |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1977 logfont->lfPitchAndFamily |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1978 = logfont->lfPitchAndFamily & 0xF0 | VARIABLE_PITCH; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1979 else |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1980 logfont->lfPitchAndFamily |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1981 = logfont->lfPitchAndFamily & 0xF0 | FIXED_PITCH; |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1982 } |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1983 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1984 /* Process EXTRA info. */ |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1985 for (extra = AREF (font_spec, FONT_EXTRA_INDEX); |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1986 CONSP (extra); extra = XCDR (extra)) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1987 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1988 tmp = XCAR (extra); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1989 if (CONSP (tmp)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1990 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1991 Lisp_Object key, val; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1992 key = XCAR (tmp), val = XCDR (tmp); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1993 /* 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
|
1994 and a single script is specified. This is rather crude, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
1995 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
|
1996 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
|
1997 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
|
1998 them. */ |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
1999 if (EQ (key, QCscript) |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2000 && logfont->lfCharSet == DEFAULT_CHARSET |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2001 && SYMBOLP (val)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2002 { |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2003 if (EQ (val, Qgreek)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2004 logfont->lfCharSet = GREEK_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2005 else if (EQ (val, Qhangul)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2006 logfont->lfCharSet = HANGUL_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2007 else if (EQ (val, Qkana) || EQ (val, Qkanbun)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2008 logfont->lfCharSet = SHIFTJIS_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2009 else if (EQ (val, Qbopomofo)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2010 logfont->lfCharSet = CHINESEBIG5_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2011 /* GB 18030 supports tibetan, yi, mongolian, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2012 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
|
2013 GB2312 fonts. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2014 else if (EQ (val, Qtibetan) || EQ (val, Qyi) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2015 || EQ (val, Qmongolian)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2016 logfont->lfCharSet = GB2312_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2017 else if (EQ (val, Qhebrew)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2018 logfont->lfCharSet = HEBREW_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2019 else if (EQ (val, Qarabic)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2020 logfont->lfCharSet = ARABIC_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2021 else if (EQ (val, Qthai)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2022 logfont->lfCharSet = THAI_CHARSET; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2023 } |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2024 else if (EQ (key, QCantialias) && SYMBOLP (val)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2025 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2026 logfont->lfQuality = w32_antialias_type (val); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2027 } |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2028 } |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2029 } |
90869 | 2030 } |
2031 | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
2032 static void |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2033 list_all_matching_fonts (match_data) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2034 struct font_callback_data *match_data; |
90869 | 2035 { |
2036 HDC dc; | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2037 Lisp_Object families = w32font_list_family (match_data->frame); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2038 struct frame *f = XFRAME (match_data->frame); |
90869 | 2039 |
2040 dc = get_frame_dc (f); | |
2041 | |
2042 while (!NILP (families)) | |
2043 { | |
100409
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
2044 /* Only fonts from the current locale are given localized names |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
2045 on Windows, so we can keep backwards compatibility with |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
2046 Windows 9x/ME by using non-Unicode font enumeration without |
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
2047 sacrificing internationalization here. */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2048 char *name; |
90869 | 2049 Lisp_Object family = CAR (families); |
2050 families = CDR (families); | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2051 if (NILP (family)) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2052 continue; |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2053 else if (SYMBOLP (family)) |
100409
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
2054 name = SDATA (ENCODE_SYSTEM (SYMBOL_NAME (family))); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2055 else |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2056 continue; |
90869 | 2057 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2058 strncpy (match_data->pattern.lfFaceName, name, LF_FACESIZE); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2059 match_data->pattern.lfFaceName[LF_FACESIZE - 1] = '\0'; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2060 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2061 EnumFontFamiliesEx (dc, &match_data->pattern, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2062 (FONTENUMPROC) add_font_entity_to_list, |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2063 (LPARAM) match_data, 0); |
90869 | 2064 } |
2065 | |
2066 release_frame_dc (f, dc); | |
2067 } | |
2068 | |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2069 static Lisp_Object |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2070 lispy_antialias_type (type) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2071 BYTE type; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2072 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2073 Lisp_Object lispy; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2074 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2075 switch (type) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2076 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2077 case NONANTIALIASED_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2078 lispy = Qnone; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2079 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2080 case ANTIALIASED_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2081 lispy = Qstandard; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2082 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2083 case CLEARTYPE_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2084 lispy = Qsubpixel; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2085 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2086 case CLEARTYPE_NATURAL_QUALITY: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2087 lispy = Qnatural; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2088 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2089 default: |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2090 lispy = Qnil; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2091 break; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2092 } |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2093 return lispy; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2094 } |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2095 |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2096 /* Convert antialiasing symbols to lfQuality */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2097 static BYTE |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2098 w32_antialias_type (type) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2099 Lisp_Object type; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2100 { |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2101 if (EQ (type, Qnone)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2102 return NONANTIALIASED_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2103 else if (EQ (type, Qstandard)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2104 return ANTIALIASED_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2105 else if (EQ (type, Qsubpixel)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2106 return CLEARTYPE_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2107 else if (EQ (type, Qnatural)) |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2108 return CLEARTYPE_NATURAL_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2109 else |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2110 return DEFAULT_QUALITY; |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2111 } |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2112 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2113 /* 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
|
2114 static Lisp_Object |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2115 font_supported_scripts (FONTSIGNATURE * sig) |
90869 | 2116 { |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2117 DWORD * subranges = sig->fsUsb; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2118 Lisp_Object supported = Qnil; |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2119 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2120 /* 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
|
2121 #define SUBRANGE(n,sym) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2122 if (subranges[(n) / 32] & (1 << ((n) % 32))) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2123 supported = Fcons ((sym), supported) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2124 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2125 /* 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
|
2126 subranges[0 - 3]. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2127 #define MASK_ANY(mask0,mask1,mask2,mask3,sym) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2128 if ((subranges[0] & (mask0)) || (subranges[1] & (mask1)) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2129 || (subranges[2] & (mask2)) || (subranges[3] & (mask3))) \ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2130 supported = Fcons ((sym), supported) |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2131 |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2132 SUBRANGE (0, Qlatin); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2133 /* 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
|
2134 so don't need to mark them separately. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2135 /* 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
|
2136 SUBRANGE (4, Qphonetic); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2137 /* 5: Spacing and tone modifiers, 6: Combining Diacriticals. */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2138 SUBRANGE (7, Qgreek); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2139 SUBRANGE (8, Qcoptic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2140 SUBRANGE (9, Qcyrillic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2141 SUBRANGE (10, Qarmenian); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2142 SUBRANGE (11, Qhebrew); |
100323 | 2143 /* 12: Vai. */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2144 SUBRANGE (13, Qarabic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2145 SUBRANGE (14, Qnko); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2146 SUBRANGE (15, Qdevanagari); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2147 SUBRANGE (16, Qbengali); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2148 SUBRANGE (17, Qgurmukhi); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2149 SUBRANGE (18, Qgujarati); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2150 SUBRANGE (19, Qoriya); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2151 SUBRANGE (20, Qtamil); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2152 SUBRANGE (21, Qtelugu); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2153 SUBRANGE (22, Qkannada); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2154 SUBRANGE (23, Qmalayalam); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2155 SUBRANGE (24, Qthai); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2156 SUBRANGE (25, Qlao); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2157 SUBRANGE (26, Qgeorgian); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2158 SUBRANGE (27, Qbalinese); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2159 /* 28: Hangul Jamo. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2160 /* 29: Latin Extended, 30: Greek Extended, 31: Punctuation. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2161 /* 32-47: Symbols (defined below). */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2162 SUBRANGE (48, Qcjk_misc); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2163 /* Match either 49: katakana or 50: hiragana for kana. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2164 MASK_ANY (0, 0x00060000, 0, 0, Qkana); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2165 SUBRANGE (51, Qbopomofo); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2166 /* 52: Compatibility Jamo */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2167 SUBRANGE (53, Qphags_pa); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2168 /* 54: Enclosed CJK letters and months, 55: CJK Compatibility. */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2169 SUBRANGE (56, Qhangul); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2170 /* 57: Surrogates. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2171 SUBRANGE (58, Qphoenician); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2172 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
|
2173 SUBRANGE (59, Qideographic_description); /* Windows lumps this in. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2174 SUBRANGE (59, Qkanbun); /* And this. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2175 /* 60: Private use, 61: CJK strokes and compatibility. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2176 /* 62: Alphabetic Presentation, 63: Arabic Presentation A. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2177 /* 64: Combining half marks, 65: Vertical and CJK compatibility. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2178 /* 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
|
2179 /* 69: Specials. */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2180 SUBRANGE (70, Qtibetan); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2181 SUBRANGE (71, Qsyriac); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2182 SUBRANGE (72, Qthaana); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2183 SUBRANGE (73, Qsinhala); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2184 SUBRANGE (74, Qmyanmar); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2185 SUBRANGE (75, Qethiopic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2186 SUBRANGE (76, Qcherokee); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2187 SUBRANGE (77, Qcanadian_aboriginal); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2188 SUBRANGE (78, Qogham); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2189 SUBRANGE (79, Qrunic); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2190 SUBRANGE (80, Qkhmer); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2191 SUBRANGE (81, Qmongolian); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2192 SUBRANGE (82, Qbraille); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2193 SUBRANGE (83, Qyi); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2194 SUBRANGE (84, Qbuhid); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2195 SUBRANGE (84, Qhanunoo); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2196 SUBRANGE (84, Qtagalog); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2197 SUBRANGE (84, Qtagbanwa); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2198 SUBRANGE (85, Qold_italic); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2199 SUBRANGE (86, Qgothic); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2200 SUBRANGE (87, Qdeseret); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2201 SUBRANGE (88, Qbyzantine_musical_symbol); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2202 SUBRANGE (88, Qmusical_symbol); /* Windows doesn't distinguish these. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2203 SUBRANGE (89, Qmathematical); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2204 /* 90: Private use, 91: Variation selectors, 92: Tags. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2205 SUBRANGE (93, Qlimbu); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2206 SUBRANGE (94, Qtai_le); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2207 /* 95: New Tai Le */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2208 SUBRANGE (90, Qbuginese); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2209 SUBRANGE (97, Qglagolitic); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2210 SUBRANGE (98, Qtifinagh); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2211 /* 99: Yijing Hexagrams. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2212 SUBRANGE (100, Qsyloti_nagri); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2213 SUBRANGE (101, Qlinear_b); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2214 /* 102: Ancient Greek Numbers. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2215 SUBRANGE (103, Qugaritic); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2216 SUBRANGE (104, Qold_persian); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2217 SUBRANGE (105, Qshavian); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2218 SUBRANGE (106, Qosmanya); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2219 SUBRANGE (107, Qcypriot); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2220 SUBRANGE (108, Qkharoshthi); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2221 /* 109: Tai Xuan Jing. */ |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2222 SUBRANGE (110, Qcuneiform); |
100323 | 2223 /* 111: Counting Rods, 112: Sundanese, 113: Lepcha, 114: Ol Chiki. */ |
2224 /* 115: Saurashtra, 116: Kayah Li, 117: Rejang. */ | |
2225 SUBRANGE (118, Qcham); | |
2226 /* 119: Ancient symbols, 120: Phaistos Disc. */ | |
2227 /* 121: Carian, Lycian, Lydian, 122: Dominos, Mah Jong tiles. */ | |
2228 /* 123-127: Reserved. */ | |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2229 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2230 /* 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
|
2231 relevant range is set. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2232 MASK_ANY (0x8000000, 0x0000FFFF, 0, 0, Qsymbol); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2233 |
100323 | 2234 /* Missing: Tai Viet (U+AA80-U+AADF). */ |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2235 #undef SUBRANGE |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2236 #undef MASK_ANY |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2237 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2238 return supported; |
90869 | 2239 } |
2240 | |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2241 /* Generate a full name for a Windows font. |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2242 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
|
2243 specified if they are not "normal". */ |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2244 static int |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2245 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
|
2246 LOGFONT * font; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2247 Lisp_Object font_obj; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2248 int pixel_size; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2249 char *name; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2250 int nbytes; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2251 { |
92394
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
2252 int len, height, outline; |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2253 char *p; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2254 Lisp_Object antialiasing, weight = Qnil; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2255 |
92394
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
2256 len = strlen (font->lfFaceName); |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
2257 |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
2258 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
|
2259 |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
2260 /* 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
|
2261 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
|
2262 if (outline) |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
2263 len += 11; /* -SIZE */ |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
2264 else |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2265 len += 21; |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2266 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2267 if (font->lfItalic) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2268 len += 7; /* :italic */ |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2269 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2270 if (font->lfWeight && font->lfWeight != FW_NORMAL) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2271 { |
96005
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
2272 weight = w32_to_fc_weight (font->lfWeight); |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
2273 len += 1 + SBYTES (SYMBOL_NAME (weight)); /* :WEIGHT */ |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2274 } |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2275 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2276 antialiasing = lispy_antialias_type (font->lfQuality); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2277 if (! NILP (antialiasing)) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2278 len += 11 + SBYTES (SYMBOL_NAME (antialiasing)); /* :antialias=NAME */ |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2279 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2280 /* Check that the buffer is big enough */ |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2281 if (len > nbytes) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2282 return -1; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2283 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2284 p = name; |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2285 p += sprintf (p, "%s", font->lfFaceName); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2286 |
92394
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
2287 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
|
2288 |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
2289 if (height > 0) |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
2290 { |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
2291 if (outline) |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
2292 { |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
2293 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
|
2294 /* 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
|
2295 supported in MS library. */ |
fb1da73bc0c4
(w32font_full_name): Use floor to round.
Jason Rumney <jasonr@gnu.org>
parents:
92539
diff
changeset
|
2296 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
|
2297 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
|
2298 } |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
2299 else |
7701acfc2ec5
(w32font_full_name): Report point size for scalable fonts.
Jason Rumney <jasonr@gnu.org>
parents:
92390
diff
changeset
|
2300 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
|
2301 } |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2302 |
96005
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
2303 if (SYMBOLP (weight) && ! NILP (weight)) |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
2304 p += sprintf (p, ":%s", SDATA (SYMBOL_NAME (weight))); |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
2305 |
92390
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2306 if (font->lfItalic) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2307 p += sprintf (p, ":italic"); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2308 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2309 if (SYMBOLP (antialiasing) && ! NILP (antialiasing)) |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2310 p += sprintf (p, ":antialias=%s", SDATA (SYMBOL_NAME (antialiasing))); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2311 |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2312 return (p - name); |
9b14fb0bae09
(w32font_full_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
92199
diff
changeset
|
2313 } |
90869 | 2314 |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2315 /* Convert a logfont and point size into a fontconfig style font name. |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2316 POINTSIZE is in tenths of points. |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2317 If SIZE indicates the size of buffer FCNAME, into which the font name |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2318 is written. If the buffer is not large enough to contain the name, |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2319 the function returns -1, otherwise it returns the number of bytes |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2320 written to FCNAME. */ |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2321 static int logfont_to_fcname(font, pointsize, fcname, size) |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2322 LOGFONT* font; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2323 int pointsize; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2324 char *fcname; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2325 int size; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2326 { |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2327 int len, height; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2328 char *p = fcname; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2329 Lisp_Object weight = Qnil; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2330 |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2331 len = strlen (font->lfFaceName) + 2; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2332 height = pointsize / 10; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2333 while (height /= 10) |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2334 len++; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2335 |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2336 if (pointsize % 10) |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2337 len += 2; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2338 |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2339 if (font->lfItalic) |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2340 len += 7; /* :italic */ |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2341 if (font->lfWeight && font->lfWeight != FW_NORMAL) |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2342 { |
96005
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
2343 weight = w32_to_fc_weight (font->lfWeight); |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
2344 len += SBYTES (SYMBOL_NAME (weight)) + 1; |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2345 } |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2346 |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2347 if (len > size) |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2348 return -1; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2349 |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2350 p += sprintf (p, "%s-%d", font->lfFaceName, pointsize / 10); |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2351 if (pointsize % 10) |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2352 p += sprintf (p, ".%d", pointsize % 10); |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2353 |
96005
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
2354 if (SYMBOLP (weight) && !NILP (weight)) |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
2355 p += sprintf (p, ":%s", SDATA (SYMBOL_NAME (weight))); |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
95894
diff
changeset
|
2356 |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2357 if (font->lfItalic) |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2358 p += sprintf (p, ":italic"); |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2359 |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2360 return (p - fcname); |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2361 } |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
2362 |
95341
5602389abb69
(compute_metrics): Rewrite an "else { if () ... else ... }"
Juanma Barranquero <lekktu@gmail.com>
parents:
95339
diff
changeset
|
2363 static void |
5602389abb69
(compute_metrics): Rewrite an "else { if () ... else ... }"
Juanma Barranquero <lekktu@gmail.com>
parents:
95339
diff
changeset
|
2364 compute_metrics (dc, w32_font, code, metrics) |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
2365 HDC dc; |
92411
133560a77a09
(recompute_cached_metrics): Change font arg to w32font_info.
Jason Rumney <jasonr@gnu.org>
parents:
92409
diff
changeset
|
2366 struct w32font_info *w32_font; |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2367 unsigned int code; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2368 struct w32_metric_cache *metrics; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
2369 { |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
2370 GLYPHMETRICS gm; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
2371 MAT2 transform; |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2372 unsigned int options = GGO_METRICS; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2373 |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2374 if (w32_font->glyph_idx) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2375 options |= GGO_GLYPH_INDEX; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
2376 |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
2377 bzero (&transform, sizeof (transform)); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
2378 transform.eM11.value = 1; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
2379 transform.eM22.value = 1; |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
2380 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2381 if (GetGlyphOutlineW (dc, code, options, &gm, 0, NULL, &transform) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2382 != GDI_ERROR) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2383 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2384 metrics->lbearing = gm.gmptGlyphOrigin.x; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2385 metrics->rbearing = gm.gmptGlyphOrigin.x + gm.gmBlackBoxX; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2386 metrics->width = gm.gmCellIncX; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2387 metrics->status = W32METRIC_SUCCESS; |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
2388 } |
95341
5602389abb69
(compute_metrics): Rewrite an "else { if () ... else ... }"
Juanma Barranquero <lekktu@gmail.com>
parents:
95339
diff
changeset
|
2389 else |
5602389abb69
(compute_metrics): Rewrite an "else { if () ... else ... }"
Juanma Barranquero <lekktu@gmail.com>
parents:
95339
diff
changeset
|
2390 metrics->status = W32METRIC_FAIL; |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2391 } |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2392 |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2393 static void |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2394 clear_cached_metrics (w32_font) |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2395 struct w32font_info *w32_font; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2396 { |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2397 int i; |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2398 for (i = 0; i < w32_font->n_cache_blocks; i++) |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
2399 { |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
2400 if (w32_font->cached_metrics[i]) |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
2401 bzero (w32_font->cached_metrics[i], |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
2402 CACHE_BLOCKSIZE * sizeof (struct font_metrics)); |
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
2403 } |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
2404 } |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
2405 |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2406 DEFUN ("x-select-font", Fx_select_font, Sx_select_font, 0, 2, 0, |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2407 doc: /* Read a font name using a W32 font selection dialog. |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2408 Return fontconfig style font string corresponding to the selection. |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2409 |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2410 If FRAME is omitted or nil, it defaults to the selected frame. |
96997
8e0048b7af16
(Fx_select_font): Reverse sense of second arg.
Jason Rumney <jasonr@gnu.org>
parents:
96937
diff
changeset
|
2411 If EXCLUDE-PROPORTIONAL is non-nil, exclude proportional fonts |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2412 in the font selection dialog. */) |
96997
8e0048b7af16
(Fx_select_font): Reverse sense of second arg.
Jason Rumney <jasonr@gnu.org>
parents:
96937
diff
changeset
|
2413 (frame, exclude_proportional) |
8e0048b7af16
(Fx_select_font): Reverse sense of second arg.
Jason Rumney <jasonr@gnu.org>
parents:
96937
diff
changeset
|
2414 Lisp_Object frame, exclude_proportional; |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2415 { |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2416 FRAME_PTR f = check_x_frame (frame); |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2417 CHOOSEFONT cf; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2418 LOGFONT lf; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2419 TEXTMETRIC tm; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2420 HDC hdc; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2421 HANDLE oldobj; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2422 char buf[100]; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2423 |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2424 bzero (&cf, sizeof (cf)); |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2425 bzero (&lf, sizeof (lf)); |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2426 |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2427 cf.lStructSize = sizeof (cf); |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2428 cf.hwndOwner = FRAME_W32_WINDOW (f); |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2429 cf.Flags = CF_FORCEFONTEXIST | CF_SCREENFONTS | CF_NOVERTFONTS; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2430 |
96997
8e0048b7af16
(Fx_select_font): Reverse sense of second arg.
Jason Rumney <jasonr@gnu.org>
parents:
96937
diff
changeset
|
2431 /* If exclude_proportional is non-nil, limit the selection to |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2432 monospaced fonts. */ |
96997
8e0048b7af16
(Fx_select_font): Reverse sense of second arg.
Jason Rumney <jasonr@gnu.org>
parents:
96937
diff
changeset
|
2433 if (!NILP (exclude_proportional)) |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2434 cf.Flags |= CF_FIXEDPITCHONLY; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2435 |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2436 cf.lpLogFont = &lf; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2437 |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2438 /* Initialize as much of the font details as we can from the current |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2439 default font. */ |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2440 hdc = GetDC (FRAME_W32_WINDOW (f)); |
96343
5c8f2b7d28ae
* w32font.h (FONT_HANDLE, FONT_TEXTMETRIC): New macros.
Jason Rumney <jasonr@gnu.org>
parents:
96327
diff
changeset
|
2441 oldobj = SelectObject (hdc, FONT_HANDLE (FRAME_FONT (f))); |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2442 GetTextFace (hdc, LF_FACESIZE, lf.lfFaceName); |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2443 if (GetTextMetrics (hdc, &tm)) |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2444 { |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2445 lf.lfHeight = tm.tmInternalLeading - tm.tmHeight; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2446 lf.lfWeight = tm.tmWeight; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2447 lf.lfItalic = tm.tmItalic; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2448 lf.lfUnderline = tm.tmUnderlined; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2449 lf.lfStrikeOut = tm.tmStruckOut; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2450 lf.lfCharSet = tm.tmCharSet; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2451 cf.Flags |= CF_INITTOLOGFONTSTRUCT; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2452 } |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2453 SelectObject (hdc, oldobj); |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2454 ReleaseDC (FRAME_W32_WINDOW (f), hdc); |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2455 |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2456 if (!ChooseFont (&cf) |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2457 || logfont_to_fcname (&lf, cf.iPointSize, buf, 100) < 0) |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2458 return Qnil; |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2459 |
100409
4be3711ceff9
* w32font.c (intern_font_name): New function.
Jason Rumney <jasonr@gnu.org>
parents:
100359
diff
changeset
|
2460 return DECODE_SYSTEM (build_string (buf)); |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2461 } |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2462 |
90869 | 2463 struct font_driver w32font_driver = |
2464 { | |
90964 | 2465 0, /* Qgdi */ |
94914
73c093f08fa0
Throughout the file, delete all USE_FONT_BACKEND
Kenichi Handa <handa@m17n.org>
parents:
94082
diff
changeset
|
2466 0, /* case insensitive */ |
90869 | 2467 w32font_get_cache, |
2468 w32font_list, | |
2469 w32font_match, | |
2470 w32font_list_family, | |
2471 NULL, /* free_entity */ | |
2472 w32font_open, | |
2473 w32font_close, | |
2474 NULL, /* prepare_face */ | |
2475 NULL, /* done_face */ | |
2476 w32font_has_char, | |
2477 w32font_encode_char, | |
2478 w32font_text_extents, | |
2479 w32font_draw, | |
2480 NULL, /* get_bitmap */ | |
2481 NULL, /* free_bitmap */ | |
2482 NULL, /* get_outline */ | |
2483 NULL, /* free_outline */ | |
2484 NULL, /* anchor_point */ | |
2485 NULL, /* otf_capability */ | |
91158
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
2486 NULL, /* otf_drive */ |
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
2487 NULL, /* start_for_frame */ |
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
2488 NULL, /* end_for_frame */ |
5e7347695108
(w32font_driver): Add new fields.
Jason Rumney <jasonr@gnu.org>
parents:
91128
diff
changeset
|
2489 NULL /* shape */ |
90869 | 2490 }; |
2491 | |
2492 | |
2493 /* Initialize state that does not change between invocations. This is only | |
2494 called when Emacs is dumped. */ | |
90889
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
2495 void |
0df73c71020b
* w32font.c (QCsubranges): New symbol.
Jason Rumney <jasonr@gnu.org>
parents:
90887
diff
changeset
|
2496 syms_of_w32font () |
90869 | 2497 { |
90964 | 2498 DEFSYM (Qgdi, "gdi"); |
92409
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
2499 DEFSYM (Quniscribe, "uniscribe"); |
8171649adf8a
(Quniscribe, QCformat): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
92394
diff
changeset
|
2500 DEFSYM (QCformat, ":format"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2501 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2502 /* Generic font families. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2503 DEFSYM (Qmonospace, "monospace"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2504 DEFSYM (Qserif, "serif"); |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
2505 DEFSYM (Qsansserif, "sansserif"); |
90869 | 2506 DEFSYM (Qscript, "script"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2507 DEFSYM (Qdecorative, "decorative"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2508 /* Aliases. */ |
91260
75f89f349f70
(w32font_text_extents): Dereference selected_frame.
Jason Rumney <jasonr@gnu.org>
parents:
91259
diff
changeset
|
2509 DEFSYM (Qsans_serif, "sans_serif"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2510 DEFSYM (Qsans, "sans"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2511 DEFSYM (Qmono, "mono"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2512 |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2513 /* Fake foundries. */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2514 DEFSYM (Qraster, "raster"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2515 DEFSYM (Qoutline, "outline"); |
90869 | 2516 DEFSYM (Qunknown, "unknown"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2517 |
91124
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2518 /* Antialiasing. */ |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2519 DEFSYM (Qstandard, "standard"); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2520 DEFSYM (Qsubpixel, "subpixel"); |
b656aee8436b
(CLEARTYPE_QUALITY, CLEARTYPE_NATURAL_QUALITY): Define
Jason Rumney <jasonr@gnu.org>
parents:
91070
diff
changeset
|
2521 DEFSYM (Qnatural, "natural"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2522 |
93856
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2523 /* Languages */ |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2524 DEFSYM (Qzh, "zh"); |
833bbf13f09d
(Qja, Qko, Qzh): New symbols.
Jason Rumney <jasonr@gnu.org>
parents:
93675
diff
changeset
|
2525 |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2526 /* Scripts */ |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2527 DEFSYM (Qlatin, "latin"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2528 DEFSYM (Qgreek, "greek"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2529 DEFSYM (Qcoptic, "coptic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2530 DEFSYM (Qcyrillic, "cyrillic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2531 DEFSYM (Qarmenian, "armenian"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2532 DEFSYM (Qhebrew, "hebrew"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2533 DEFSYM (Qarabic, "arabic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2534 DEFSYM (Qsyriac, "syriac"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2535 DEFSYM (Qnko, "nko"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2536 DEFSYM (Qthaana, "thaana"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2537 DEFSYM (Qdevanagari, "devanagari"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2538 DEFSYM (Qbengali, "bengali"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2539 DEFSYM (Qgurmukhi, "gurmukhi"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2540 DEFSYM (Qgujarati, "gujarati"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2541 DEFSYM (Qoriya, "oriya"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2542 DEFSYM (Qtamil, "tamil"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2543 DEFSYM (Qtelugu, "telugu"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2544 DEFSYM (Qkannada, "kannada"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2545 DEFSYM (Qmalayalam, "malayalam"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2546 DEFSYM (Qsinhala, "sinhala"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2547 DEFSYM (Qthai, "thai"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2548 DEFSYM (Qlao, "lao"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2549 DEFSYM (Qtibetan, "tibetan"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2550 DEFSYM (Qmyanmar, "myanmar"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2551 DEFSYM (Qgeorgian, "georgian"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2552 DEFSYM (Qhangul, "hangul"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2553 DEFSYM (Qethiopic, "ethiopic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2554 DEFSYM (Qcherokee, "cherokee"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2555 DEFSYM (Qcanadian_aboriginal, "canadian-aboriginal"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2556 DEFSYM (Qogham, "ogham"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2557 DEFSYM (Qrunic, "runic"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2558 DEFSYM (Qkhmer, "khmer"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2559 DEFSYM (Qmongolian, "mongolian"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2560 DEFSYM (Qsymbol, "symbol"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2561 DEFSYM (Qbraille, "braille"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2562 DEFSYM (Qhan, "han"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2563 DEFSYM (Qideographic_description, "ideographic-description"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2564 DEFSYM (Qcjk_misc, "cjk-misc"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2565 DEFSYM (Qkana, "kana"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2566 DEFSYM (Qbopomofo, "bopomofo"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2567 DEFSYM (Qkanbun, "kanbun"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2568 DEFSYM (Qyi, "yi"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2569 DEFSYM (Qbyzantine_musical_symbol, "byzantine-musical-symbol"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2570 DEFSYM (Qmusical_symbol, "musical-symbol"); |
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2571 DEFSYM (Qmathematical, "mathematical"); |
100323 | 2572 DEFSYM (Qcham, "cham"); |
93598
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2573 DEFSYM (Qphonetic, "phonetic"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2574 DEFSYM (Qbalinese, "balinese"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2575 DEFSYM (Qbuginese, "buginese"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2576 DEFSYM (Qbuhid, "buhid"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2577 DEFSYM (Qcuneiform, "cuneiform"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2578 DEFSYM (Qcypriot, "cypriot"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2579 DEFSYM (Qdeseret, "deseret"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2580 DEFSYM (Qglagolitic, "glagolitic"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2581 DEFSYM (Qgothic, "gothic"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2582 DEFSYM (Qhanunoo, "hanunoo"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2583 DEFSYM (Qkharoshthi, "kharoshthi"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2584 DEFSYM (Qlimbu, "limbu"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2585 DEFSYM (Qlinear_b, "linear_b"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2586 DEFSYM (Qold_italic, "old_italic"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2587 DEFSYM (Qold_persian, "old_persian"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2588 DEFSYM (Qosmanya, "osmanya"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2589 DEFSYM (Qphags_pa, "phags-pa"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2590 DEFSYM (Qphoenician, "phoenician"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2591 DEFSYM (Qshavian, "shavian"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2592 DEFSYM (Qsyloti_nagri, "syloti_nagri"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2593 DEFSYM (Qtagalog, "tagalog"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2594 DEFSYM (Qtagbanwa, "tagbanwa"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2595 DEFSYM (Qtai_le, "tai_le"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2596 DEFSYM (Qtifinagh, "tifinagh"); |
6b92cdd67bfb
(Qbalinese, Qbuginese, Qbuhid, Qcuneiform, Qcypriot)
Jason Rumney <jasonr@gnu.org>
parents:
92712
diff
changeset
|
2597 DEFSYM (Qugaritic, "ugaritic"); |
90906
f8694254fa1d
(w32font_info): Remove subranges.
Jason Rumney <jasonr@gnu.org>
parents:
90898
diff
changeset
|
2598 |
96385
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2599 /* W32 font encodings. */ |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2600 DEFVAR_LISP ("w32-charset-info-alist", |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2601 &Vw32_charset_info_alist, |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2602 doc: /* Alist linking Emacs character sets to Windows fonts and codepages. |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2603 Each entry should be of the form: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2604 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2605 (CHARSET_NAME . (WINDOWS_CHARSET . CODEPAGE)) |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2606 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2607 where CHARSET_NAME is a string used in font names to identify the charset, |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2608 WINDOWS_CHARSET is a symbol that can be one of: |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2609 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2610 w32-charset-ansi, w32-charset-default, w32-charset-symbol, |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2611 w32-charset-shiftjis, w32-charset-hangeul, w32-charset-gb2312, |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2612 w32-charset-chinesebig5, w32-charset-johab, w32-charset-hebrew, |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2613 w32-charset-arabic, w32-charset-greek, w32-charset-turkish, |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2614 w32-charset-vietnamese, w32-charset-thai, w32-charset-easteurope, |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2615 w32-charset-russian, w32-charset-mac, w32-charset-baltic, |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2616 or w32-charset-oem. |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2617 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2618 CODEPAGE should be an integer specifying the codepage that should be used |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2619 to display the character set, t to do no translation and output as Unicode, |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2620 or nil to do no translation and output as 8 bit (or multibyte on far-east |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2621 versions of Windows) characters. */); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2622 Vw32_charset_info_alist = Qnil; |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2623 |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2624 DEFSYM (Qw32_charset_ansi, "w32-charset-ansi"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2625 DEFSYM (Qw32_charset_symbol, "w32-charset-symbol"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2626 DEFSYM (Qw32_charset_default, "w32-charset-default"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2627 DEFSYM (Qw32_charset_shiftjis, "w32-charset-shiftjis"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2628 DEFSYM (Qw32_charset_hangeul, "w32-charset-hangeul"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2629 DEFSYM (Qw32_charset_chinesebig5, "w32-charset-chinesebig5"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2630 DEFSYM (Qw32_charset_gb2312, "w32-charset-gb2312"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2631 DEFSYM (Qw32_charset_oem, "w32-charset-oem"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2632 DEFSYM (Qw32_charset_johab, "w32-charset-johab"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2633 DEFSYM (Qw32_charset_easteurope, "w32-charset-easteurope"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2634 DEFSYM (Qw32_charset_turkish, "w32-charset-turkish"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2635 DEFSYM (Qw32_charset_baltic, "w32-charset-baltic"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2636 DEFSYM (Qw32_charset_russian, "w32-charset-russian"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2637 DEFSYM (Qw32_charset_arabic, "w32-charset-arabic"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2638 DEFSYM (Qw32_charset_greek, "w32-charset-greek"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2639 DEFSYM (Qw32_charset_hebrew, "w32-charset-hebrew"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2640 DEFSYM (Qw32_charset_vietnamese, "w32-charset-vietnamese"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2641 DEFSYM (Qw32_charset_thai, "w32-charset-thai"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2642 DEFSYM (Qw32_charset_mac, "w32-charset-mac"); |
01647003e227
* w32fns.c (x_to_w32_font, w32_to_x_font, x_to_w32_weight)
Jason Rumney <jasonr@gnu.org>
parents:
96343
diff
changeset
|
2643 |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2644 defsubr (&Sx_select_font); |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95846
diff
changeset
|
2645 |
90964 | 2646 w32font_driver.type = Qgdi; |
90869 | 2647 register_font_driver (&w32font_driver, NULL); |
2648 } | |
90898 | 2649 |
2650 /* arch-tag: 65b8a3cd-46aa-4c0d-a1f3-99e75b9c07ee | |
2651 (do not change this comment) */ |