Mercurial > emacs
annotate src/font.c @ 103224:503993123ddc
Checked anti.texi, errors.texi, and maps.texi.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Thu, 14 May 2009 03:23:22 +0000 |
parents | cb1886d1427b |
children | 499a2bc2b600 |
rev | line source |
---|---|
90400 | 1 /* font.c -- "Font" primitives. |
100951 | 2 Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
3 Copyright (C) 2006, 2007, 2008, 2009 | |
90400 | 4 National Institute of Advanced Industrial Science and Technology (AIST) |
5 Registration Number H13PRO009 | |
6 | |
7 This file is part of GNU Emacs. | |
8 | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94926
diff
changeset
|
9 GNU Emacs is free software: you can redistribute it and/or modify |
90400 | 10 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:
94926
diff
changeset
|
11 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:
94926
diff
changeset
|
12 (at your option) any later version. |
90400 | 13 |
14 GNU Emacs is distributed in the hope that it will be useful, | |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 GNU General Public License for more details. | |
18 | |
19 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:
94926
diff
changeset
|
20 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
90400 | 21 |
22 #include <config.h> | |
23 #include <stdio.h> | |
24 #include <stdlib.h> | |
25 #include <ctype.h> | |
26 | |
27 #include "lisp.h" | |
28 #include "buffer.h" | |
29 #include "frame.h" | |
90541 | 30 #include "window.h" |
90400 | 31 #include "dispextern.h" |
32 #include "charset.h" | |
33 #include "character.h" | |
34 #include "composite.h" | |
35 #include "fontset.h" | |
36 #include "font.h" | |
37 | |
91909 | 38 #ifdef HAVE_X_WINDOWS |
39 #include "xterm.h" | |
40 #endif /* HAVE_X_WINDOWS */ | |
41 | |
42 #ifdef HAVE_NTGUI | |
43 #include "w32term.h" | |
44 #endif /* HAVE_NTGUI */ | |
45 | |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
46 #ifdef HAVE_NS |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
47 #include "nsterm.h" |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
48 #endif /* HAVE_NS */ |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
49 |
96831
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
50 #ifdef HAVE_NS |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
51 extern Lisp_Object Qfontsize; |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
52 #endif |
90400 | 53 |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
54 Lisp_Object Qopentype; |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
55 |
94926 | 56 /* Important character set strings. */ |
95699 | 57 Lisp_Object Qascii_0, Qiso8859_1, Qiso10646_1, Qunicode_bmp, Qunicode_sip; |
90439
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
58 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
59 #ifdef HAVE_NS |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
60 #define DEFAULT_ENCODING Qiso10646_1 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
61 #else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
62 #define DEFAULT_ENCODING Qiso8859_1 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
63 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
64 |
97822 | 65 /* Unicode category `Cf'. */ |
66 static Lisp_Object QCf; | |
67 | |
90400 | 68 /* Special vector of zero length. This is repeatedly used by (struct |
69 font_driver *)->list when a specified font is not found. */ | |
94926 | 70 static Lisp_Object null_vector; |
71 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
72 static Lisp_Object Vfont_weight_table, Vfont_slant_table, Vfont_width_table; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
73 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
74 /* Vector of Vfont_weight_table, Vfont_slant_table, and Vfont_width_table. */ |
90400 | 75 static Lisp_Object font_style_table; |
76 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
77 /* Structure used for tables mapping weight, slant, and width numeric |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
78 values and their names. */ |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
79 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
80 struct table_entry |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
81 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
82 int numeric; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
83 /* The first one is a valid name as a face attribute. |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
84 The second one (if any) is a typical name in XLFD field. */ |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
85 char *names[5]; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
86 Lisp_Object *symbols; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
87 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
88 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
89 /* Table of weight numeric values and their names. This table must be |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
90 sorted by numeric values in ascending order. */ |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
91 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
92 static struct table_entry weight_table[] = |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
93 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
94 { 0, { "thin" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
95 { 20, { "ultra-light", "ultralight" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
96 { 40, { "extra-light", "extralight" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
97 { 50, { "light" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
98 { 75, { "semi-light", "semilight", "demilight", "book" }}, |
102298
b666efc8e847
(font_style_to_value): Set value for unknown symbols to
Chong Yidong <cyd@stupidchicken.com>
parents:
102159
diff
changeset
|
99 { 100, { "normal", "medium", "regular", "unspecified" }}, |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
100 { 180, { "semi-bold", "semibold", "demibold", "demi" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
101 { 200, { "bold" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
102 { 205, { "extra-bold", "extrabold" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
103 { 210, { "ultra-bold", "ultrabold", "black" }} |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
104 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
105 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
106 /* Table of slant numeric values and their names. This table must be |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
107 sorted by numeric values in ascending order. */ |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
108 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
109 static struct table_entry slant_table[] = |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
110 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
111 { 0, { "reverse-oblique", "ro" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
112 { 10, { "reverse-italic", "ri" }}, |
102298
b666efc8e847
(font_style_to_value): Set value for unknown symbols to
Chong Yidong <cyd@stupidchicken.com>
parents:
102159
diff
changeset
|
113 { 100, { "normal", "r", "unspecified" }}, |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
114 { 200, { "italic" ,"i", "ot" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
115 { 210, { "oblique", "o" }} |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
116 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
117 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
118 /* Table of width numeric values and their names. This table must be |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
119 sorted by numeric values in ascending order. */ |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
120 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
121 static struct table_entry width_table[] = |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
122 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
123 { 50, { "ultra-condensed", "ultracondensed" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
124 { 63, { "extra-condensed", "extracondensed" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
125 { 75, { "condensed", "compressed", "narrow" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
126 { 87, { "semi-condensed", "semicondensed", "demicondensed" }}, |
102298
b666efc8e847
(font_style_to_value): Set value for unknown symbols to
Chong Yidong <cyd@stupidchicken.com>
parents:
102159
diff
changeset
|
127 { 100, { "normal", "medium", "regular", "unspecified" }}, |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
128 { 113, { "semi-expanded", "semiexpanded", "demiexpanded" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
129 { 125, { "expanded" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
130 { 150, { "extra-expanded", "extraexpanded" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
131 { 200, { "ultra-expanded", "ultraexpanded", "wide" }} |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
132 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
133 |
94926 | 134 extern Lisp_Object Qnormal; |
90400 | 135 |
136 /* Symbols representing keys of normal font properties. */ | |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
137 extern Lisp_Object QCtype, QCfamily, QCweight, QCslant, QCwidth; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
138 extern Lisp_Object QCheight, QCsize, QCname; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
139 |
94926 | 140 Lisp_Object QCfoundry, QCadstyle, QCregistry; |
90400 | 141 /* Symbols representing keys of font extra info. */ |
94926 | 142 Lisp_Object QCspacing, QCdpi, QCscalable, QCotf, QClang, QCscript, QCavgwidth; |
143 Lisp_Object QCantialias, QCfont_entity, QCfc_unknown_spec; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
144 /* Symbols representing values of font spacing property. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
145 Lisp_Object Qc, Qm, Qp, Qd; |
103011
8f0fbb48af5a
* font.c (Qja, Qko): Move definitions here from ftfont.c.
Chong Yidong <cyd@stupidchicken.com>
parents:
102990
diff
changeset
|
146 /* Special ADSTYLE properties to avoid fonts used for Latin |
8f0fbb48af5a
* font.c (Qja, Qko): Move definitions here from ftfont.c.
Chong Yidong <cyd@stupidchicken.com>
parents:
102990
diff
changeset
|
147 characters; used in xfont.c and ftfont.c. */ |
8f0fbb48af5a
* font.c (Qja, Qko): Move definitions here from ftfont.c.
Chong Yidong <cyd@stupidchicken.com>
parents:
102990
diff
changeset
|
148 Lisp_Object Qja, Qko; |
90400 | 149 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
150 Lisp_Object Vfont_encoding_alist; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
151 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
152 /* Alist of font registry symbol and the corresponding charsets |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
153 information. The information is retrieved from |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
154 Vfont_encoding_alist on demand. |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
155 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
156 Eash element has the form: |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
157 (REGISTRY . (ENCODING-CHARSET-ID . REPERTORY-CHARSET-ID)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
158 or |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
159 (REGISTRY . nil) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
160 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
161 In the former form, ENCODING-CHARSET-ID is an ID of a charset that |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
162 encodes a character code to a glyph code of a font, and |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
163 REPERTORY-CHARSET-ID is an ID of a charset that tells if a |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
164 character is supported by a font. |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
165 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
166 The latter form means that the information for REGISTRY couldn't be |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
167 retrieved. */ |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
168 static Lisp_Object font_charset_alist; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
169 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
170 /* List of all font drivers. Each font-backend (XXXfont.c) calls |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
171 register_font_driver in syms_of_XXXfont to register its font-driver |
90400 | 172 here. */ |
173 static struct font_driver_list *font_driver_list; | |
174 | |
94926 | 175 |
176 | |
177 /* Creaters of font-related Lisp object. */ | |
178 | |
179 Lisp_Object | |
180 font_make_spec () | |
181 { | |
182 Lisp_Object font_spec; | |
183 struct font_spec *spec | |
184 = ((struct font_spec *) | |
185 allocate_pseudovector (VECSIZE (struct font_spec), | |
186 FONT_SPEC_MAX, PVEC_FONT)); | |
187 XSETFONT (font_spec, spec); | |
188 return font_spec; | |
189 } | |
190 | |
191 Lisp_Object | |
192 font_make_entity () | |
193 { | |
194 Lisp_Object font_entity; | |
195 struct font_entity *entity | |
196 = ((struct font_entity *) | |
197 allocate_pseudovector (VECSIZE (struct font_entity), | |
198 FONT_ENTITY_MAX, PVEC_FONT)); | |
199 XSETFONT (font_entity, entity); | |
200 return font_entity; | |
201 } | |
202 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
203 /* Create a font-object whose structure size is SIZE. If ENTITY is |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
204 not nil, copy properties from ENTITY to the font-object. If |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
205 PIXELSIZE is positive, set the `size' property to PIXELSIZE. */ |
94926 | 206 Lisp_Object |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
207 font_make_object (size, entity, pixelsize) |
94926 | 208 int size; |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
209 Lisp_Object entity; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
210 int pixelsize; |
94926 | 211 { |
212 Lisp_Object font_object; | |
213 struct font *font | |
214 = (struct font *) allocate_pseudovector (size, FONT_OBJECT_MAX, PVEC_FONT); | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
215 int i; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
216 |
94926 | 217 XSETFONT (font_object, font); |
218 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
219 if (! NILP (entity)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
220 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
221 for (i = 1; i < FONT_SPEC_MAX; i++) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
222 font->props[i] = AREF (entity, i); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
223 if (! NILP (AREF (entity, FONT_EXTRA_INDEX))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
224 font->props[FONT_EXTRA_INDEX] |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
225 = Fcopy_sequence (AREF (entity, FONT_EXTRA_INDEX)); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
226 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
227 if (size > 0) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
228 font->props[FONT_SIZE_INDEX] = make_number (pixelsize); |
94926 | 229 return font_object; |
230 } | |
231 | |
232 | |
233 | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
234 static int font_pixel_size P_ ((FRAME_PTR f, Lisp_Object)); |
94926 | 235 static Lisp_Object font_open_entity P_ ((FRAME_PTR, Lisp_Object, int)); |
236 static Lisp_Object font_matching_entity P_ ((FRAME_PTR, Lisp_Object *, | |
90400 | 237 Lisp_Object)); |
238 | |
239 /* Number of registered font drivers. */ | |
240 static int num_font_drivers; | |
241 | |
94926 | 242 |
243 /* Return a Lispy value of a font property value at STR and LEN bytes. | |
244 If STR is "*", it returns nil. | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
245 If FORCE_SYMBOL is zero and all characters in STR are digits, it |
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
246 returns an integer. Otherwise, it returns a symbol interned from |
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
247 STR. */ |
94926 | 248 |
249 Lisp_Object | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
250 font_intern_prop (str, len, force_symbol) |
94926 | 251 char *str; |
252 int len; | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
253 int force_symbol; |
94926 | 254 { |
255 int i; | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
256 Lisp_Object tem; |
94926 | 257 Lisp_Object obarray; |
100759
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
258 int nbytes, nchars; |
94926 | 259 |
260 if (len == 1 && *str == '*') | |
261 return Qnil; | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
262 if (!force_symbol && len >=1 && isdigit (*str)) |
94926 | 263 { |
264 for (i = 1; i < len; i++) | |
265 if (! isdigit (str[i])) | |
266 break; | |
267 if (i == len) | |
268 return make_number (atoi (str)); | |
269 } | |
270 | |
100759
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
271 /* The following code is copied from the function intern (in |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
272 lread.c), and modified to suite our purpose. */ |
94926 | 273 obarray = Vobarray; |
274 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) | |
275 obarray = check_obarray (obarray); | |
100759
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
276 parse_str_as_multibyte (str, len, &nchars, &nbytes); |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
277 if (len == nchars || len != nbytes) |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
278 /* CONTENTS contains no multibyte sequences or contains an invalid |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
279 multibyte sequence. We'll make a unibyte string. */ |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
280 tem = oblookup (obarray, str, len, len); |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
281 else |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
282 tem = oblookup (obarray, str, nchars, len); |
94926 | 283 if (SYMBOLP (tem)) |
284 return tem; | |
100759
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
285 if (len == nchars || len != nbytes) |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
286 tem = make_unibyte_string (str, len); |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
287 else |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
288 tem = make_multibyte_string (str, nchars, len); |
fd802fcbb882
(font_intern_prop): Validate str as multibyte.
Kenichi Handa <handa@m17n.org>
parents:
100445
diff
changeset
|
289 return Fintern (tem, obarray); |
94926 | 290 } |
291 | |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
292 /* Return a pixel size of font-spec SPEC on frame F. */ |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
293 |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
294 static int |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
295 font_pixel_size (f, spec) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
296 FRAME_PTR f; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
297 Lisp_Object spec; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
298 { |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
299 #ifdef HAVE_WINDOW_SYSTEM |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
300 Lisp_Object size = AREF (spec, FONT_SIZE_INDEX); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
301 double point_size; |
94926 | 302 int dpi, pixel_size; |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
303 Lisp_Object val; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
304 |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
305 if (INTEGERP (size)) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
306 return XINT (size); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
307 if (NILP (size)) |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
308 return 0; |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
309 font_assert (FLOATP (size)); |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
310 point_size = XFLOAT_DATA (size); |
94926 | 311 val = AREF (spec, FONT_DPI_INDEX); |
312 if (INTEGERP (val)) | |
95483
d3cbd7d56845
(font_pixel_size): Don't take cdr of an integer.
Chong Yidong <cyd@stupidchicken.com>
parents:
95475
diff
changeset
|
313 dpi = XINT (val); |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
314 else |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
315 dpi = f->resy; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
316 pixel_size = POINT_TO_PIXEL (point_size, dpi); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
317 return pixel_size; |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
318 #else |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
319 return 1; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
320 #endif |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
321 } |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
322 |
94926 | 323 |
324 /* Return a value of PROP's VAL (symbol or integer) to be stored in a | |
325 font vector. If VAL is not valid (i.e. not registered in | |
326 font_style_table), return -1 if NOERROR is zero, and return a | |
327 proper index if NOERROR is nonzero. In that case, register VAL in | |
328 font_style_table if VAL is a symbol, and return a closest index if | |
329 VAL is an integer. */ | |
330 | |
331 int | |
332 font_style_to_value (prop, val, noerror) | |
90400 | 333 enum font_property_index prop; |
94926 | 334 Lisp_Object val; |
335 int noerror; | |
90400 | 336 { |
94926 | 337 Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX); |
338 int len = ASIZE (table); | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
339 int i, j; |
94926 | 340 |
341 if (SYMBOLP (val)) | |
90400 | 342 { |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
343 unsigned char *s; |
94926 | 344 Lisp_Object args[2], elt; |
345 | |
346 /* At first try exact match. */ | |
347 for (i = 0; i < len; i++) | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
348 for (j = 1; j < ASIZE (AREF (table, i)); j++) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
349 if (EQ (val, AREF (AREF (table, i), j))) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
350 return ((XINT (AREF (AREF (table, i), 0)) << 8) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
351 | (i << 4) | (j - 1)); |
94926 | 352 /* Try also with case-folding match. */ |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
353 s = SDATA (SYMBOL_NAME (val)); |
94926 | 354 for (i = 0; i < len; i++) |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
355 for (j = 1; j < ASIZE (AREF (table, i)); j++) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
356 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
357 elt = AREF (AREF (table, i), j); |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
358 if (xstrcasecmp (s, SDATA (SYMBOL_NAME (elt))) == 0) |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
359 return ((XINT (AREF (AREF (table, i), 0)) << 8) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
360 | (i << 4) | (j - 1)); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
361 } |
94926 | 362 if (! noerror) |
363 return -1; | |
364 if (len == 255) | |
365 abort (); | |
102298
b666efc8e847
(font_style_to_value): Set value for unknown symbols to
Chong Yidong <cyd@stupidchicken.com>
parents:
102159
diff
changeset
|
366 elt = Fmake_vector (make_number (2), make_number (100)); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
367 ASET (elt, 1, val); |
94926 | 368 args[0] = table; |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
369 args[1] = Fmake_vector (make_number (1), elt); |
94926 | 370 ASET (font_style_table, prop - FONT_WEIGHT_INDEX, Fvconcat (2, args)); |
102298
b666efc8e847
(font_style_to_value): Set value for unknown symbols to
Chong Yidong <cyd@stupidchicken.com>
parents:
102159
diff
changeset
|
371 return (100 << 8) | (i << 4); |
90400 | 372 } |
94926 | 373 else |
374 { | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
375 int i, last_n; |
94926 | 376 int numeric = XINT (val); |
377 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
378 for (i = 0, last_n = -1; i < len; i++) |
94926 | 379 { |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
380 int n = XINT (AREF (AREF (table, i), 0)); |
94926 | 381 |
382 if (numeric == n) | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
383 return (n << 8) | (i << 4); |
94926 | 384 if (numeric < n) |
385 { | |
386 if (! noerror) | |
387 return -1; | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
388 return ((i == 0 || n - numeric < numeric - last_n) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
389 ? (n << 8) | (i << 4): (last_n << 8 | ((i - 1) << 4))); |
94926 | 390 } |
391 last_n = n; | |
392 } | |
393 if (! noerror) | |
394 return -1; | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
395 return ((last_n << 8) | ((i - 1) << 4)); |
94926 | 396 } |
90400 | 397 } |
398 | |
399 Lisp_Object | |
96005
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
96000
diff
changeset
|
400 font_style_symbolic (font, prop, for_face) |
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
96000
diff
changeset
|
401 Lisp_Object font; |
94926 | 402 enum font_property_index prop; |
403 int for_face; | |
90400 | 404 { |
96005
66f0213be62a
Fix crashing bug in use of bold fonts from x-select-font on W32.
Jason Rumney <jasonr@gnu.org>
parents:
96000
diff
changeset
|
405 Lisp_Object val = AREF (font, prop); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
406 Lisp_Object table, elt; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
407 int i; |
94926 | 408 |
409 if (NILP (val)) | |
410 return Qnil; | |
411 table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX); | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
412 i = XINT (val) & 0xFF; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
413 font_assert (((i >> 4) & 0xF) < ASIZE (table)); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
414 elt = AREF (table, ((i >> 4) & 0xF)); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
415 font_assert ((i & 0xF) + 1 < ASIZE (elt)); |
100336
d53183123ad7
* font.c (Ffont_spec): Move usage to end of docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100173
diff
changeset
|
416 return (for_face ? AREF (elt, 1) : AREF (elt, (i & 0xF) + 1)); |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95890
diff
changeset
|
417 } |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95890
diff
changeset
|
418 |
90400 | 419 extern Lisp_Object Vface_alternative_font_family_alist; |
420 | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
421 extern Lisp_Object find_font_encoding P_ ((Lisp_Object)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
422 |
94926 | 423 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
424 /* Return ENCODING or a cons of ENCODING and REPERTORY of the font |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
425 FONTNAME. ENCODING is a charset symbol that specifies the encoding |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
426 of the font. REPERTORY is a charset symbol or nil. */ |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
427 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
428 Lisp_Object |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
429 find_font_encoding (fontname) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
430 Lisp_Object fontname; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
431 { |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
432 Lisp_Object tail, elt; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
433 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
434 for (tail = Vfont_encoding_alist; CONSP (tail); tail = XCDR (tail)) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
435 { |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
436 elt = XCAR (tail); |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
437 if (CONSP (elt) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
438 && STRINGP (XCAR (elt)) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
439 && fast_string_match_ignore_case (XCAR (elt), fontname) >= 0 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
440 && (SYMBOLP (XCDR (elt)) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
441 ? CHARSETP (XCDR (elt)) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
442 : CONSP (XCDR (elt)) && CHARSETP (XCAR (XCDR (elt))))) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
443 return (XCDR (elt)); |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
444 } |
102708
c8014e79191f
(find_font_encoding): Return Qnil for unsupported encoding.
Kenichi Handa <handa@m17n.org>
parents:
102483
diff
changeset
|
445 return Qnil; |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
446 } |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
447 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
448 /* Return encoding charset and repertory charset for REGISTRY in |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
449 ENCODING and REPERTORY correspondingly. If correct information for |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
450 REGISTRY is available, return 0. Otherwise return -1. */ |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
451 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
452 int |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
453 font_registry_charsets (registry, encoding, repertory) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
454 Lisp_Object registry; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
455 struct charset **encoding, **repertory; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
456 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
457 Lisp_Object val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
458 int encoding_id, repertory_id; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
459 |
94926 | 460 val = Fassoc_string (registry, font_charset_alist, Qt); |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
461 if (! NILP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
462 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
463 val = XCDR (val); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
464 if (NILP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
465 return -1; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
466 encoding_id = XINT (XCAR (val)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
467 repertory_id = XINT (XCDR (val)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
468 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
469 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
470 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
471 val = find_font_encoding (SYMBOL_NAME (registry)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
472 if (SYMBOLP (val) && CHARSETP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
473 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
474 encoding_id = repertory_id = XINT (CHARSET_SYMBOL_ID (val)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
475 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
476 else if (CONSP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
477 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
478 if (! CHARSETP (XCAR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
479 goto invalid_entry; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
480 encoding_id = XINT (CHARSET_SYMBOL_ID (XCAR (val))); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
481 if (NILP (XCDR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
482 repertory_id = -1; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
483 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
484 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
485 if (! CHARSETP (XCDR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
486 goto invalid_entry; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
487 repertory_id = XINT (CHARSET_SYMBOL_ID (XCDR (val))); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
488 } |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
489 } |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
490 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
491 goto invalid_entry; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
492 val = Fcons (make_number (encoding_id), make_number (repertory_id)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
493 font_charset_alist |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
494 = nconc2 (font_charset_alist, Fcons (Fcons (registry, val), Qnil)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
495 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
496 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
497 if (encoding) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
498 *encoding = CHARSET_FROM_ID (encoding_id); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
499 if (repertory) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
500 *repertory = repertory_id >= 0 ? CHARSET_FROM_ID (repertory_id) : NULL; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
501 return 0; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
502 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
503 invalid_entry: |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
504 font_charset_alist |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
505 = nconc2 (font_charset_alist, Fcons (Fcons (registry, Qnil), Qnil)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
506 return -1; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
507 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
508 |
90400 | 509 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
510 /* Font property value validaters. See the comment of |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
511 font_property_table for the meaning of the arguments. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
512 |
94926 | 513 static Lisp_Object font_prop_validate P_ ((int, Lisp_Object, Lisp_Object)); |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
514 static Lisp_Object font_prop_validate_symbol P_ ((Lisp_Object, Lisp_Object)); |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
515 static Lisp_Object font_prop_validate_style P_ ((Lisp_Object, Lisp_Object)); |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
516 static Lisp_Object font_prop_validate_non_neg P_ ((Lisp_Object, Lisp_Object)); |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
517 static Lisp_Object font_prop_validate_spacing P_ ((Lisp_Object, Lisp_Object)); |
94926 | 518 static int get_font_prop_index P_ ((Lisp_Object)); |
90400 | 519 |
520 static Lisp_Object | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
521 font_prop_validate_symbol (prop, val) |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
522 Lisp_Object prop, val; |
90400 | 523 { |
524 if (STRINGP (val)) | |
94926 | 525 val = Fintern (val, Qnil); |
526 if (! SYMBOLP (val)) | |
527 val = Qerror; | |
528 else if (EQ (prop, QCregistry)) | |
529 val = Fintern (Fdowncase (SYMBOL_NAME (val)), Qnil); | |
530 return val; | |
531 } | |
532 | |
533 | |
534 static Lisp_Object | |
535 font_prop_validate_style (style, val) | |
536 Lisp_Object style, val; | |
537 { | |
538 enum font_property_index prop = (EQ (style, QCweight) ? FONT_WEIGHT_INDEX | |
539 : EQ (style, QCslant) ? FONT_SLANT_INDEX | |
540 : FONT_WIDTH_INDEX); | |
541 int n; | |
542 if (INTEGERP (val)) | |
543 { | |
544 n = XINT (val); | |
95194
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
545 if (((n >> 4) & 0xF) |
94926 | 546 >= ASIZE (AREF (font_style_table, prop - FONT_WEIGHT_INDEX))) |
547 val = Qerror; | |
548 else | |
549 { | |
95194
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
550 Lisp_Object elt = AREF (AREF (font_style_table, prop - FONT_WEIGHT_INDEX), (n >> 4) & 0xF); |
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
551 |
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
552 if ((n & 0xF) + 1 >= ASIZE (elt)) |
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
553 val = Qerror; |
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
554 else if (XINT (AREF (elt, 0)) != (n >> 8)) |
94926 | 555 val = Qerror; |
556 } | |
557 } | |
90400 | 558 else if (SYMBOLP (val)) |
559 { | |
94926 | 560 int n = font_style_to_value (prop, val, 0); |
561 | |
562 val = n >= 0 ? make_number (n) : Qerror; | |
90400 | 563 } |
564 else | |
565 val = Qerror; | |
566 return val; | |
567 } | |
568 | |
569 static Lisp_Object | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
570 font_prop_validate_non_neg (prop, val) |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
571 Lisp_Object prop, val; |
90400 | 572 { |
573 return (NATNUMP (val) || (FLOATP (val) && XFLOAT_DATA (val) >= 0) | |
574 ? val : Qerror); | |
575 } | |
576 | |
577 static Lisp_Object | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
578 font_prop_validate_spacing (prop, val) |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
579 Lisp_Object prop, val; |
90400 | 580 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
581 if (NILP (val) || (NATNUMP (val) && XINT (val) <= FONT_SPACING_CHARCELL)) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
582 return val; |
95504
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
583 if (SYMBOLP (val) && SBYTES (SYMBOL_NAME (val)) == 1) |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
584 { |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
585 char spacing = SDATA (SYMBOL_NAME (val))[0]; |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
586 |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
587 if (spacing == 'c' || spacing == 'C') |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
588 return make_number (FONT_SPACING_CHARCELL); |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
589 if (spacing == 'm' || spacing == 'M') |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
590 return make_number (FONT_SPACING_MONO); |
95523
3c4256715c94
(font_prop_validate_spacing): Fix last change.
Andreas Schwab <schwab@suse.de>
parents:
95516
diff
changeset
|
591 if (spacing == 'p' || spacing == 'P') |
95504
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
592 return make_number (FONT_SPACING_PROPORTIONAL); |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
593 if (spacing == 'd' || spacing == 'D') |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
594 return make_number (FONT_SPACING_DUAL); |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
595 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
596 return Qerror; |
90400 | 597 } |
598 | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
599 static Lisp_Object |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
600 font_prop_validate_otf (prop, val) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
601 Lisp_Object prop, val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
602 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
603 Lisp_Object tail, tmp; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
604 int i; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
605 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
606 /* VAL = (SCRIPT [ LANGSYS [ GSUB-FEATURES [ GPOS-FEATURES ]]]) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
607 GSUB-FEATURES = (FEATURE ... [ nil FEATURE ... ]) | nil |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
608 GPOS-FEATURES = (FEATURE ... [ nil FEATURE ... ]) | nil */ |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
609 if (! CONSP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
610 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
611 if (! SYMBOLP (XCAR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
612 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
613 tail = XCDR (val); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
614 if (NILP (tail)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
615 return val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
616 if (! CONSP (tail) || ! SYMBOLP (XCAR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
617 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
618 for (i = 0; i < 2; i++) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
619 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
620 tail = XCDR (tail); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
621 if (NILP (tail)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
622 return val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
623 if (! CONSP (tail)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
624 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
625 for (tmp = XCAR (tail); CONSP (tmp); tmp = XCDR (tmp)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
626 if (! SYMBOLP (XCAR (tmp))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
627 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
628 if (! NILP (tmp)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
629 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
630 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
631 return val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
632 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
633 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
634 /* Structure of known font property keys and validater of the |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
635 values. */ |
90400 | 636 struct |
637 { | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
638 /* Pointer to the key symbol. */ |
90400 | 639 Lisp_Object *key; |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
640 /* Function to validate PROP's value VAL, or NULL if any value is |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
641 ok. The value is VAL or its regularized value if VAL is valid, |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
642 and Qerror if not. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
643 Lisp_Object (*validater) P_ ((Lisp_Object prop, Lisp_Object val)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
644 } font_property_table[] = |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
645 { { &QCtype, font_prop_validate_symbol }, |
90400 | 646 { &QCfoundry, font_prop_validate_symbol }, |
647 { &QCfamily, font_prop_validate_symbol }, | |
648 { &QCadstyle, font_prop_validate_symbol }, | |
649 { &QCregistry, font_prop_validate_symbol }, | |
650 { &QCweight, font_prop_validate_style }, | |
651 { &QCslant, font_prop_validate_style }, | |
652 { &QCwidth, font_prop_validate_style }, | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
653 { &QCsize, font_prop_validate_non_neg }, |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
654 { &QCdpi, font_prop_validate_non_neg }, |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
655 { &QCspacing, font_prop_validate_spacing }, |
94926 | 656 { &QCavgwidth, font_prop_validate_non_neg }, |
657 /* The order of the above entries must match with enum | |
658 font_property_index. */ | |
659 { &QClang, font_prop_validate_symbol }, | |
660 { &QCscript, font_prop_validate_symbol }, | |
661 { &QCotf, font_prop_validate_otf } | |
90400 | 662 }; |
663 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
664 /* Size (number of elements) of the above table. */ |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
665 #define FONT_PROPERTY_TABLE_SIZE \ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
666 ((sizeof font_property_table) / (sizeof *font_property_table)) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
667 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
668 /* Return an index number of font property KEY or -1 if KEY is not an |
94926 | 669 already known property. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
670 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
671 static int |
94926 | 672 get_font_prop_index (key) |
90400 | 673 Lisp_Object key; |
674 { | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
675 int i; |
94926 | 676 |
677 for (i = 0; i < FONT_PROPERTY_TABLE_SIZE; i++) | |
678 if (EQ (key, *font_property_table[i].key)) | |
679 return i; | |
680 return -1; | |
681 } | |
682 | |
683 /* Validate the font property. The property key is specified by the | |
684 symbol PROP, or the index IDX (if PROP is nil). If VAL is invalid, | |
685 signal an error. The value is VAL or the regularized one. */ | |
686 | |
687 static Lisp_Object | |
688 font_prop_validate (idx, prop, val) | |
689 int idx; | |
690 Lisp_Object prop, val; | |
691 { | |
692 Lisp_Object validated; | |
693 | |
94964
5ffc88767cc1
(font_prop_validate): Make nil a valid value.
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
694 if (NILP (val)) |
5ffc88767cc1
(font_prop_validate): Make nil a valid value.
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
695 return val; |
94926 | 696 if (NILP (prop)) |
697 prop = *font_property_table[idx].key; | |
698 else | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
699 { |
94926 | 700 idx = get_font_prop_index (prop); |
701 if (idx < 0) | |
702 return val; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
703 } |
94926 | 704 validated = (font_property_table[idx].validater) (prop, val); |
705 if (EQ (validated, Qerror)) | |
706 signal_error ("invalid font property", Fcons (prop, val)); | |
707 return validated; | |
90400 | 708 } |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
709 |
94926 | 710 |
711 /* Store VAL as a value of extra font property PROP in FONT while | |
712 keeping the sorting order. Don't check the validity of VAL. */ | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
713 |
90888
5f03b3602143
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90883
diff
changeset
|
714 Lisp_Object |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
715 font_put_extra (font, prop, val) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
716 Lisp_Object font, prop, val; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
717 { |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
718 Lisp_Object extra = AREF (font, FONT_EXTRA_INDEX); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
719 Lisp_Object slot = (NILP (extra) ? Qnil : assq_no_quit (prop, extra)); |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
720 |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
721 if (NILP (slot)) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
722 { |
94926 | 723 Lisp_Object prev = Qnil; |
724 | |
102897
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
725 if (NILP (val)) |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
726 return val; |
94926 | 727 while (CONSP (extra) |
728 && NILP (Fstring_lessp (prop, XCAR (XCAR (extra))))) | |
729 prev = extra, extra = XCDR (extra); | |
730 if (NILP (prev)) | |
731 ASET (font, FONT_EXTRA_INDEX, Fcons (Fcons (prop, val), extra)); | |
732 else | |
733 XSETCDR (prev, Fcons (Fcons (prop, val), extra)); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
734 return val; |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
735 } |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
736 XSETCDR (slot, val); |
102897
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
737 if (NILP (val)) |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
738 ASET (font, FONT_EXTRA_INDEX, Fdelq (slot, extra)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
739 return val; |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
740 } |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
741 |
90400 | 742 |
743 /* Font name parser and unparser */ | |
744 | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
745 static int parse_matrix P_ ((char *)); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
746 static int font_expand_wildcards P_ ((Lisp_Object *, int)); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
747 static int font_parse_name P_ ((char *, Lisp_Object)); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
748 |
90400 | 749 /* An enumerator for each field of an XLFD font name. */ |
750 enum xlfd_field_index | |
751 { | |
752 XLFD_FOUNDRY_INDEX, | |
753 XLFD_FAMILY_INDEX, | |
754 XLFD_WEIGHT_INDEX, | |
755 XLFD_SLANT_INDEX, | |
756 XLFD_SWIDTH_INDEX, | |
757 XLFD_ADSTYLE_INDEX, | |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
758 XLFD_PIXEL_INDEX, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
759 XLFD_POINT_INDEX, |
90400 | 760 XLFD_RESX_INDEX, |
761 XLFD_RESY_INDEX, | |
762 XLFD_SPACING_INDEX, | |
763 XLFD_AVGWIDTH_INDEX, | |
764 XLFD_REGISTRY_INDEX, | |
765 XLFD_ENCODING_INDEX, | |
766 XLFD_LAST_INDEX | |
767 }; | |
768 | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
769 /* An enumerator for mask bit corresponding to each XLFD field. */ |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
770 enum xlfd_field_mask |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
771 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
772 XLFD_FOUNDRY_MASK = 0x0001, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
773 XLFD_FAMILY_MASK = 0x0002, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
774 XLFD_WEIGHT_MASK = 0x0004, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
775 XLFD_SLANT_MASK = 0x0008, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
776 XLFD_SWIDTH_MASK = 0x0010, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
777 XLFD_ADSTYLE_MASK = 0x0020, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
778 XLFD_PIXEL_MASK = 0x0040, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
779 XLFD_POINT_MASK = 0x0080, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
780 XLFD_RESX_MASK = 0x0100, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
781 XLFD_RESY_MASK = 0x0200, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
782 XLFD_SPACING_MASK = 0x0400, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
783 XLFD_AVGWIDTH_MASK = 0x0800, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
784 XLFD_REGISTRY_MASK = 0x1000, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
785 XLFD_ENCODING_MASK = 0x2000 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
786 }; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
787 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
788 |
90400 | 789 /* Parse P pointing the pixel/point size field of the form |
790 `[A B C D]' which specifies a transformation matrix: | |
791 | |
792 A B 0 | |
793 C D 0 | |
794 0 0 1 | |
795 | |
796 by which all glyphs of the font are transformed. The spec says | |
797 that scalar value N for the pixel/point size is equivalent to: | |
798 A = N * resx/resy, B = C = 0, D = N. | |
799 | |
800 Return the scalar value N if the form is valid. Otherwise return | |
801 -1. */ | |
802 | |
803 static int | |
804 parse_matrix (p) | |
805 char *p; | |
806 { | |
807 double matrix[4]; | |
808 char *end; | |
809 int i; | |
810 | |
811 for (i = 0, p++; i < 4 && *p && *p != ']'; i++) | |
812 { | |
813 if (*p == '~') | |
814 matrix[i] = - strtod (p + 1, &end); | |
815 else | |
816 matrix[i] = strtod (p, &end); | |
817 p = end; | |
818 } | |
819 return (i == 4 ? (int) matrix[3] : -1); | |
820 } | |
821 | |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
822 /* Expand a wildcard field in FIELD (the first N fields are filled) to |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
823 multiple fields to fill in all 14 XLFD fields while restring a |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
824 field position by its contents. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
825 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
826 static int |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
827 font_expand_wildcards (field, n) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
828 Lisp_Object field[XLFD_LAST_INDEX]; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
829 int n; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
830 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
831 /* Copy of FIELD. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
832 Lisp_Object tmp[XLFD_LAST_INDEX]; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
833 /* Array of information about where this element can go. Nth |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
834 element is for Nth element of FIELD. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
835 struct { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
836 /* Minimum possible field. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
837 int from; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
838 /* Maxinum possible field. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
839 int to; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
840 /* Bit mask of possible field. Nth bit corresponds to Nth field. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
841 int mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
842 } range[XLFD_LAST_INDEX]; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
843 int i, j; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
844 int range_from, range_to; |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
845 unsigned range_mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
846 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
847 #define XLFD_SYMBOL_MASK (XLFD_FOUNDRY_MASK | XLFD_FAMILY_MASK \ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
848 | XLFD_ADSTYLE_MASK | XLFD_REGISTRY_MASK) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
849 #define XLFD_NULL_MASK (XLFD_FOUNDRY_MASK | XLFD_ADSTYLE_MASK) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
850 #define XLFD_LARGENUM_MASK (XLFD_POINT_MASK | XLFD_RESX_MASK | XLFD_RESY_MASK \ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
851 | XLFD_AVGWIDTH_MASK) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
852 #define XLFD_REGENC_MASK (XLFD_REGISTRY_MASK | XLFD_ENCODING_MASK) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
853 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
854 /* Initialize RANGE_MASK for FIELD[0] which can be 0th to (14 - N)th |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
855 field. The value is shifted to left one bit by one in the |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
856 following loop. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
857 for (i = 0, range_mask = 0; i <= 14 - n; i++) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
858 range_mask = (range_mask << 1) | 1; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
859 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
860 /* The triplet RANGE_FROM, RANGE_TO, and RANGE_MASK is a |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
861 position-based retriction for FIELD[I]. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
862 for (i = 0, range_from = 0, range_to = 14 - n; i < n; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
863 i++, range_from++, range_to++, range_mask <<= 1) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
864 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
865 Lisp_Object val = field[i]; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
866 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
867 tmp[i] = val; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
868 if (NILP (val)) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
869 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
870 /* Wildcard. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
871 range[i].from = range_from; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
872 range[i].to = range_to; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
873 range[i].mask = range_mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
874 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
875 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
876 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
877 /* The triplet FROM, TO, and MASK is a value-based |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
878 retriction for FIELD[I]. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
879 int from, to; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
880 unsigned mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
881 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
882 if (INTEGERP (val)) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
883 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
884 int numeric = XINT (val); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
885 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
886 if (i + 1 == n) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
887 from = to = XLFD_ENCODING_INDEX, |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
888 mask = XLFD_ENCODING_MASK; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
889 else if (numeric == 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
890 from = XLFD_PIXEL_INDEX, to = XLFD_AVGWIDTH_INDEX, |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
891 mask = XLFD_PIXEL_MASK | XLFD_LARGENUM_MASK; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
892 else if (numeric <= 48) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
893 from = to = XLFD_PIXEL_INDEX, |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
894 mask = XLFD_PIXEL_MASK; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
895 else |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
896 from = XLFD_POINT_INDEX, to = XLFD_AVGWIDTH_INDEX, |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
897 mask = XLFD_LARGENUM_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
898 } |
94926 | 899 else if (SBYTES (SYMBOL_NAME (val)) == 0) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
900 from = XLFD_FOUNDRY_INDEX, to = XLFD_ADSTYLE_INDEX, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
901 mask = XLFD_NULL_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
902 else if (i == 0) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
903 from = to = XLFD_FOUNDRY_INDEX, mask = XLFD_FOUNDRY_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
904 else if (i + 1 == n) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
905 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
906 Lisp_Object name = SYMBOL_NAME (val); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
907 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
908 if (SDATA (name)[SBYTES (name) - 1] == '*') |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
909 from = XLFD_REGISTRY_INDEX, to = XLFD_ENCODING_INDEX, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
910 mask = XLFD_REGENC_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
911 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
912 from = to = XLFD_ENCODING_INDEX, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
913 mask = XLFD_ENCODING_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
914 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
915 else if (range_from <= XLFD_WEIGHT_INDEX |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
916 && range_to >= XLFD_WEIGHT_INDEX |
94926 | 917 && FONT_WEIGHT_NAME_NUMERIC (val) >= 0) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
918 from = to = XLFD_WEIGHT_INDEX, mask = XLFD_WEIGHT_MASK; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
919 else if (range_from <= XLFD_SLANT_INDEX |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
920 && range_to >= XLFD_SLANT_INDEX |
94926 | 921 && FONT_SLANT_NAME_NUMERIC (val) >= 0) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
922 from = to = XLFD_SLANT_INDEX, mask = XLFD_SLANT_MASK; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
923 else if (range_from <= XLFD_SWIDTH_INDEX |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
924 && range_to >= XLFD_SWIDTH_INDEX |
94926 | 925 && FONT_WIDTH_NAME_NUMERIC (val) >= 0) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
926 from = to = XLFD_SWIDTH_INDEX, mask = XLFD_SWIDTH_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
927 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
928 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
929 if (EQ (val, Qc) || EQ (val, Qm) || EQ (val, Qp) || EQ (val, Qd)) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
930 from = to = XLFD_SPACING_INDEX, mask = XLFD_SPACING_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
931 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
932 from = XLFD_FOUNDRY_INDEX, to = XLFD_ENCODING_INDEX, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
933 mask = XLFD_SYMBOL_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
934 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
935 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
936 /* Merge position-based and value-based restrictions. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
937 mask &= range_mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
938 while (from < range_from) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
939 mask &= ~(1 << from++); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
940 while (from < 14 && ! (mask & (1 << from))) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
941 from++; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
942 while (to > range_to) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
943 mask &= ~(1 << to--); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
944 while (to >= 0 && ! (mask & (1 << to))) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
945 to--; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
946 if (from > to) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
947 return -1; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
948 range[i].from = from; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
949 range[i].to = to; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
950 range[i].mask = mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
951 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
952 if (from > range_from || to < range_to) |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
953 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
954 /* The range is narrowed by value-based restrictions. |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
955 Reflect it to the other fields. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
956 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
957 /* Following fields should be after FROM. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
958 range_from = from; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
959 /* Preceding fields should be before TO. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
960 for (j = i - 1, from--, to--; j >= 0; j--, from--, to--) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
961 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
962 /* Check FROM for non-wildcard field. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
963 if (! NILP (tmp[j]) && range[j].from < from) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
964 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
965 while (range[j].from < from) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
966 range[j].mask &= ~(1 << range[j].from++); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
967 while (from < 14 && ! (range[j].mask & (1 << from))) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
968 from++; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
969 range[j].from = from; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
970 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
971 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
972 from = range[j].from; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
973 if (range[j].to > to) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
974 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
975 while (range[j].to > to) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
976 range[j].mask &= ~(1 << range[j].to--); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
977 while (to >= 0 && ! (range[j].mask & (1 << to))) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
978 to--; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
979 range[j].to = to; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
980 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
981 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
982 to = range[j].to; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
983 if (from > to) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
984 return -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
985 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
986 } |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
987 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
988 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
989 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
990 /* Decide all fileds from restrictions in RANGE. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
991 for (i = j = 0; i < n ; i++) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
992 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
993 if (j < range[i].from) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
994 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
995 if (i == 0 || ! NILP (tmp[i - 1])) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
996 /* None of TMP[X] corresponds to Jth field. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
997 return -1; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
998 for (; j < range[i].from; j++) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
999 field[j] = Qnil; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1000 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1001 field[j++] = tmp[i]; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1002 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1003 if (! NILP (tmp[n - 1]) && j < XLFD_REGISTRY_INDEX) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1004 return -1; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1005 for (; j < XLFD_LAST_INDEX; j++) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1006 field[j] = Qnil; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1007 if (INTEGERP (field[XLFD_ENCODING_INDEX])) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1008 field[XLFD_ENCODING_INDEX] |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1009 = Fintern (Fnumber_to_string (field[XLFD_ENCODING_INDEX]), Qnil); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1010 return 0; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1011 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1012 |
92113
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1013 |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1014 #ifdef ENABLE_CHECKING |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1015 /* Match a 14-field XLFD pattern against a full XLFD font name. */ |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1016 static int |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1017 font_match_xlfd (char *pattern, char *name) |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1018 { |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1019 while (*pattern && *name) |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1020 { |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1021 if (*pattern == *name) |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1022 pattern++; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1023 else if (*pattern == '*') |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1024 if (*name == pattern[1]) |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1025 pattern += 2; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1026 else |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1027 ; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1028 else |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1029 return 0; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1030 name++; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1031 } |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1032 return 1; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1033 } |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1034 |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1035 /* Make sure the font object matches the XLFD font name. */ |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1036 static int |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1037 font_check_xlfd_parse (Lisp_Object font, char *name) |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1038 { |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1039 char name_check[256]; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1040 font_unparse_xlfd (font, 0, name_check, 255); |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1041 return font_match_xlfd (name_check, name); |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1042 } |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1043 |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1044 #endif |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1045 |
94926 | 1046 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1047 /* Parse NAME (null terminated) as XLFD and store information in FONT |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1048 (font-spec or font-entity). Size property of FONT is set as |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1049 follows: |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1050 specified XLFD fields FONT property |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1051 --------------------- ------------- |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1052 PIXEL_SIZE PIXEL_SIZE (Lisp integer) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1053 POINT_SIZE and RESY calculated pixel size (Lisp integer) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1054 POINT_SIZE POINT_SIZE/10 (Lisp float) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1055 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1056 If NAME is successfully parsed, return 0. Otherwise return -1. |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1057 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1058 FONT is usually a font-spec, but when this function is called from |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1059 X font backend driver, it is a font-entity. In that case, NAME is |
94926 | 1060 a fully specified XLFD. */ |
90400 | 1061 |
1062 int | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1063 font_parse_xlfd (name, font) |
90400 | 1064 char *name; |
1065 Lisp_Object font; | |
1066 { | |
1067 int len = strlen (name); | |
94926 | 1068 int i, j, n; |
90695
a1cd7344d6a2
(font_parse_xlfd): Fix the array size of `f'.
Kenichi Handa <handa@m17n.org>
parents:
90677
diff
changeset
|
1069 char *f[XLFD_LAST_INDEX + 1]; |
90400 | 1070 Lisp_Object val; |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1071 char *p; |
90400 | 1072 |
101422
9e1fcd81389c
(font_parse_xlfd): Handle patterns of length < 2.
Chong Yidong <cyd@stupidchicken.com>
parents:
101293
diff
changeset
|
1073 if (len > 255 || !len) |
90400 | 1074 /* Maximum XLFD name length is 255. */ |
1075 return -1; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1076 /* Accept "*-.." as a fully specified XLFD. */ |
101422
9e1fcd81389c
(font_parse_xlfd): Handle patterns of length < 2.
Chong Yidong <cyd@stupidchicken.com>
parents:
101293
diff
changeset
|
1077 if (name[0] == '*' && (len == 1 || name[1] == '-')) |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1078 i = 1, f[XLFD_FOUNDRY_INDEX] = name; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1079 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1080 i = 0; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1081 for (p = name + i; *p; p++) |
94926 | 1082 if (*p == '-') |
1083 { | |
1084 f[i++] = p + 1; | |
1085 if (i == XLFD_LAST_INDEX) | |
1086 break; | |
1087 } | |
1088 f[i] = name + len; | |
1089 | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1090 #define INTERN_FIELD(N) font_intern_prop (f[N], f[(N) + 1] - 1 - f[N], 0) |
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1091 #define INTERN_FIELD_SYM(N) font_intern_prop (f[N], f[(N) + 1] - 1 - f[N], 1) |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1092 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1093 if (i == XLFD_LAST_INDEX) |
90400 | 1094 { |
94926 | 1095 /* Fully specified XLFD. */ |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1096 int pixel_size; |
94926 | 1097 |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1098 ASET (font, FONT_FOUNDRY_INDEX, INTERN_FIELD_SYM (XLFD_FOUNDRY_INDEX)); |
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1099 ASET (font, FONT_FAMILY_INDEX, INTERN_FIELD_SYM (XLFD_FAMILY_INDEX)); |
94926 | 1100 for (i = XLFD_WEIGHT_INDEX, j = FONT_WEIGHT_INDEX; |
1101 i <= XLFD_SWIDTH_INDEX; i++, j++) | |
90400 | 1102 { |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1103 val = INTERN_FIELD_SYM (i); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1104 if (! NILP (val)) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1105 { |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1106 if ((n = font_style_to_value (j, INTERN_FIELD_SYM (i), 0)) < 0) |
94926 | 1107 return -1; |
1108 ASET (font, j, make_number (n)); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1109 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1110 } |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1111 ASET (font, FONT_ADSTYLE_INDEX, INTERN_FIELD_SYM (XLFD_ADSTYLE_INDEX)); |
94926 | 1112 if (strcmp (f[XLFD_REGISTRY_INDEX], "*-*") == 0) |
1113 ASET (font, FONT_REGISTRY_INDEX, Qnil); | |
1114 else | |
1115 ASET (font, FONT_REGISTRY_INDEX, | |
1116 font_intern_prop (f[XLFD_REGISTRY_INDEX], | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1117 f[XLFD_LAST_INDEX] - f[XLFD_REGISTRY_INDEX], |
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1118 1)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1119 p = f[XLFD_PIXEL_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1120 if (*p == '[' && (pixel_size = parse_matrix (p)) >= 0) |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
1121 ASET (font, FONT_SIZE_INDEX, make_number (pixel_size)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1122 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1123 { |
94926 | 1124 val = INTERN_FIELD (XLFD_PIXEL_INDEX); |
1125 if (INTEGERP (val)) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1126 ASET (font, FONT_SIZE_INDEX, val); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1127 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1128 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1129 double point_size = -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1130 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1131 font_assert (FONT_SPEC_P (font)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1132 p = f[XLFD_POINT_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1133 if (*p == '[') |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1134 point_size = parse_matrix (p); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1135 else if (isdigit (*p)) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1136 point_size = atoi (p), point_size /= 10; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1137 if (point_size >= 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1138 ASET (font, FONT_SIZE_INDEX, make_float (point_size)); |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1139 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1140 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1141 |
94926 | 1142 ASET (font, FONT_DPI_INDEX, INTERN_FIELD (XLFD_RESY_INDEX)); |
1143 val = INTERN_FIELD (XLFD_SPACING_INDEX); | |
1144 if (! NILP (val)) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1145 { |
94926 | 1146 val = font_prop_validate_spacing (QCspacing, val); |
1147 if (! INTEGERP (val)) | |
1148 return -1; | |
1149 ASET (font, FONT_SPACING_INDEX, val); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1150 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1151 p = f[XLFD_AVGWIDTH_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1152 if (*p == '~') |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1153 p++; |
94926 | 1154 ASET (font, FONT_AVGWIDTH_INDEX, |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1155 font_intern_prop (p, f[XLFD_REGISTRY_INDEX] - 1 - p, 0)); |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1156 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1157 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1158 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1159 int wild_card_found = 0; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1160 Lisp_Object prop[XLFD_LAST_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1161 |
94926 | 1162 if (FONT_ENTITY_P (font)) |
1163 return -1; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1164 for (j = 0; j < i; j++) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1165 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1166 if (*f[j] == '*') |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1167 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1168 if (f[j][1] && f[j][1] != '-') |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1169 return -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1170 prop[j] = Qnil; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1171 wild_card_found = 1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1172 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1173 else if (j + 1 < i) |
94926 | 1174 prop[j] = INTERN_FIELD (j); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1175 else |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1176 prop[j] = font_intern_prop (f[j], f[i] - f[j], 0); |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1177 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1178 if (! wild_card_found) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1179 return -1; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1180 if (font_expand_wildcards (prop, i) < 0) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1181 return -1; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1182 |
94926 | 1183 ASET (font, FONT_FOUNDRY_INDEX, prop[XLFD_FOUNDRY_INDEX]); |
1184 ASET (font, FONT_FAMILY_INDEX, prop[XLFD_FAMILY_INDEX]); | |
1185 for (i = XLFD_WEIGHT_INDEX, j = FONT_WEIGHT_INDEX; | |
1186 i <= XLFD_SWIDTH_INDEX; i++, j++) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1187 if (! NILP (prop[i])) |
94926 | 1188 { |
1189 if ((n = font_style_to_value (j, prop[i], 1)) < 0) | |
1190 return -1; | |
1191 ASET (font, j, make_number (n)); | |
1192 } | |
1193 ASET (font, FONT_ADSTYLE_INDEX, prop[XLFD_ADSTYLE_INDEX]); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1194 val = prop[XLFD_REGISTRY_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1195 if (NILP (val)) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1196 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1197 val = prop[XLFD_ENCODING_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1198 if (! NILP (val)) |
94926 | 1199 val = concat2 (build_string ("*-"), SYMBOL_NAME (val)); |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1200 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1201 else if (NILP (prop[XLFD_ENCODING_INDEX])) |
94926 | 1202 val = concat2 (SYMBOL_NAME (val), build_string ("-*")); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1203 else |
94926 | 1204 val = concat3 (SYMBOL_NAME (val), build_string ("-"), |
1205 SYMBOL_NAME (prop[XLFD_ENCODING_INDEX])); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1206 if (! NILP (val)) |
94926 | 1207 ASET (font, FONT_REGISTRY_INDEX, Fintern (val, Qnil)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1208 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1209 if (INTEGERP (prop[XLFD_PIXEL_INDEX])) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1210 ASET (font, FONT_SIZE_INDEX, prop[XLFD_PIXEL_INDEX]); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1211 else if (INTEGERP (prop[XLFD_POINT_INDEX])) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1212 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1213 double point_size = XINT (prop[XLFD_POINT_INDEX]); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1214 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1215 ASET (font, FONT_SIZE_INDEX, make_float (point_size / 10)); |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1216 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1217 |
94926 | 1218 if (INTEGERP (prop[XLFD_RESX_INDEX])) |
1219 ASET (font, FONT_DPI_INDEX, prop[XLFD_RESY_INDEX]); | |
1220 if (! NILP (prop[XLFD_SPACING_INDEX])) | |
1221 { | |
1222 val = font_prop_validate_spacing (QCspacing, | |
1223 prop[XLFD_SPACING_INDEX]); | |
1224 if (! INTEGERP (val)) | |
1225 return -1; | |
1226 ASET (font, FONT_SPACING_INDEX, val); | |
1227 } | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1228 if (INTEGERP (prop[XLFD_AVGWIDTH_INDEX])) |
94926 | 1229 ASET (font, FONT_AVGWIDTH_INDEX, prop[XLFD_AVGWIDTH_INDEX]); |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1230 } |
90400 | 1231 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1232 return 0; |
90400 | 1233 } |
1234 | |
1235 /* Store XLFD name of FONT (font-spec or font-entity) in NAME (NBYTES | |
1236 length), and return the name length. If FONT_SIZE_INDEX of FONT is | |
1237 0, use PIXEL_SIZE instead. */ | |
1238 | |
1239 int | |
1240 font_unparse_xlfd (font, pixel_size, name, nbytes) | |
1241 Lisp_Object font; | |
90439
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1242 int pixel_size; |
90400 | 1243 char *name; |
1244 int nbytes; | |
1245 { | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1246 char *f[XLFD_REGISTRY_INDEX + 1]; |
90400 | 1247 Lisp_Object val; |
1248 int i, j, len = 0; | |
1249 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1250 font_assert (FONTP (font)); |
90400 | 1251 |
1252 for (i = FONT_FOUNDRY_INDEX, j = XLFD_FOUNDRY_INDEX; i <= FONT_REGISTRY_INDEX; | |
1253 i++, j++) | |
1254 { | |
1255 if (i == FONT_ADSTYLE_INDEX) | |
1256 j = XLFD_ADSTYLE_INDEX; | |
1257 else if (i == FONT_REGISTRY_INDEX) | |
1258 j = XLFD_REGISTRY_INDEX; | |
1259 val = AREF (font, i); | |
1260 if (NILP (val)) | |
90439
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1261 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1262 if (j == XLFD_REGISTRY_INDEX) |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1263 f[j] = "*-*", len += 4; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1264 else |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1265 f[j] = "*", len += 2; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1266 } |
90400 | 1267 else |
1268 { | |
1269 if (SYMBOLP (val)) | |
1270 val = SYMBOL_NAME (val); | |
90439
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1271 if (j == XLFD_REGISTRY_INDEX |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1272 && ! strchr ((char *) SDATA (val), '-')) |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1273 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1274 /* Change "jisx0208*" and "jisx0208" to "jisx0208*-*". */ |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1275 if (SDATA (val)[SBYTES (val) - 1] == '*') |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1276 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1277 f[j] = alloca (SBYTES (val) + 3); |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1278 sprintf (f[j], "%s-*", SDATA (val)); |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1279 len += SBYTES (val) + 3; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1280 } |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1281 else |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1282 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1283 f[j] = alloca (SBYTES (val) + 4); |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1284 sprintf (f[j], "%s*-*", SDATA (val)); |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1285 len += SBYTES (val) + 4; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1286 } |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1287 } |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1288 else |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1289 f[j] = (char *) SDATA (val), len += SBYTES (val) + 1; |
90400 | 1290 } |
1291 } | |
1292 | |
1293 for (i = FONT_WEIGHT_INDEX, j = XLFD_WEIGHT_INDEX; i <= FONT_WIDTH_INDEX; | |
1294 i++, j++) | |
1295 { | |
94926 | 1296 val = font_style_symbolic (font, i, 0); |
90400 | 1297 if (NILP (val)) |
1298 f[j] = "*", len += 2; | |
1299 else | |
1300 { | |
94926 | 1301 val = SYMBOL_NAME (val); |
90400 | 1302 f[j] = (char *) SDATA (val), len += SBYTES (val) + 1; |
1303 } | |
1304 } | |
1305 | |
1306 val = AREF (font, FONT_SIZE_INDEX); | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1307 font_assert (NUMBERP (val) || NILP (val)); |
90400 | 1308 if (INTEGERP (val)) |
1309 { | |
94926 | 1310 i = XINT (val); |
91943
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1311 if (i <= 0) |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1312 i = pixel_size; |
90400 | 1313 if (i > 0) |
91943
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1314 { |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1315 f[XLFD_PIXEL_INDEX] = alloca (22); |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1316 len += sprintf (f[XLFD_PIXEL_INDEX], "%d-*", i) + 1; |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1317 } |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1318 else |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1319 f[XLFD_PIXEL_INDEX] = "*-*", len += 4; |
90400 | 1320 } |
1321 else if (FLOATP (val)) | |
1322 { | |
94926 | 1323 i = XFLOAT_DATA (val) * 10; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1324 f[XLFD_PIXEL_INDEX] = alloca (12); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1325 len += sprintf (f[XLFD_PIXEL_INDEX], "*-%d", i) + 1; |
90400 | 1326 } |
1327 else | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1328 f[XLFD_PIXEL_INDEX] = "*-*", len += 4; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1329 |
94926 | 1330 if (INTEGERP (AREF (font, FONT_DPI_INDEX))) |
90400 | 1331 { |
94926 | 1332 i = XINT (AREF (font, FONT_DPI_INDEX)); |
1333 f[XLFD_RESX_INDEX] = alloca (22); | |
1334 len += sprintf (f[XLFD_RESX_INDEX], | |
1335 "%d-%d", i, i) + 1; | |
90400 | 1336 } |
1337 else | |
94926 | 1338 f[XLFD_RESX_INDEX] = "*-*", len += 4; |
1339 if (INTEGERP (AREF (font, FONT_SPACING_INDEX))) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1340 { |
94926 | 1341 int spacing = XINT (AREF (font, FONT_SPACING_INDEX)); |
1342 | |
1343 f[XLFD_SPACING_INDEX] = (spacing <= FONT_SPACING_PROPORTIONAL ? "p" | |
1344 : spacing <= FONT_SPACING_DUAL ? "d" | |
1345 : spacing <= FONT_SPACING_MONO ? "m" | |
1346 : "c"); | |
1347 len += 2; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1348 } |
94926 | 1349 else |
1350 f[XLFD_SPACING_INDEX] = "*", len += 2; | |
1351 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) | |
1352 { | |
1353 f[XLFD_AVGWIDTH_INDEX] = alloca (11); | |
1354 len += sprintf (f[XLFD_AVGWIDTH_INDEX], | |
1355 "%d", XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1; | |
1356 } | |
1357 else | |
1358 f[XLFD_AVGWIDTH_INDEX] = "*", len += 2; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1359 len++; /* for terminating '\0'. */ |
90400 | 1360 if (len >= nbytes) |
1361 return -1; | |
94926 | 1362 return sprintf (name, "-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s", |
90400 | 1363 f[XLFD_FOUNDRY_INDEX], f[XLFD_FAMILY_INDEX], |
1364 f[XLFD_WEIGHT_INDEX], f[XLFD_SLANT_INDEX], | |
94926 | 1365 f[XLFD_SWIDTH_INDEX], f[XLFD_ADSTYLE_INDEX], |
1366 f[XLFD_PIXEL_INDEX], f[XLFD_RESX_INDEX], | |
1367 f[XLFD_SPACING_INDEX], f[XLFD_AVGWIDTH_INDEX], | |
1368 f[XLFD_REGISTRY_INDEX]); | |
90400 | 1369 } |
1370 | |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1371 /* Parse NAME (null terminated) and store information in FONT |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1372 (font-spec or font-entity). NAME is supplied in either the |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1373 Fontconfig or GTK font name format. If NAME is successfully |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1374 parsed, return 0. Otherwise return -1. |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1375 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1376 The fontconfig format is |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1377 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1378 FAMILY[-SIZE][:PROP1[=VAL1][:PROP2[=VAL2]...]] |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1379 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1380 The GTK format is |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1381 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1382 FAMILY [PROPS...] [SIZE] |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1383 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1384 This function tries to guess which format it is. */ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1385 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1386 int |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1387 font_parse_fcname (name, font) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1388 char *name; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1389 Lisp_Object font; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1390 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1391 char *p, *q; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1392 char *size_beg = NULL, *size_end = NULL; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1393 char *props_beg = NULL, *family_end = NULL; |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1394 int len = strlen (name); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1395 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1396 if (len == 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1397 return -1; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1398 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1399 for (p = name; *p; p++) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1400 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1401 if (*p == '\\' && p[1]) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1402 p++; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1403 else if (*p == ':') |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1404 { |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1405 props_beg = family_end = p; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1406 break; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1407 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1408 else if (*p == '-') |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1409 { |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1410 int decimal = 0, size_found = 1; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1411 for (q = p + 1; *q && *q != ':'; q++) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1412 if (! isdigit(*q)) |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1413 { |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1414 if (*q != '.' || decimal) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1415 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1416 size_found = 0; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1417 break; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1418 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1419 decimal = 1; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1420 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1421 if (size_found) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1422 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1423 family_end = p; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1424 size_beg = p + 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1425 size_end = q; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1426 break; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1427 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1428 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1429 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1430 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1431 if (family_end) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1432 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1433 /* A fontconfig name with size and/or property data. */ |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1434 if (family_end > name) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1435 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1436 Lisp_Object family; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1437 family = font_intern_prop (name, family_end - name, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1438 ASET (font, FONT_FAMILY_INDEX, family); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1439 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1440 if (size_beg) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1441 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1442 double point_size = strtod (size_beg, &size_end); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1443 ASET (font, FONT_SIZE_INDEX, make_float (point_size)); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1444 if (*size_end == ':' && size_end[1]) |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1445 props_beg = size_end; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1446 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1447 if (props_beg) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1448 { |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1449 /* Now parse ":KEY=VAL" patterns. */ |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1450 Lisp_Object val; |
96016
c1105df0f9c8
(font_parse_fcname): Fix handling of unknown-spec string.
Chong Yidong <cyd@stupidchicken.com>
parents:
96014
diff
changeset
|
1451 |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1452 for (p = props_beg; *p; p = q) |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1453 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1454 for (q = p + 1; *q && *q != '=' && *q != ':'; q++); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1455 if (*q != '=') |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1456 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1457 /* Must be an enumerated value. */ |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1458 int word_len; |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1459 p = p + 1; |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1460 word_len = q - p; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1461 val = font_intern_prop (p, q - p, 1); |
95984 | 1462 |
1463 #define PROP_MATCH(STR,N) ((word_len == N) && memcmp (p, STR, N) == 0) | |
1464 | |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1465 if (PROP_MATCH ("light", 5) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1466 || PROP_MATCH ("medium", 6) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1467 || PROP_MATCH ("demibold", 8) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1468 || PROP_MATCH ("bold", 4) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1469 || PROP_MATCH ("black", 5)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1470 FONT_SET_STYLE (font, FONT_WEIGHT_INDEX, val); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1471 else if (PROP_MATCH ("roman", 5) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1472 || PROP_MATCH ("italic", 6) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1473 || PROP_MATCH ("oblique", 7)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1474 FONT_SET_STYLE (font, FONT_SLANT_INDEX, val); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1475 else if (PROP_MATCH ("charcell", 8)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1476 ASET (font, FONT_SPACING_INDEX, |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1477 make_number (FONT_SPACING_CHARCELL)); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1478 else if (PROP_MATCH ("mono", 4)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1479 ASET (font, FONT_SPACING_INDEX, |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1480 make_number (FONT_SPACING_MONO)); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1481 else if (PROP_MATCH ("proportional", 12)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1482 ASET (font, FONT_SPACING_INDEX, |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1483 make_number (FONT_SPACING_PROPORTIONAL)); |
95984 | 1484 #undef PROP_MATCH |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1485 } |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1486 else |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1487 { |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1488 /* KEY=VAL pairs */ |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1489 Lisp_Object key; |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1490 int prop; |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1491 |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1492 if (q - p == 10 && memcmp (p + 1, "pixelsize", 9) == 0) |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1493 prop = FONT_SIZE_INDEX; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1494 else |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1495 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1496 key = font_intern_prop (p, q - p, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1497 prop = get_font_prop_index (key); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1498 } |
96016
c1105df0f9c8
(font_parse_fcname): Fix handling of unknown-spec string.
Chong Yidong <cyd@stupidchicken.com>
parents:
96014
diff
changeset
|
1499 |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1500 p = q + 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1501 for (q = p; *q && *q != ':'; q++); |
95983
104a55eb192a
(font_parse_fcname): Correctly parse KEY=VAL values.
Chong Yidong <cyd@stupidchicken.com>
parents:
95972
diff
changeset
|
1502 val = font_intern_prop (p, q - p, 0); |
96016
c1105df0f9c8
(font_parse_fcname): Fix handling of unknown-spec string.
Chong Yidong <cyd@stupidchicken.com>
parents:
96014
diff
changeset
|
1503 |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1504 if (prop >= FONT_FOUNDRY_INDEX |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1505 && prop < FONT_EXTRA_INDEX) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1506 ASET (font, prop, font_prop_validate (prop, Qnil, val)); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1507 else |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1508 Ffont_put (font, key, val); |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1509 } |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1510 p = q; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1511 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1512 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1513 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1514 else |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1515 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1516 /* Either a fontconfig-style name with no size and property |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1517 data, or a GTK-style name. */ |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1518 Lisp_Object prop; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1519 int word_len, prop_found = 0; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1520 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1521 for (p = name; *p; p = *q ? q + 1 : q) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1522 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1523 if (isdigit (*p)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1524 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1525 int size_found = 1; |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
1526 |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1527 for (q = p + 1; *q && *q != ' '; q++) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1528 if (! isdigit (*q)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1529 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1530 size_found = 0; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1531 break; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1532 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1533 if (size_found) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1534 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1535 double point_size = strtod (p, &q); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1536 ASET (font, FONT_SIZE_INDEX, make_float (point_size)); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1537 continue; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1538 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1539 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1540 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1541 for (q = p + 1; *q && *q != ' '; q++) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1542 if (*q == '\\' && q[1]) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1543 q++; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1544 word_len = q - p; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1545 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1546 #define PROP_MATCH(STR,N) ((word_len == N) && memcmp (p, STR, N) == 0) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1547 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1548 if (PROP_MATCH ("Ultra-Light", 11)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1549 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1550 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1551 prop = font_intern_prop ("ultra-light", 11, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1552 FONT_SET_STYLE (font, FONT_WEIGHT_INDEX, prop); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1553 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1554 else if (PROP_MATCH ("Light", 5)) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1555 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1556 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1557 prop = font_intern_prop ("light", 5, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1558 FONT_SET_STYLE (font, FONT_WEIGHT_INDEX, prop); |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
1559 } |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1560 else if (PROP_MATCH ("Semi-Bold", 9)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1561 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1562 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1563 prop = font_intern_prop ("semi-bold", 9, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1564 FONT_SET_STYLE (font, FONT_WEIGHT_INDEX, prop); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1565 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1566 else if (PROP_MATCH ("Bold", 4)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1567 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1568 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1569 prop = font_intern_prop ("bold", 4, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1570 FONT_SET_STYLE (font, FONT_WEIGHT_INDEX, prop); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1571 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1572 else if (PROP_MATCH ("Italic", 6)) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1573 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1574 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1575 prop = font_intern_prop ("italic", 4, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1576 FONT_SET_STYLE (font, FONT_SLANT_INDEX, prop); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1577 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1578 else if (PROP_MATCH ("Oblique", 7)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1579 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1580 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1581 prop = font_intern_prop ("oblique", 7, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1582 FONT_SET_STYLE (font, FONT_SLANT_INDEX, prop); |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1583 } |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1584 else { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1585 if (prop_found) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1586 return -1; /* Unknown property in GTK-style font name. */ |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1587 family_end = q; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1588 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1589 } |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1590 #undef PROP_MATCH |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1591 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1592 if (family_end) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1593 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1594 Lisp_Object family; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1595 family = font_intern_prop (name, family_end - name, 1); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1596 ASET (font, FONT_FAMILY_INDEX, family); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1597 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1598 } |
95886
c8bc52f94b6d
(syms_of_font) <font-weight-table, font-slant-table, font-width-table>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95875
diff
changeset
|
1599 |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1600 return 0; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1601 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1602 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1603 /* Store fontconfig's font name of FONT (font-spec or font-entity) in |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1604 NAME (NBYTES length), and return the name length. If |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1605 FONT_SIZE_INDEX of FONT is 0, use PIXEL_SIZE instead. */ |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1606 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1607 int |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1608 font_unparse_fcname (font, pixel_size, name, nbytes) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1609 Lisp_Object font; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1610 int pixel_size; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1611 char *name; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1612 int nbytes; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1613 { |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1614 Lisp_Object family, foundry; |
94926 | 1615 Lisp_Object tail, val; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1616 int point_size; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1617 int i, len = 1; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1618 char *p; |
90476
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1619 Lisp_Object styles[3]; |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
1620 char *style_names[3] = { "weight", "slant", "width" }; |
94926 | 1621 char work[256]; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1622 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1623 family = AREF (font, FONT_FAMILY_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1624 if (! NILP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1625 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1626 if (SYMBOLP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1627 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1628 family = SYMBOL_NAME (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1629 len += SBYTES (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1630 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1631 else |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1632 family = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1633 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1634 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1635 val = AREF (font, FONT_SIZE_INDEX); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1636 if (INTEGERP (val)) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1637 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1638 if (XINT (val) != 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1639 pixel_size = XINT (val); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1640 point_size = -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1641 len += 21; /* for ":pixelsize=NUM" */ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1642 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1643 else if (FLOATP (val)) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1644 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1645 pixel_size = -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1646 point_size = (int) XFLOAT_DATA (val); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1647 len += 11; /* for "-NUM" */ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1648 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1649 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1650 foundry = AREF (font, FONT_FOUNDRY_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1651 if (! NILP (foundry)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1652 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1653 if (SYMBOLP (foundry)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1654 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1655 foundry = SYMBOL_NAME (foundry); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1656 len += 9 + SBYTES (foundry); /* ":foundry=NAME" */ |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1657 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1658 else |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1659 foundry = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1660 } |
94926 | 1661 |
1662 for (i = 0; i < 3; i++) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1663 { |
94926 | 1664 styles[i] = font_style_symbolic (font, FONT_WEIGHT_INDEX + i, 0); |
1665 if (! NILP (styles[i])) | |
1666 len += sprintf (work, ":%s=%s", style_names[i], | |
1667 SDATA (SYMBOL_NAME (styles[i]))); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1668 } |
94926 | 1669 |
1670 if (INTEGERP (AREF (font, FONT_DPI_INDEX))) | |
100126
dcdbc6ad9e02
(font_unparse_fcname): Fix use of uninitialized variable.
Andreas Schwab <schwab@suse.de>
parents:
100103
diff
changeset
|
1671 len += sprintf (work, ":dpi=%d", XINT (AREF (font, FONT_DPI_INDEX))); |
94926 | 1672 if (INTEGERP (AREF (font, FONT_SPACING_INDEX))) |
1673 len += strlen (":spacing=100"); | |
1674 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) | |
1675 len += strlen (":scalable=false"); /* or ":scalable=true" */ | |
1676 for (tail = AREF (font, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail)) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1677 { |
94926 | 1678 Lisp_Object key = XCAR (XCAR (tail)), val = XCDR (XCAR (tail)); |
1679 | |
1680 len += SBYTES (SYMBOL_NAME (key)) + 1; /* for :KEY= */ | |
1681 if (STRINGP (val)) | |
1682 len += SBYTES (val); | |
1683 else if (INTEGERP (val)) | |
1684 len += sprintf (work, "%d", XINT (val)); | |
1685 else if (SYMBOLP (val)) | |
1686 len += (NILP (val) ? 5 : 4); /* for "false" or "true" */ | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1687 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1688 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1689 if (len > nbytes) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1690 return -1; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1691 p = name; |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1692 if (! NILP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1693 p += sprintf (p, "%s", SDATA (family)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1694 if (point_size > 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1695 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1696 if (p == name) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1697 p += sprintf (p, "%d", point_size); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1698 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1699 p += sprintf (p, "-%d", point_size); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1700 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1701 else if (pixel_size > 0) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1702 p += sprintf (p, ":pixelsize=%d", pixel_size); |
94926 | 1703 if (! NILP (AREF (font, FONT_FOUNDRY_INDEX))) |
90476
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1704 p += sprintf (p, ":foundry=%s", |
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1705 SDATA (SYMBOL_NAME (AREF (font, FONT_FOUNDRY_INDEX)))); |
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1706 for (i = 0; i < 3; i++) |
94926 | 1707 if (! NILP (styles[i])) |
90476
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1708 p += sprintf (p, ":%s=%s", style_names[i], |
94926 | 1709 SDATA (SYMBOL_NAME (styles[i]))); |
1710 if (INTEGERP (AREF (font, FONT_DPI_INDEX))) | |
1711 p += sprintf (p, ":dpi=%d", XINT (AREF (font, FONT_DPI_INDEX))); | |
1712 if (INTEGERP (AREF (font, FONT_SPACING_INDEX))) | |
1713 p += sprintf (p, ":spacing=%d", XINT (AREF (font, FONT_SPACING_INDEX))); | |
1714 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) | |
1715 { | |
1716 if (XINT (AREF (font, FONT_AVGWIDTH_INDEX)) == 0) | |
1717 p += sprintf (p, ":scalable=true"); | |
1718 else | |
1719 p += sprintf (p, ":scalable=false"); | |
1720 } | |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1721 return (p - name); |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1722 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1723 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1724 /* Store GTK-style font name of FONT (font-spec or font-entity) in |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1725 NAME (NBYTES length), and return the name length. F is the frame |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1726 on which the font is displayed; it is used to calculate the point |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1727 size. */ |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1728 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1729 int |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1730 font_unparse_gtkname (font, f, name, nbytes) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1731 Lisp_Object font; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1732 struct frame *f; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1733 char *name; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1734 int nbytes; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1735 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1736 char *p; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1737 int len = 1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1738 Lisp_Object family, weight, slant, size; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1739 int point_size = -1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1740 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1741 family = AREF (font, FONT_FAMILY_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1742 if (! NILP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1743 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1744 if (! SYMBOLP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1745 return -1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1746 family = SYMBOL_NAME (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1747 len += SBYTES (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1748 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1749 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1750 weight = font_style_symbolic (font, FONT_WEIGHT_INDEX, 0); |
96017
54d310663505
(font_unparse_gtkname): Use EQ to compare Lisp_Objects.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96016
diff
changeset
|
1751 if (EQ (weight, Qnormal)) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1752 weight = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1753 else if (! NILP (weight)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1754 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1755 weight = SYMBOL_NAME (weight); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1756 len += SBYTES (weight); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1757 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1758 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1759 slant = font_style_symbolic (font, FONT_SLANT_INDEX, 0); |
96017
54d310663505
(font_unparse_gtkname): Use EQ to compare Lisp_Objects.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96016
diff
changeset
|
1760 if (EQ (slant, Qnormal)) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1761 slant = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1762 else if (! NILP (slant)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1763 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1764 slant = SYMBOL_NAME (slant); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1765 len += SBYTES (slant); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1766 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1767 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1768 size = AREF (font, FONT_SIZE_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1769 /* Convert pixel size to point size. */ |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1770 if (INTEGERP (size)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1771 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1772 Lisp_Object font_dpi = AREF (font, FONT_DPI_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1773 int dpi = 75; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1774 if (INTEGERP (font_dpi)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1775 dpi = XINT (font_dpi); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1776 else if (f) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1777 dpi = f->resy; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1778 point_size = PIXEL_TO_POINT (XINT (size), dpi); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1779 len += 11; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1780 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1781 else if (FLOATP (size)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1782 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1783 point_size = (int) XFLOAT_DATA (size); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1784 len += 11; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1785 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1786 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1787 if (len > nbytes) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1788 return -1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1789 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1790 p = name + sprintf (name, "%s", SDATA (family)); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1791 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1792 if (! NILP (weight)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1793 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1794 char *q = p; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1795 p += sprintf (p, " %s", SDATA (weight)); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1796 q[1] = toupper (q[1]); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1797 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1798 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1799 if (! NILP (slant)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1800 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1801 char *q = p; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1802 p += sprintf (p, " %s", SDATA (slant)); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1803 q[1] = toupper (q[1]); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1804 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1805 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1806 if (point_size > 0) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1807 p += sprintf (p, " %d", point_size); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1808 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1809 return (p - name); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1810 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1811 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1812 /* Parse NAME (null terminated) and store information in FONT |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1813 (font-spec or font-entity). If NAME is successfully parsed, return |
94926 | 1814 0. Otherwise return -1. */ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1815 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1816 static int |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1817 font_parse_name (name, font) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1818 char *name; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1819 Lisp_Object font; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1820 { |
101293
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
1821 if (name[0] == '-' || index (name, '*') || index (name, '?')) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1822 return font_parse_xlfd (name, font); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1823 return font_parse_fcname (name, font); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1824 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1825 |
94926 | 1826 |
1827 /* Merge FAMILY and REGISTRY into FONT_SPEC. FAMILY may have the form | |
1828 "FAMILY-FOUNDRY". REGISTRY may not contain charset-encoding | |
1829 part. */ | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
1830 |
90400 | 1831 void |
94926 | 1832 font_parse_family_registry (family, registry, font_spec) |
1833 Lisp_Object family, registry, font_spec; | |
90400 | 1834 { |
94926 | 1835 int len; |
1836 char *p0, *p1; | |
1837 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1838 if (! NILP (family) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1839 && NILP (AREF (font_spec, FONT_FAMILY_INDEX))) |
90400 | 1840 { |
94926 | 1841 CHECK_STRING (family); |
1842 len = SBYTES (family); | |
1843 p0 = (char *) SDATA (family); | |
1844 p1 = index (p0, '-'); | |
1845 if (p1) | |
90400 | 1846 { |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1847 if ((*p0 != '*' || p1 - p0 > 1) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1848 && NILP (AREF (font_spec, FONT_FOUNDRY_INDEX))) |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1849 Ffont_put (font_spec, QCfoundry, font_intern_prop (p0, p1 - p0, 1)); |
94926 | 1850 p1++; |
1851 len -= p1 - p0; | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1852 Ffont_put (font_spec, QCfamily, font_intern_prop (p1, len, 1)); |
90400 | 1853 } |
94926 | 1854 else |
1855 ASET (font_spec, FONT_FAMILY_INDEX, Fintern (family, Qnil)); | |
1856 } | |
1857 if (! NILP (registry)) | |
1858 { | |
1859 /* Convert "XXX" and "XXX*" to "XXX*-*". */ | |
1860 CHECK_STRING (registry); | |
1861 len = SBYTES (registry); | |
1862 p0 = (char *) SDATA (registry); | |
1863 p1 = index (p0, '-'); | |
1864 if (! p1) | |
1865 { | |
1866 if (SDATA (registry)[len - 1] == '*') | |
1867 registry = concat2 (registry, build_string ("-*")); | |
1868 else | |
1869 registry = concat2 (registry, build_string ("*-*")); | |
1870 } | |
1871 registry = Fdowncase (registry); | |
1872 ASET (font_spec, FONT_REGISTRY_INDEX, Fintern (registry, Qnil)); | |
90400 | 1873 } |
1874 } | |
1875 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
1876 |
94926 | 1877 /* This part (through the next ^L) is still experimental and not |
1878 tested much. We may drastically change codes. */ | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
1879 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
1880 /* OTF handler */ |
90541 | 1881 |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
1882 #if 0 |
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
1883 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1884 #define LGSTRING_HEADER_SIZE 6 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1885 #define LGSTRING_GLYPH_SIZE 8 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1886 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1887 static int |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1888 check_gstring (gstring) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1889 Lisp_Object gstring; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1890 { |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1891 Lisp_Object val; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1892 int i, j; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1893 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1894 CHECK_VECTOR (gstring); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1895 val = AREF (gstring, 0); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1896 CHECK_VECTOR (val); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1897 if (ASIZE (val) < LGSTRING_HEADER_SIZE) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1898 goto err; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1899 CHECK_FONT_OBJECT (LGSTRING_FONT (gstring)); |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1900 if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_LBEARING))) |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1901 CHECK_NUMBER (LGSTRING_SLOT (gstring, LGSTRING_IX_LBEARING)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1902 if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_RBEARING))) |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1903 CHECK_NUMBER (LGSTRING_SLOT (gstring, LGSTRING_IX_RBEARING)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1904 if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_WIDTH))) |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1905 CHECK_NATNUM (LGSTRING_SLOT (gstring, LGSTRING_IX_WIDTH)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1906 if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT))) |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1907 CHECK_NUMBER (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1908 if (!NILP (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT))) |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1909 CHECK_NUMBER (LGSTRING_SLOT (gstring, LGSTRING_IX_ASCENT)); |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1910 |
97822 | 1911 for (i = 0; i < LGSTRING_GLYPH_LEN (gstring); i++) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1912 { |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1913 val = LGSTRING_GLYPH (gstring, i); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1914 CHECK_VECTOR (val); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1915 if (ASIZE (val) < LGSTRING_GLYPH_SIZE) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1916 goto err; |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1917 if (NILP (AREF (val, LGLYPH_IX_CHAR))) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1918 break; |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1919 CHECK_NATNUM (AREF (val, LGLYPH_IX_FROM)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1920 CHECK_NATNUM (AREF (val, LGLYPH_IX_TO)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1921 CHECK_CHARACTER (AREF (val, LGLYPH_IX_CHAR)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1922 if (!NILP (AREF (val, LGLYPH_IX_CODE))) |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1923 CHECK_NATNUM (AREF (val, LGLYPH_IX_CODE)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1924 if (!NILP (AREF (val, LGLYPH_IX_WIDTH))) |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1925 CHECK_NATNUM (AREF (val, LGLYPH_IX_WIDTH)); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1926 if (!NILP (AREF (val, LGLYPH_IX_ADJUSTMENT))) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1927 { |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1928 val = AREF (val, LGLYPH_IX_ADJUSTMENT); |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1929 CHECK_VECTOR (val); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1930 if (ASIZE (val) < 3) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1931 goto err; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1932 for (j = 0; j < 3; j++) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1933 CHECK_NUMBER (AREF (val, j)); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1934 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1935 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1936 return i; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1937 err: |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1938 error ("Invalid glyph-string format"); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1939 return -1; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1940 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1941 |
90823
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1942 static void |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1943 check_otf_features (otf_features) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1944 Lisp_Object otf_features; |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1945 { |
94926 | 1946 Lisp_Object val; |
90823
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1947 |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1948 CHECK_CONS (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1949 CHECK_SYMBOL (XCAR (otf_features)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1950 otf_features = XCDR (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1951 CHECK_CONS (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1952 CHECK_SYMBOL (XCAR (otf_features)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1953 otf_features = XCDR (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1954 for (val = Fcar (otf_features); ! NILP (val); val = Fcdr (val)) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1955 { |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1956 CHECK_SYMBOL (Fcar (val)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1957 if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1958 error ("Invalid OTF GSUB feature: %s", SYMBOL_NAME (XCAR (val))); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1959 } |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1960 otf_features = XCDR (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1961 for (val = Fcar (otf_features); ! NILP (val); val = Fcdr (val)) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1962 { |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1963 CHECK_SYMBOL (Fcar (val)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1964 if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1965 error ("Invalid OTF GPOS feature: %s", SYMBOL_NAME (XCAR (val))); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1966 } |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1967 } |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1968 |
90400 | 1969 #ifdef HAVE_LIBOTF |
1970 #include <otf.h> | |
1971 | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1972 Lisp_Object otf_list; |
90400 | 1973 |
1974 static Lisp_Object | |
1975 otf_tag_symbol (tag) | |
1976 OTF_Tag tag; | |
1977 { | |
1978 char name[5]; | |
1979 | |
1980 OTF_tag_name (tag, name); | |
1981 return Fintern (make_unibyte_string (name, 4), Qnil); | |
1982 } | |
1983 | |
1984 static OTF * | |
94926 | 1985 otf_open (file) |
1986 Lisp_Object file; | |
90400 | 1987 { |
94926 | 1988 Lisp_Object val = Fassoc (file, otf_list); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1989 OTF *otf; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1990 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1991 if (! NILP (val)) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1992 otf = XSAVE_VALUE (XCDR (val))->pointer; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1993 else |
90400 | 1994 { |
94926 | 1995 otf = STRINGP (file) ? OTF_open ((char *) SDATA (file)) : NULL; |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1996 val = make_save_value (otf, 0); |
94926 | 1997 otf_list = Fcons (Fcons (file, val), otf_list); |
90400 | 1998 } |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1999 return otf; |
90400 | 2000 } |
2001 | |
2002 | |
2003 /* Return a list describing which scripts/languages FONT supports by | |
2004 which GSUB/GPOS features of OpenType tables. See the comment of | |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
2005 (struct font_driver).otf_capability. */ |
90400 | 2006 |
2007 Lisp_Object | |
2008 font_otf_capability (font) | |
2009 struct font *font; | |
2010 { | |
2011 OTF *otf; | |
2012 Lisp_Object capability = Fcons (Qnil, Qnil); | |
2013 int i; | |
2014 | |
94926 | 2015 otf = otf_open (font->props[FONT_FILE_INDEX]); |
90400 | 2016 if (! otf) |
2017 return Qnil; | |
2018 for (i = 0; i < 2; i++) | |
2019 { | |
2020 OTF_GSUB_GPOS *gsub_gpos; | |
2021 Lisp_Object script_list = Qnil; | |
2022 int j; | |
2023 | |
2024 if (OTF_get_features (otf, i == 0) < 0) | |
2025 continue; | |
2026 gsub_gpos = i == 0 ? otf->gsub : otf->gpos; | |
2027 for (j = gsub_gpos->ScriptList.ScriptCount - 1; j >= 0; j--) | |
2028 { | |
2029 OTF_Script *script = gsub_gpos->ScriptList.Script + j; | |
2030 Lisp_Object langsys_list = Qnil; | |
2031 Lisp_Object script_tag = otf_tag_symbol (script->ScriptTag); | |
2032 int k; | |
2033 | |
2034 for (k = script->LangSysCount; k >= 0; k--) | |
2035 { | |
2036 OTF_LangSys *langsys; | |
2037 Lisp_Object feature_list = Qnil; | |
2038 Lisp_Object langsys_tag; | |
2039 int l; | |
2040 | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2041 if (k == script->LangSysCount) |
90400 | 2042 { |
2043 langsys = &script->DefaultLangSys; | |
2044 langsys_tag = Qnil; | |
2045 } | |
2046 else | |
2047 { | |
2048 langsys = script->LangSys + k; | |
2049 langsys_tag | |
2050 = otf_tag_symbol (script->LangSysRecord[k].LangSysTag); | |
2051 } | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2052 for (l = langsys->FeatureCount - 1; l >= 0; l--) |
90400 | 2053 { |
2054 OTF_Feature *feature | |
2055 = gsub_gpos->FeatureList.Feature + langsys->FeatureIndex[l]; | |
2056 Lisp_Object feature_tag | |
2057 = otf_tag_symbol (feature->FeatureTag); | |
2058 | |
2059 feature_list = Fcons (feature_tag, feature_list); | |
2060 } | |
2061 langsys_list = Fcons (Fcons (langsys_tag, feature_list), | |
2062 langsys_list); | |
2063 } | |
2064 script_list = Fcons (Fcons (script_tag, langsys_list), | |
2065 script_list); | |
2066 } | |
2067 | |
2068 if (i == 0) | |
2069 XSETCAR (capability, script_list); | |
2070 else | |
2071 XSETCDR (capability, script_list); | |
2072 } | |
2073 | |
2074 return capability; | |
2075 } | |
2076 | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2077 /* Parse OTF features in SPEC and write a proper features spec string |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2078 in FEATURES for the call of OTF_drive_gsub/gpos (of libotf). It is |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2079 assured that the sufficient memory has already allocated for |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2080 FEATURES. */ |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2081 |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2082 static void |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2083 generate_otf_features (spec, features) |
90400 | 2084 Lisp_Object spec; |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2085 char *features; |
90400 | 2086 { |
2087 Lisp_Object val; | |
94926 | 2088 char *p; |
90400 | 2089 int asterisk; |
2090 | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2091 p = features; |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2092 *p = '\0'; |
90400 | 2093 for (asterisk = 0; CONSP (spec); spec = XCDR (spec)) |
2094 { | |
2095 val = XCAR (spec); | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2096 CHECK_SYMBOL (val); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2097 if (p > features) |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2098 *p++ = ','; |
90400 | 2099 if (SREF (SYMBOL_NAME (val), 0) == '*') |
2100 { | |
2101 asterisk = 1; | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2102 *p++ = '*'; |
90400 | 2103 } |
2104 else if (! asterisk) | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2105 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2106 val = SYMBOL_NAME (val); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2107 p += sprintf (p, "%s", SDATA (val)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2108 } |
90400 | 2109 else |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2110 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2111 val = SYMBOL_NAME (val); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2112 p += sprintf (p, "~%s", SDATA (val)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2113 } |
90400 | 2114 } |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2115 if (CONSP (spec)) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2116 error ("OTF spec too long"); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2117 } |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2118 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2119 Lisp_Object |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2120 font_otf_DeviceTable (device_table) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2121 OTF_DeviceTable *device_table; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2122 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2123 int len = device_table->StartSize - device_table->EndSize + 1; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2124 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2125 return Fcons (make_number (len), |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2126 make_unibyte_string (device_table->DeltaValue, len)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2127 } |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2128 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2129 Lisp_Object |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2130 font_otf_ValueRecord (value_format, value_record) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2131 int value_format; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2132 OTF_ValueRecord *value_record; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2133 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2134 Lisp_Object val = Fmake_vector (make_number (8), Qnil); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2135 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2136 if (value_format & OTF_XPlacement) |
91909 | 2137 ASET (val, 0, make_number (value_record->XPlacement)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2138 if (value_format & OTF_YPlacement) |
91909 | 2139 ASET (val, 1, make_number (value_record->YPlacement)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2140 if (value_format & OTF_XAdvance) |
91909 | 2141 ASET (val, 2, make_number (value_record->XAdvance)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2142 if (value_format & OTF_YAdvance) |
91909 | 2143 ASET (val, 3, make_number (value_record->YAdvance)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2144 if (value_format & OTF_XPlaDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2145 ASET (val, 4, font_otf_DeviceTable (&value_record->XPlaDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2146 if (value_format & OTF_YPlaDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2147 ASET (val, 4, font_otf_DeviceTable (&value_record->YPlaDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2148 if (value_format & OTF_XAdvDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2149 ASET (val, 4, font_otf_DeviceTable (&value_record->XAdvDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2150 if (value_format & OTF_YAdvDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2151 ASET (val, 4, font_otf_DeviceTable (&value_record->YAdvDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2152 return val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2153 } |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2154 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2155 Lisp_Object |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2156 font_otf_Anchor (anchor) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2157 OTF_Anchor *anchor; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2158 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2159 Lisp_Object val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2160 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2161 val = Fmake_vector (make_number (anchor->AnchorFormat + 1), Qnil); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2162 ASET (val, 0, make_number (anchor->XCoordinate)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2163 ASET (val, 1, make_number (anchor->YCoordinate)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2164 if (anchor->AnchorFormat == 2) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2165 ASET (val, 2, make_number (anchor->f.f1.AnchorPoint)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2166 else |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2167 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2168 ASET (val, 3, font_otf_DeviceTable (&anchor->f.f2.XDeviceTable)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2169 ASET (val, 4, font_otf_DeviceTable (&anchor->f.f2.YDeviceTable)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2170 } |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2171 return val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2172 } |
90400 | 2173 #endif /* HAVE_LIBOTF */ |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
2174 #endif /* 0 */ |
90400 | 2175 |
2176 | |
2177 /* Font sorting */ | |
2178 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2179 static unsigned font_score P_ ((Lisp_Object, Lisp_Object *)); |
90400 | 2180 static int font_compare P_ ((const void *, const void *)); |
2181 static Lisp_Object font_sort_entites P_ ((Lisp_Object, Lisp_Object, | |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2182 Lisp_Object, int)); |
90400 | 2183 |
100385
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2184 /* Return a rescaling ratio of FONT_ENTITY. */ |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2185 extern Lisp_Object Vface_font_rescale_alist; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2186 |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2187 static double |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2188 font_rescale_ratio (font_entity) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2189 Lisp_Object font_entity; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2190 { |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2191 Lisp_Object tail, elt; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2192 Lisp_Object name = Qnil; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2193 |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2194 for (tail = Vface_font_rescale_alist; CONSP (tail); tail = XCDR (tail)) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2195 { |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2196 elt = XCAR (tail); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2197 if (FLOATP (XCDR (elt))) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2198 { |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2199 if (STRINGP (XCAR (elt))) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2200 { |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2201 if (NILP (name)) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2202 name = Ffont_xlfd_name (font_entity, Qnil); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2203 if (fast_string_match_ignore_case (XCAR (elt), name) >= 0) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2204 return XFLOAT_DATA (XCDR (elt)); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2205 } |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2206 else if (FONT_SPEC_P (XCAR (elt))) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2207 { |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2208 if (font_match_p (XCAR (elt), font_entity)) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2209 return XFLOAT_DATA (XCDR (elt)); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2210 } |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2211 } |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2212 } |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2213 return 1.0; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2214 } |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2215 |
90400 | 2216 /* We sort fonts by scoring each of them against a specified |
2217 font-spec. The score value is 32 bit (`unsigned'), and the smaller | |
2218 the value is, the closer the font is to the font-spec. | |
2219 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2220 The lowest 2 bits of the score is used for driver type. The font |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2221 available by the most preferred font driver is 0. |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2222 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2223 Each 7-bit in the higher 28 bits are used for numeric properties |
90400 | 2224 WEIGHT, SLANT, WIDTH, and SIZE. */ |
2225 | |
2226 /* How many bits to shift to store the difference value of each font | |
94926 | 2227 property in a score. Note that flots for FONT_TYPE_INDEX and |
2228 FONT_REGISTRY_INDEX are not used. */ | |
90400 | 2229 static int sort_shift_bits[FONT_SIZE_INDEX + 1]; |
2230 | |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2231 /* Score font-entity ENTITY against properties of font-spec SPEC_PROP. |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2232 The return value indicates how different ENTITY is compared with |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2233 SPEC_PROP. */ |
90400 | 2234 |
2235 static unsigned | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2236 font_score (entity, spec_prop) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2237 Lisp_Object entity, *spec_prop; |
90400 | 2238 { |
2239 unsigned score = 0; | |
2240 int i; | |
94926 | 2241 |
2242 /* Score three style numeric fields. Maximum difference is 127. */ | |
2243 for (i = FONT_WEIGHT_INDEX; i <= FONT_WIDTH_INDEX; i++) | |
2244 if (! NILP (spec_prop[i]) && ! EQ (AREF (entity, i), spec_prop[i])) | |
2245 { | |
2246 int diff = (XINT (AREF (entity, i)) >> 8) - (XINT (spec_prop[i]) >> 8); | |
2247 | |
2248 if (diff < 0) | |
2249 diff = - diff; | |
95875
d56319d0f726
(font_score): Ignore the diffference of alias style symbols.
Kenichi Handa <handa@m17n.org>
parents:
95869
diff
changeset
|
2250 if (diff > 0) |
d56319d0f726
(font_score): Ignore the diffference of alias style symbols.
Kenichi Handa <handa@m17n.org>
parents:
95869
diff
changeset
|
2251 score |= min (diff, 127) << sort_shift_bits[i]; |
94926 | 2252 } |
2253 | |
2254 /* Score the size. Maximum difference is 127. */ | |
2255 i = FONT_SIZE_INDEX; | |
100385
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2256 if (! NILP (spec_prop[FONT_SIZE_INDEX]) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2257 && XINT (AREF (entity, FONT_SIZE_INDEX)) > 0) |
90400 | 2258 { |
94926 | 2259 /* We use the higher 6-bit for the actual size difference. The |
2260 lowest bit is set if the DPI is different. */ | |
100385
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2261 int diff; |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2262 int pixel_size = XINT (spec_prop[FONT_SIZE_INDEX]); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2263 |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2264 if (CONSP (Vface_font_rescale_alist)) |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2265 pixel_size *= font_rescale_ratio (entity); |
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2266 diff = pixel_size - XINT (AREF (entity, FONT_SIZE_INDEX)); |
94926 | 2267 if (diff < 0) |
2268 diff = - diff; | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2269 diff <<= 1; |
94926 | 2270 if (! NILP (spec_prop[FONT_DPI_INDEX]) |
2271 && ! EQ (spec_prop[FONT_DPI_INDEX], AREF (entity, FONT_DPI_INDEX))) | |
2272 diff |= 1; | |
103041
3049105cf79e
(font_score): Check AVGWIDTH too.
Kenichi Handa <handa@m17n.org>
parents:
103037
diff
changeset
|
2273 if (! NILP (spec_prop[FONT_AVGWIDTH_INDEX]) |
3049105cf79e
(font_score): Check AVGWIDTH too.
Kenichi Handa <handa@m17n.org>
parents:
103037
diff
changeset
|
2274 && ! EQ (spec_prop[FONT_AVGWIDTH_INDEX], AREF (entity, FONT_AVGWIDTH_INDEX))) |
3049105cf79e
(font_score): Check AVGWIDTH too.
Kenichi Handa <handa@m17n.org>
parents:
103037
diff
changeset
|
2275 diff |= 1; |
94926 | 2276 score |= min (diff, 127) << sort_shift_bits[FONT_SIZE_INDEX]; |
90400 | 2277 } |
2278 | |
2279 return score; | |
2280 } | |
2281 | |
2282 | |
2283 /* The comparison function for qsort. */ | |
2284 | |
2285 static int | |
2286 font_compare (d1, d2) | |
2287 const void *d1, *d2; | |
2288 { | |
94926 | 2289 return (*(unsigned *) d1 - *(unsigned *) d2); |
90400 | 2290 } |
2291 | |
2292 | |
2293 /* The structure for elements being sorted by qsort. */ | |
2294 struct font_sort_data | |
2295 { | |
2296 unsigned score; | |
2297 Lisp_Object entity; | |
2298 }; | |
2299 | |
2300 | |
2301 /* Sort font-entities in vector VEC by closeness to font-spec PREFER. | |
2302 If PREFER specifies a point-size, calculate the corresponding | |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2303 pixel-size from QCdpi property of PREFER or from the Y-resolution |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2304 of FRAME before sorting. |
94926 | 2305 |
102990
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2306 If BEST-ONLY is nonzero, return the best matching entity (that |
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2307 supports the character BEST-ONLY if BEST-ONLY is positive, or any |
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2308 if BEST-ONLY is negative). Otherwise, return the sorted VEC. |
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2309 |
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2310 This function does no optimization for the case that the length of |
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2311 VEC is 1. The caller should avoid calling this in such a case. */ |
90400 | 2312 |
2313 static Lisp_Object | |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2314 font_sort_entites (vec, prefer, frame, best_only) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2315 Lisp_Object vec, prefer, frame; |
94926 | 2316 int best_only; |
90400 | 2317 { |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2318 Lisp_Object prefer_prop[FONT_SPEC_MAX]; |
90400 | 2319 int len, i; |
2320 struct font_sort_data *data; | |
94926 | 2321 unsigned best_score; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2322 Lisp_Object best_entity, driver_type; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2323 int driver_order; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2324 struct frame *f = XFRAME (frame); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2325 struct font_driver_list *list; |
90400 | 2326 USE_SAFE_ALLOCA; |
2327 | |
2328 len = ASIZE (vec); | |
96224
0fdf03fe1e8d
(font_score): Even if the PIXEL_SIZE is the same, check
Kenichi Handa <handa@m17n.org>
parents:
96200
diff
changeset
|
2329 for (i = FONT_WEIGHT_INDEX; i <= FONT_DPI_INDEX; i++) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2330 prefer_prop[i] = AREF (prefer, i); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2331 if (FLOATP (prefer_prop[FONT_SIZE_INDEX])) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2332 prefer_prop[FONT_SIZE_INDEX] |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2333 = make_number (font_pixel_size (XFRAME (frame), prefer)); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2334 |
90400 | 2335 /* Scoring and sorting. */ |
2336 SAFE_ALLOCA (data, struct font_sort_data *, (sizeof *data) * len); | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2337 /* We are sure that the length of VEC > 1. */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2338 driver_type = AREF (AREF (vec, 0), FONT_TYPE_INDEX); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2339 for (driver_order = 0, list = f->font_driver_list; list; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2340 driver_order++, list = list->next) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2341 if (EQ (driver_type, list->driver->type)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2342 break; |
102990
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2343 best_score = 0xFFFFFFFF; |
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2344 best_entity = Qnil; |
90400 | 2345 for (i = 0; i < len; i++) |
2346 { | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2347 if (!EQ (driver_type, AREF (AREF (vec, i), FONT_TYPE_INDEX))) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2348 for (driver_order = 0, list = f->font_driver_list; list; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2349 driver_order++, list = list->next) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2350 if (EQ (driver_type, list->driver->type)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2351 break; |
90400 | 2352 data[i].entity = AREF (vec, i); |
102990
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2353 data[i].score |
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2354 = (best_only <= 0 || font_has_char (f, data[i].entity, best_only) > 0 |
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2355 ? font_score (data[i].entity, prefer_prop) | driver_order |
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
2356 : 0xFFFFFFFF); |
94926 | 2357 if (best_only && best_score > data[i].score) |
2358 { | |
2359 best_score = data[i].score; | |
2360 best_entity = data[i].entity; | |
2361 if (best_score == 0) | |
2362 break; | |
2363 } | |
90400 | 2364 } |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2365 if (! best_only) |
94926 | 2366 { |
2367 qsort (data, len, sizeof *data, font_compare); | |
2368 for (i = 0; i < len; i++) | |
2369 ASET (vec, i, data[i].entity); | |
2370 } | |
2371 else | |
2372 vec = best_entity; | |
90400 | 2373 SAFE_FREE (); |
2374 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2375 font_add_log ("sort-by", prefer, vec); |
90400 | 2376 return vec; |
2377 } | |
2378 | |
2379 | |
2380 /* API of Font Service Layer. */ | |
2381 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2382 /* Reflect ORDER (see the variable font_sort_order in xfaces.c) to |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2383 sort_shift_bits. Finternal_set_font_selection_order calls this |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2384 function with font_sort_order after setting up it. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2385 |
90400 | 2386 void |
2387 font_update_sort_order (order) | |
2388 int *order; | |
2389 { | |
94926 | 2390 int i, shift_bits; |
2391 | |
95869
14ab94c436d7
(font_update_sort_order): Setting of sort_shift_bits adjusted for the
Kenichi Handa <handa@m17n.org>
parents:
95867
diff
changeset
|
2392 for (i = 0, shift_bits = 23; i < 4; i++, shift_bits -= 7) |
90400 | 2393 { |
2394 int xlfd_idx = order[i]; | |
2395 | |
2396 if (xlfd_idx == XLFD_WEIGHT_INDEX) | |
2397 sort_shift_bits[FONT_WEIGHT_INDEX] = shift_bits; | |
2398 else if (xlfd_idx == XLFD_SLANT_INDEX) | |
2399 sort_shift_bits[FONT_SLANT_INDEX] = shift_bits; | |
2400 else if (xlfd_idx == XLFD_SWIDTH_INDEX) | |
2401 sort_shift_bits[FONT_WIDTH_INDEX] = shift_bits; | |
2402 else | |
2403 sort_shift_bits[FONT_SIZE_INDEX] = shift_bits; | |
2404 } | |
2405 } | |
2406 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2407 static int |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2408 font_check_otf_features (script, langsys, features, table) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2409 Lisp_Object script, langsys, features, table; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2410 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2411 Lisp_Object val; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2412 int negative; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2413 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2414 table = assq_no_quit (script, table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2415 if (NILP (table)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2416 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2417 table = XCDR (table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2418 if (! NILP (langsys)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2419 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2420 table = assq_no_quit (langsys, table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2421 if (NILP (table)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2422 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2423 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2424 else |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2425 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2426 val = assq_no_quit (Qnil, table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2427 if (NILP (val)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2428 table = XCAR (table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2429 else |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2430 table = val; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2431 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2432 table = XCDR (table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2433 for (negative = 0; CONSP (features); features = XCDR (features)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2434 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2435 if (NILP (XCAR (features))) |
102082
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
2436 { |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
2437 negative = 1; |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
2438 continue; |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
2439 } |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2440 if (NILP (Fmemq (XCAR (features), table)) != negative) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2441 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2442 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2443 return 1; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2444 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2445 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2446 /* Check if OTF_CAPABILITY satisfies SPEC (otf-spec). */ |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2447 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2448 static int |
96573
3de01ebe30b7
* fontset.c (fontset_get_font_group):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96565
diff
changeset
|
2449 font_check_otf (Lisp_Object spec, Lisp_Object otf_capability) |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2450 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2451 Lisp_Object script, langsys = Qnil, gsub = Qnil, gpos = Qnil; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2452 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2453 script = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2454 spec = XCDR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2455 if (! NILP (spec)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2456 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2457 langsys = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2458 spec = XCDR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2459 if (! NILP (spec)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2460 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2461 gsub = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2462 spec = XCDR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2463 if (! NILP (spec)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2464 gpos = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2465 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2466 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2467 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2468 if (! NILP (gsub) && ! font_check_otf_features (script, langsys, gsub, |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2469 XCAR (otf_capability))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2470 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2471 if (! NILP (gpos) && ! font_check_otf_features (script, langsys, gpos, |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2472 XCDR (otf_capability))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2473 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2474 return 1; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2475 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2476 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2477 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2478 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2479 /* Check if FONT (font-entity or font-object) matches with the font |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2480 specification SPEC. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2481 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2482 int |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2483 font_match_p (spec, font) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2484 Lisp_Object spec, font; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2485 { |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2486 Lisp_Object prop[FONT_SPEC_MAX], *props; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2487 Lisp_Object extra, font_extra; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2488 int i; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2489 |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2490 for (i = FONT_FOUNDRY_INDEX; i <= FONT_REGISTRY_INDEX; i++) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2491 if (! NILP (AREF (spec, i)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2492 && ! NILP (AREF (font, i)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2493 && ! EQ (AREF (spec, i), AREF (font, i))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2494 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2495 props = XFONT_SPEC (spec)->props; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2496 if (FLOATP (props[FONT_SIZE_INDEX])) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2497 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2498 for (i = FONT_FOUNDRY_INDEX; i < FONT_SIZE_INDEX; i++) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2499 prop[i] = AREF (spec, i); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2500 prop[FONT_SIZE_INDEX] |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2501 = make_number (font_pixel_size (XFRAME (selected_frame), spec)); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2502 props = prop; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2503 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2504 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2505 if (font_score (font, props) > 0) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2506 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2507 extra = AREF (spec, FONT_EXTRA_INDEX); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2508 font_extra = AREF (font, FONT_EXTRA_INDEX); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2509 for (; CONSP (extra); extra = XCDR (extra)) |
94926 | 2510 { |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2511 Lisp_Object key = XCAR (XCAR (extra)); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2512 Lisp_Object val = XCDR (XCAR (extra)), val2; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2513 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2514 if (EQ (key, QClang)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2515 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2516 val2 = assq_no_quit (key, font_extra); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2517 if (NILP (val2)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2518 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2519 val2 = XCDR (val2); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2520 if (CONSP (val)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2521 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2522 if (! CONSP (val2)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2523 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2524 while (CONSP (val)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2525 if (NILP (Fmemq (val, val2))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2526 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2527 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2528 else |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2529 if (CONSP (val2) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2530 ? NILP (Fmemq (val, XCDR (val2))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2531 : ! EQ (val, val2)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2532 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2533 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2534 else if (EQ (key, QCscript)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2535 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2536 val2 = assq_no_quit (val, Vscript_representative_chars); |
99075
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2537 if (CONSP (val2)) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2538 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2539 val2 = XCDR (val2); |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2540 if (CONSP (val2)) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2541 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2542 /* All characters in the list must be supported. */ |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2543 for (; CONSP (val2); val2 = XCDR (val2)) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2544 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2545 if (! NATNUMP (XCAR (val2))) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2546 continue; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2547 if (font_encode_char (font, XFASTINT (XCAR (val2))) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2548 == FONT_INVALID_CODE) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2549 return 0; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2550 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2551 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2552 else if (VECTORP (val2)) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2553 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2554 /* At most one character in the vector must be supported. */ |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2555 for (i = 0; i < ASIZE (val2); i++) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2556 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2557 if (! NATNUMP (AREF (val2, i))) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2558 continue; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2559 if (font_encode_char (font, XFASTINT (AREF (val2, i))) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2560 != FONT_INVALID_CODE) |
99076
06c37ccf1b58
(font_match_p): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
99075
diff
changeset
|
2561 break; |
99075
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2562 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2563 if (i == ASIZE (val2)) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2564 return 0; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2565 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2566 } |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2567 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2568 else if (EQ (key, QCotf)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2569 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2570 struct font *fontp; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2571 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2572 if (! FONT_OBJECT_P (font)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2573 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2574 fontp = XFONT_OBJECT (font); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2575 if (! fontp->driver->otf_capability) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2576 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2577 val2 = fontp->driver->otf_capability (fontp); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2578 if (NILP (val2) || ! font_check_otf (val, val2)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2579 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2580 } |
94926 | 2581 } |
2582 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2583 return 1; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2584 } |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2585 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
2586 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2587 /* Font cache |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2588 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2589 Each font backend has the callback function get_cache, and it |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2590 returns a cons cell of which cdr part can be freely used for |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2591 caching fonts. The cons cell may be shared by multiple frames |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2592 and/or multiple font drivers. So, we arrange the cdr part as this: |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2593 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2594 ((DRIVER-TYPE NUM-FRAMES FONT-CACHE-DATA ...) ...) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2595 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2596 where DRIVER-TYPE is a symbol such as `x', `xft', etc., NUM-FRAMES |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2597 is a number frames sharing this cache, and FONT-CACHE-DATA is a |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2598 cons (FONT-SPEC FONT-ENTITY ...). */ |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2599 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2600 static void font_prepare_cache P_ ((FRAME_PTR, struct font_driver *)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2601 static void font_finish_cache P_ ((FRAME_PTR, struct font_driver *)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2602 static Lisp_Object font_get_cache P_ ((FRAME_PTR, struct font_driver *)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2603 static void font_clear_cache P_ ((FRAME_PTR, Lisp_Object, |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2604 struct font_driver *)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2605 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2606 static void |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2607 font_prepare_cache (f, driver) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2608 FRAME_PTR f; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2609 struct font_driver *driver; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2610 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2611 Lisp_Object cache, val; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2612 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2613 cache = driver->get_cache (f); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2614 val = XCDR (cache); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2615 while (CONSP (val) && ! EQ (XCAR (XCAR (val)), driver->type)) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2616 val = XCDR (val); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2617 if (NILP (val)) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2618 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2619 val = Fcons (driver->type, Fcons (make_number (1), Qnil)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2620 XSETCDR (cache, Fcons (val, XCDR (cache))); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2621 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2622 else |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2623 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2624 val = XCDR (XCAR (val)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2625 XSETCAR (val, make_number (XINT (XCAR (val)) + 1)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2626 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2627 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2628 |
91909 | 2629 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2630 static void |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2631 font_finish_cache (f, driver) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2632 FRAME_PTR f; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2633 struct font_driver *driver; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2634 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2635 Lisp_Object cache, val, tmp; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2636 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2637 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2638 cache = driver->get_cache (f); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2639 val = XCDR (cache); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2640 while (CONSP (val) && ! EQ (XCAR (XCAR (val)), driver->type)) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2641 cache = val, val = XCDR (val); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2642 font_assert (! NILP (val)); |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2643 tmp = XCDR (XCAR (val)); |
91909 | 2644 XSETCAR (tmp, make_number (XINT (XCAR (tmp)) - 1)); |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2645 if (XINT (XCAR (tmp)) == 0) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2646 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2647 font_clear_cache (f, XCAR (val), driver); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2648 XSETCDR (cache, XCDR (val)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2649 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2650 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2651 |
91909 | 2652 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2653 static Lisp_Object |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2654 font_get_cache (f, driver) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2655 FRAME_PTR f; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2656 struct font_driver *driver; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2657 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2658 Lisp_Object val = driver->get_cache (f); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2659 Lisp_Object type = driver->type; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2660 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2661 font_assert (CONSP (val)); |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2662 for (val = XCDR (val); ! EQ (XCAR (XCAR (val)), type); val = XCDR (val)); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2663 font_assert (CONSP (val)); |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2664 /* VAL = ((DRIVER-TYPE NUM-FRAMES FONT-CACHE-DATA ...) ...) */ |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2665 val = XCDR (XCAR (val)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2666 return val; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2667 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2668 |
91909 | 2669 static int num_fonts; |
2670 | |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2671 static void |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2672 font_clear_cache (f, cache, driver) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2673 FRAME_PTR f; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2674 Lisp_Object cache; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2675 struct font_driver *driver; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2676 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2677 Lisp_Object tail, elt; |
100442
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2678 Lisp_Object tail2, entity; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
2679 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2680 /* CACHE = (DRIVER-TYPE NUM-FRAMES FONT-CACHE-DATA ...) */ |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2681 for (tail = XCDR (XCDR (cache)); CONSP (tail); tail = XCDR (tail)) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2682 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2683 elt = XCAR (tail); |
100442
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2684 /* elt should have the form (FONT-SPEC FONT-ENTITY ...) */ |
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2685 if (CONSP (elt) && FONT_SPEC_P (XCAR (elt))) |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2686 { |
100442
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2687 for (tail2 = XCDR (elt); CONSP (tail2); tail2 = XCDR (tail2)) |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2688 { |
100442
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2689 entity = XCAR (tail2); |
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2690 |
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2691 if (FONT_ENTITY_P (entity) |
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
2692 && EQ (driver->type, AREF (entity, FONT_TYPE_INDEX))) |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2693 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2694 Lisp_Object objlist = AREF (entity, FONT_OBJLIST_INDEX); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2695 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2696 for (; CONSP (objlist); objlist = XCDR (objlist)) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2697 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2698 Lisp_Object val = XCAR (objlist); |
94926 | 2699 struct font *font = XFONT_OBJECT (val); |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2700 |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2701 if (! NILP (AREF (val, FONT_TYPE_INDEX))) |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2702 { |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2703 font_assert (font && driver == font->driver); |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2704 driver->close (f, font); |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2705 num_fonts--; |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2706 } |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2707 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2708 if (driver->free_entity) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2709 driver->free_entity (entity); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2710 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2711 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2712 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2713 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2714 XSETCDR (cache, Qnil); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2715 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2716 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2717 |
90400 | 2718 static Lisp_Object scratch_font_spec, scratch_font_prefer; |
2719 | |
94926 | 2720 Lisp_Object |
2721 font_delete_unmatched (list, spec, size) | |
2722 Lisp_Object list, spec; | |
2723 int size; | |
2724 { | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2725 Lisp_Object entity, val; |
94926 | 2726 enum font_property_index prop; |
2727 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2728 for (val = Qnil; CONSP (list); list = XCDR (list)) |
94926 | 2729 { |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2730 entity = XCAR (list); |
94926 | 2731 for (prop = FONT_WEIGHT_INDEX; prop < FONT_SIZE_INDEX; prop++) |
2732 if (INTEGERP (AREF (spec, prop)) | |
2733 && ((XINT (AREF (spec, prop)) >> 8) | |
2734 != (XINT (AREF (entity, prop)) >> 8))) | |
2735 prop = FONT_SPEC_MAX; | |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2736 if (prop < FONT_SPEC_MAX |
94926 | 2737 && size |
2738 && XINT (AREF (entity, FONT_SIZE_INDEX)) > 0) | |
2739 { | |
2740 int diff = XINT (AREF (entity, FONT_SIZE_INDEX)) - size; | |
2741 | |
2742 if (diff != 0 | |
2743 && (diff < 0 ? -diff > FONT_PIXEL_SIZE_QUANTUM | |
2744 : diff > FONT_PIXEL_SIZE_QUANTUM)) | |
2745 prop = FONT_SPEC_MAX; | |
2746 } | |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2747 if (prop < FONT_SPEC_MAX |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2748 && INTEGERP (AREF (spec, FONT_DPI_INDEX)) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2749 && INTEGERP (AREF (entity, FONT_DPI_INDEX)) |
98581
bd9b20fa24a6
(font_delete_unmatched): Fix previous change. Don't
Kenichi Handa <handa@m17n.org>
parents:
98451
diff
changeset
|
2750 && XINT (AREF (entity, FONT_DPI_INDEX)) != 0 |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2751 && ! EQ (AREF (spec, FONT_DPI_INDEX), AREF (entity, FONT_DPI_INDEX))) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2752 prop = FONT_SPEC_MAX; |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2753 if (prop < FONT_SPEC_MAX |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2754 && INTEGERP (AREF (spec, FONT_AVGWIDTH_INDEX)) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2755 && INTEGERP (AREF (entity, FONT_AVGWIDTH_INDEX)) |
98581
bd9b20fa24a6
(font_delete_unmatched): Fix previous change. Don't
Kenichi Handa <handa@m17n.org>
parents:
98451
diff
changeset
|
2756 && XINT (AREF (entity, FONT_AVGWIDTH_INDEX)) != 0 |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2757 && ! EQ (AREF (spec, FONT_AVGWIDTH_INDEX), |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2758 AREF (entity, FONT_AVGWIDTH_INDEX))) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2759 prop = FONT_SPEC_MAX; |
94926 | 2760 if (prop < FONT_SPEC_MAX) |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2761 val = Fcons (entity, val); |
94926 | 2762 } |
102943
67e0d4d902b4
(font_delete_unmatched): Preserve the order of list
Kenichi Handa <handa@m17n.org>
parents:
102897
diff
changeset
|
2763 return Fnreverse (val); |
94926 | 2764 } |
2765 | |
2766 | |
2767 /* Return a vector of font-entities matching with SPEC on FRAME. */ | |
2768 | |
2769 Lisp_Object | |
90400 | 2770 font_list_entities (frame, spec) |
2771 Lisp_Object frame, spec; | |
2772 { | |
2773 FRAME_PTR f = XFRAME (frame); | |
2774 struct font_driver_list *driver_list = f->font_driver_list; | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2775 Lisp_Object ftype, val; |
94926 | 2776 Lisp_Object *vec; |
2777 int size; | |
2778 int need_filtering = 0; | |
90400 | 2779 int i; |
2780 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2781 font_assert (FONT_SPEC_P (spec)); |
90400 | 2782 |
94926 | 2783 if (INTEGERP (AREF (spec, FONT_SIZE_INDEX))) |
2784 size = XINT (AREF (spec, FONT_SIZE_INDEX)); | |
2785 else if (FLOATP (AREF (spec, FONT_SIZE_INDEX))) | |
2786 size = font_pixel_size (f, spec); | |
2787 else | |
2788 size = 0; | |
2789 | |
90400 | 2790 ftype = AREF (spec, FONT_TYPE_INDEX); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2791 for (i = FONT_FOUNDRY_INDEX; i <= FONT_REGISTRY_INDEX; i++) |
94926 | 2792 ASET (scratch_font_spec, i, AREF (spec, i)); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2793 for (i = FONT_WEIGHT_INDEX; i < FONT_EXTRA_INDEX; i++) |
94926 | 2794 { |
2795 ASET (scratch_font_spec, i, Qnil); | |
2796 if (! NILP (AREF (spec, i))) | |
2797 need_filtering = 1; | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2798 if (i == FONT_DPI_INDEX) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2799 /* Skip FONT_SPACING_INDEX */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2800 i++; |
94926 | 2801 } |
95359
f6580a4c58da
(font_parse_family_registry): Use Ffont_put to validate
Kenichi Handa <handa@m17n.org>
parents:
95290
diff
changeset
|
2802 ASET (scratch_font_spec, FONT_SPACING_INDEX, AREF (spec, FONT_SPACING_INDEX)); |
94926 | 2803 ASET (scratch_font_spec, FONT_EXTRA_INDEX, AREF (spec, FONT_EXTRA_INDEX)); |
2804 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2805 vec = alloca (sizeof (Lisp_Object) * num_font_drivers); |
94926 | 2806 if (! vec) |
2807 return null_vector; | |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
2808 |
90400 | 2809 for (i = 0; driver_list; driver_list = driver_list->next) |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
2810 if (driver_list->on |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
2811 && (NILP (ftype) || EQ (driver_list->driver->type, ftype))) |
90400 | 2812 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2813 Lisp_Object cache = font_get_cache (f, driver_list->driver); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2814 |
95437
6e6db01383e4
(font_list_entities): Fix the car part of data to be
Kenichi Handa <handa@m17n.org>
parents:
95421
diff
changeset
|
2815 ASET (scratch_font_spec, FONT_TYPE_INDEX, driver_list->driver->type); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2816 val = assoc_no_quit (scratch_font_spec, XCDR (cache)); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2817 if (CONSP (val)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2818 val = XCDR (val); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2819 else |
90400 | 2820 { |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2821 Lisp_Object copy; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2822 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2823 val = driver_list->driver->list (frame, scratch_font_spec); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2824 copy = Fcopy_font_spec (scratch_font_spec); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2825 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2826 XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); |
90400 | 2827 } |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2828 if (! NILP (val) && need_filtering) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2829 val = font_delete_unmatched (val, spec, size); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2830 if (! NILP (val)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2831 vec[i++] = val; |
90400 | 2832 } |
94926 | 2833 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2834 val = (i > 0 ? Fvconcat (i, vec) : null_vector); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2835 font_add_log ("list", spec, val); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2836 return (val); |
90400 | 2837 } |
2838 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2839 |
94926 | 2840 /* Return a font entity matching with SPEC on FRAME. ATTRS, if non |
2841 nil, is an array of face's attributes, which specifies preferred | |
2842 font-related attributes. */ | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2843 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2844 static Lisp_Object |
94926 | 2845 font_matching_entity (f, attrs, spec) |
2846 FRAME_PTR f; | |
2847 Lisp_Object *attrs, spec; | |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2848 { |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2849 struct font_driver_list *driver_list = f->font_driver_list; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2850 Lisp_Object ftype, size, entity; |
94926 | 2851 Lisp_Object frame; |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2852 Lisp_Object work = Fcopy_font_spec (spec); |
94926 | 2853 |
2854 XSETFRAME (frame, f); | |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2855 ftype = AREF (spec, FONT_TYPE_INDEX); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2856 size = AREF (spec, FONT_SIZE_INDEX); |
98451
db015b441c0c
* nsfont.m (nsfont_spec_to_traits): Use UnXX masks only for non-normal styles. (nsfont_open): Reenable the cache.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
98445
diff
changeset
|
2857 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2858 if (FLOATP (size)) |
98451
db015b441c0c
* nsfont.m (nsfont_spec_to_traits): Use UnXX masks only for non-normal styles. (nsfont_open): Reenable the cache.
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
98445
diff
changeset
|
2859 ASET (work, FONT_SIZE_INDEX, make_number (font_pixel_size (f, spec))); |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2860 FONT_SET_STYLE (work, FONT_WEIGHT_INDEX, attrs[LFACE_WEIGHT_INDEX]); |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2861 FONT_SET_STYLE (work, FONT_SLANT_INDEX, attrs[LFACE_SLANT_INDEX]); |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2862 FONT_SET_STYLE (work, FONT_WIDTH_INDEX, attrs[LFACE_SWIDTH_INDEX]); |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2863 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2864 entity = Qnil; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2865 for (; driver_list; driver_list = driver_list->next) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2866 if (driver_list->on |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2867 && (NILP (ftype) || EQ (driver_list->driver->type, ftype))) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2868 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2869 Lisp_Object cache = font_get_cache (f, driver_list->driver); |
95104
ae4280e6a166
(font_list_entities): Fix handling of cache.
Kenichi Handa <handa@m17n.org>
parents:
95013
diff
changeset
|
2870 Lisp_Object copy; |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2871 |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2872 ASET (work, FONT_TYPE_INDEX, driver_list->driver->type); |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2873 entity = assoc_no_quit (work, XCDR (cache)); |
95104
ae4280e6a166
(font_list_entities): Fix handling of cache.
Kenichi Handa <handa@m17n.org>
parents:
95013
diff
changeset
|
2874 if (CONSP (entity)) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2875 entity = XCDR (entity); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2876 else |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2877 { |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2878 entity = driver_list->driver->match (frame, work); |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2879 copy = Fcopy_font_spec (work); |
95104
ae4280e6a166
(font_list_entities): Fix handling of cache.
Kenichi Handa <handa@m17n.org>
parents:
95013
diff
changeset
|
2880 ASET (copy, FONT_TYPE_INDEX, driver_list->driver->type); |
ae4280e6a166
(font_list_entities): Fix handling of cache.
Kenichi Handa <handa@m17n.org>
parents:
95013
diff
changeset
|
2881 XSETCDR (cache, Fcons (Fcons (copy, entity), XCDR (cache))); |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2882 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2883 if (! NILP (entity)) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2884 break; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2885 } |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2886 font_add_log ("match", work, entity); |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2887 return entity; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2888 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2889 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2890 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2891 /* Open a font of ENTITY and PIXEL_SIZE on frame F, and return the |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2892 opened font object. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2893 |
90400 | 2894 static Lisp_Object |
2895 font_open_entity (f, entity, pixel_size) | |
2896 FRAME_PTR f; | |
2897 Lisp_Object entity; | |
2898 int pixel_size; | |
2899 { | |
2900 struct font_driver_list *driver_list; | |
91909 | 2901 Lisp_Object objlist, size, val, font_object; |
90400 | 2902 struct font *font; |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
2903 int min_width, height; |
100445
e412b5885b9d
(font_open_entity): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
100442
diff
changeset
|
2904 int scaled_pixel_size; |
94926 | 2905 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2906 font_assert (FONT_ENTITY_P (entity)); |
90400 | 2907 size = AREF (entity, FONT_SIZE_INDEX); |
2908 if (XINT (size) != 0) | |
100445
e412b5885b9d
(font_open_entity): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
100442
diff
changeset
|
2909 scaled_pixel_size = pixel_size = XINT (size); |
100385
4504aa7cb434
(font_rescale_ratio): Moved from xfaces.c. Argument
Kenichi Handa <handa@m17n.org>
parents:
100336
diff
changeset
|
2910 else if (CONSP (Vface_font_rescale_alist)) |
100445
e412b5885b9d
(font_open_entity): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
100442
diff
changeset
|
2911 scaled_pixel_size = pixel_size * font_rescale_ratio (entity); |
90400 | 2912 |
2913 for (objlist = AREF (entity, FONT_OBJLIST_INDEX); CONSP (objlist); | |
2914 objlist = XCDR (objlist)) | |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2915 if (! NILP (AREF (XCAR (objlist), FONT_TYPE_INDEX)) |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2916 && XFONT_OBJECT (XCAR (objlist))->pixel_size == pixel_size) |
94926 | 2917 return XCAR (objlist); |
2918 | |
2919 val = AREF (entity, FONT_TYPE_INDEX); | |
2920 for (driver_list = f->font_driver_list; | |
2921 driver_list && ! EQ (driver_list->driver->type, val); | |
2922 driver_list = driver_list->next); | |
2923 if (! driver_list) | |
2924 return Qnil; | |
2925 | |
100445
e412b5885b9d
(font_open_entity): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
100442
diff
changeset
|
2926 font_object = driver_list->driver->open (f, entity, scaled_pixel_size); |
e412b5885b9d
(font_open_entity): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
100442
diff
changeset
|
2927 ASET (font_object, FONT_SIZE_INDEX, make_number (pixel_size)); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2928 font_add_log ("open", entity, font_object); |
91909 | 2929 if (NILP (font_object)) |
94926 | 2930 return Qnil; |
2931 ASET (entity, FONT_OBJLIST_INDEX, | |
2932 Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX))); | |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2933 ASET (font_object, FONT_OBJLIST_INDEX, Qnil); |
94926 | 2934 num_fonts++; |
2935 | |
2936 font = XFONT_OBJECT (font_object); | |
2937 min_width = (font->min_width ? font->min_width | |
2938 : font->average_width ? font->average_width | |
2939 : font->space_width ? font->space_width | |
2940 : 1); | |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
2941 height = (font->height ? font->height : 1); |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
2942 #ifdef HAVE_WINDOW_SYSTEM |
94926 | 2943 FRAME_X_DISPLAY_INFO (f)->n_fonts++; |
2944 if (FRAME_X_DISPLAY_INFO (f)->n_fonts == 1) | |
91909 | 2945 { |
94926 | 2946 FRAME_SMALLEST_CHAR_WIDTH (f) = min_width; |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
2947 FRAME_SMALLEST_FONT_HEIGHT (f) = height; |
94926 | 2948 fonts_changed_p = 1; |
91909 | 2949 } |
94926 | 2950 else |
2951 { | |
2952 if (FRAME_SMALLEST_CHAR_WIDTH (f) > min_width) | |
2953 FRAME_SMALLEST_CHAR_WIDTH (f) = min_width, fonts_changed_p = 1; | |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
2954 if (FRAME_SMALLEST_FONT_HEIGHT (f) > height) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
2955 FRAME_SMALLEST_FONT_HEIGHT (f) = height, fonts_changed_p = 1; |
94926 | 2956 } |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
2957 #endif |
91909 | 2958 |
2959 return font_object; | |
90400 | 2960 } |
2961 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2962 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2963 /* Close FONT_OBJECT that is opened on frame F. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2964 |
90400 | 2965 void |
2966 font_close_object (f, font_object) | |
2967 FRAME_PTR f; | |
2968 Lisp_Object font_object; | |
2969 { | |
94926 | 2970 struct font *font = XFONT_OBJECT (font_object); |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2971 |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2972 if (NILP (AREF (font_object, FONT_TYPE_INDEX))) |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2973 /* Already closed. */ |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2974 return; |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2975 font_add_log ("close", font_object, Qnil); |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2976 font->driver->close (f, font); |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
2977 #ifdef HAVE_WINDOW_SYSTEM |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2978 font_assert (FRAME_X_DISPLAY_INFO (f)->n_fonts); |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2979 FRAME_X_DISPLAY_INFO (f)->n_fonts--; |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
2980 #endif |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2981 num_fonts--; |
90400 | 2982 } |
2983 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2984 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
2985 /* Return 1 if FONT on F has a glyph for character C, 0 if not, -1 if |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
2986 FONT is a font-entity and it must be opened to check. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2987 |
90400 | 2988 int |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2989 font_has_char (f, font, c) |
90400 | 2990 FRAME_PTR f; |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2991 Lisp_Object font; |
90400 | 2992 int c; |
2993 { | |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2994 struct font *fontp; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2995 |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2996 if (FONT_ENTITY_P (font)) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2997 { |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2998 Lisp_Object type = AREF (font, FONT_TYPE_INDEX); |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2999 struct font_driver_list *driver_list; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3000 |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3001 for (driver_list = f->font_driver_list; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3002 driver_list && ! EQ (driver_list->driver->type, type); |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3003 driver_list = driver_list->next); |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3004 if (! driver_list) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3005 return 0; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3006 if (! driver_list->driver->has_char) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3007 return -1; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3008 return driver_list->driver->has_char (font, c); |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3009 } |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3010 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
3011 font_assert (FONT_OBJECT_P (font)); |
94926 | 3012 fontp = XFONT_OBJECT (font); |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3013 if (fontp->driver->has_char) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3014 { |
94926 | 3015 int result = fontp->driver->has_char (font, c); |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3016 |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3017 if (result >= 0) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3018 return result; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3019 } |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3020 return (fontp->driver->encode_char (fontp, c) != FONT_INVALID_CODE); |
90400 | 3021 } |
3022 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3023 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3024 /* Return the glyph ID of FONT_OBJECT for character C. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3025 |
90400 | 3026 unsigned |
3027 font_encode_char (font_object, c) | |
3028 Lisp_Object font_object; | |
3029 int c; | |
3030 { | |
94926 | 3031 struct font *font; |
3032 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
3033 font_assert (FONT_OBJECT_P (font_object)); |
94926 | 3034 font = XFONT_OBJECT (font_object); |
90400 | 3035 return font->driver->encode_char (font, c); |
3036 } | |
3037 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3038 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3039 /* Return the name of FONT_OBJECT. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3040 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3041 Lisp_Object |
90400 | 3042 font_get_name (font_object) |
3043 Lisp_Object font_object; | |
3044 { | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
3045 font_assert (FONT_OBJECT_P (font_object)); |
94926 | 3046 return AREF (font_object, FONT_NAME_INDEX); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3047 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3048 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3049 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3050 /* Return the specification of FONT_OBJECT. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3051 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3052 Lisp_Object |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3053 font_get_spec (font_object) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3054 Lisp_Object font_object; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3055 { |
94926 | 3056 Lisp_Object spec = font_make_spec (); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3057 int i; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3058 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3059 for (i = 0; i < FONT_SIZE_INDEX; i++) |
94926 | 3060 ASET (spec, i, AREF (font_object, i)); |
3061 ASET (spec, FONT_SIZE_INDEX, | |
3062 make_number (XFONT_OBJECT (font_object)->pixel_size)); | |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3063 return spec; |
90400 | 3064 } |
3065 | |
101293
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3066 |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3067 /* Create a new font spec from FONT_NAME, and return it. If FONT_NAME |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3068 could not be parsed by font_parse_name, return Qnil. */ |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3069 |
90400 | 3070 Lisp_Object |
94926 | 3071 font_spec_from_name (font_name) |
3072 Lisp_Object font_name; | |
3073 { | |
101293
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3074 Lisp_Object spec = Ffont_spec (0, NULL); |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3075 |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3076 CHECK_STRING (font_name); |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3077 if (font_parse_name ((char *) SDATA (font_name), spec) == -1) |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3078 return Qnil; |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3079 font_put_extra (spec, QCname, font_name); |
558e0d4ded9a
(font_spec_from_name): Return Qnil if font name could not be parsed.
Chong Yidong <cyd@stupidchicken.com>
parents:
101226
diff
changeset
|
3080 return spec; |
94926 | 3081 } |
3082 | |
3083 | |
3084 void | |
3085 font_clear_prop (attrs, prop) | |
3086 Lisp_Object *attrs; | |
3087 enum font_property_index prop; | |
3088 { | |
3089 Lisp_Object font = attrs[LFACE_FONT_INDEX]; | |
3090 | |
3091 if (! FONTP (font)) | |
3092 return; | |
102897
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3093 if (! NILP (Ffont_get (font, QCname))) |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3094 { |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3095 font = Fcopy_font_spec (font); |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3096 font_put_extra (font, QCname, Qnil); |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3097 } |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3098 |
94926 | 3099 if (NILP (AREF (font, prop)) |
98717
507c5c477e60
(font_clear_prop): When clearing font width, clear the average width
Chong Yidong <cyd@stupidchicken.com>
parents:
98655
diff
changeset
|
3100 && prop != FONT_FAMILY_INDEX |
507c5c477e60
(font_clear_prop): When clearing font width, clear the average width
Chong Yidong <cyd@stupidchicken.com>
parents:
98655
diff
changeset
|
3101 && prop != FONT_FOUNDRY_INDEX |
507c5c477e60
(font_clear_prop): When clearing font width, clear the average width
Chong Yidong <cyd@stupidchicken.com>
parents:
98655
diff
changeset
|
3102 && prop != FONT_WIDTH_INDEX |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3103 && prop != FONT_SIZE_INDEX) |
94926 | 3104 return; |
102897
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3105 if (EQ (font, attrs[LFACE_FONT_INDEX])) |
9a6e5b1105a6
(font_put_extra): If VAL is nil, delete the slot for PROP
Kenichi Handa <handa@m17n.org>
parents:
102708
diff
changeset
|
3106 font = Fcopy_font_spec (font); |
94926 | 3107 ASET (font, prop, Qnil); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3108 if (prop == FONT_FAMILY_INDEX || prop == FONT_FOUNDRY_INDEX) |
94926 | 3109 { |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3110 if (prop == FONT_FAMILY_INDEX) |
101156
fe4728c4a48b
(font_clear_prop): If clearing the family, clear the font width index
Chong Yidong <cyd@stupidchicken.com>
parents:
101028
diff
changeset
|
3111 { |
fe4728c4a48b
(font_clear_prop): If clearing the family, clear the font width index
Chong Yidong <cyd@stupidchicken.com>
parents:
101028
diff
changeset
|
3112 ASET (font, FONT_FOUNDRY_INDEX, Qnil); |
fe4728c4a48b
(font_clear_prop): If clearing the family, clear the font width index
Chong Yidong <cyd@stupidchicken.com>
parents:
101028
diff
changeset
|
3113 /* If we are setting the font family, we must also clear |
fe4728c4a48b
(font_clear_prop): If clearing the family, clear the font width index
Chong Yidong <cyd@stupidchicken.com>
parents:
101028
diff
changeset
|
3114 FONT_WIDTH_INDEX to avoid rejecting families that lack |
fe4728c4a48b
(font_clear_prop): If clearing the family, clear the font width index
Chong Yidong <cyd@stupidchicken.com>
parents:
101028
diff
changeset
|
3115 support for some widths. */ |
fe4728c4a48b
(font_clear_prop): If clearing the family, clear the font width index
Chong Yidong <cyd@stupidchicken.com>
parents:
101028
diff
changeset
|
3116 ASET (font, FONT_WIDTH_INDEX, Qnil); |
fe4728c4a48b
(font_clear_prop): If clearing the family, clear the font width index
Chong Yidong <cyd@stupidchicken.com>
parents:
101028
diff
changeset
|
3117 } |
94926 | 3118 ASET (font, FONT_ADSTYLE_INDEX, Qnil); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3119 ASET (font, FONT_REGISTRY_INDEX, Qnil); |
94926 | 3120 ASET (font, FONT_SIZE_INDEX, Qnil); |
3121 ASET (font, FONT_DPI_INDEX, Qnil); | |
3122 ASET (font, FONT_SPACING_INDEX, Qnil); | |
3123 ASET (font, FONT_AVGWIDTH_INDEX, Qnil); | |
3124 } | |
3125 else if (prop == FONT_SIZE_INDEX) | |
3126 { | |
3127 ASET (font, FONT_DPI_INDEX, Qnil); | |
3128 ASET (font, FONT_SPACING_INDEX, Qnil); | |
3129 ASET (font, FONT_AVGWIDTH_INDEX, Qnil); | |
3130 } | |
98717
507c5c477e60
(font_clear_prop): When clearing font width, clear the average width
Chong Yidong <cyd@stupidchicken.com>
parents:
98655
diff
changeset
|
3131 else if (prop == FONT_WIDTH_INDEX) |
507c5c477e60
(font_clear_prop): When clearing font width, clear the average width
Chong Yidong <cyd@stupidchicken.com>
parents:
98655
diff
changeset
|
3132 ASET (font, FONT_AVGWIDTH_INDEX, Qnil); |
94926 | 3133 attrs[LFACE_FONT_INDEX] = font; |
3134 } | |
3135 | |
3136 void | |
3137 font_update_lface (f, attrs) | |
3138 FRAME_PTR f; | |
3139 Lisp_Object *attrs; | |
90400 | 3140 { |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
3141 Lisp_Object spec; |
94926 | 3142 |
3143 spec = attrs[LFACE_FONT_INDEX]; | |
3144 if (! FONT_SPEC_P (spec)) | |
3145 return; | |
3146 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3147 if (! NILP (AREF (spec, FONT_FOUNDRY_INDEX))) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3148 attrs[LFACE_FOUNDRY_INDEX] = SYMBOL_NAME (AREF (spec, FONT_FOUNDRY_INDEX)); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3149 if (! NILP (AREF (spec, FONT_FAMILY_INDEX))) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3150 attrs[LFACE_FAMILY_INDEX] = SYMBOL_NAME (AREF (spec, FONT_FAMILY_INDEX)); |
94926 | 3151 if (! NILP (AREF (spec, FONT_WEIGHT_INDEX))) |
3152 attrs[LFACE_WEIGHT_INDEX] = FONT_WEIGHT_FOR_FACE (spec); | |
3153 if (! NILP (AREF (spec, FONT_SLANT_INDEX))) | |
101943
97c9e9322753
Remove spurious semicolons.
Juanma Barranquero <lekktu@gmail.com>
parents:
101806
diff
changeset
|
3154 attrs[LFACE_SLANT_INDEX] = FONT_SLANT_FOR_FACE (spec); |
94926 | 3155 if (! NILP (AREF (spec, FONT_WIDTH_INDEX))) |
3156 attrs[LFACE_SWIDTH_INDEX] = FONT_WIDTH_FOR_FACE (spec); | |
3157 if (! NILP (AREF (spec, FONT_SIZE_INDEX))) | |
3158 { | |
3159 int point; | |
3160 | |
3161 if (INTEGERP (AREF (spec, FONT_SIZE_INDEX))) | |
3162 { | |
3163 Lisp_Object val; | |
3164 int dpi = f->resy; | |
3165 | |
3166 val = Ffont_get (spec, QCdpi); | |
3167 if (! NILP (val)) | |
3168 dpi = XINT (val); | |
3169 point = PIXEL_TO_POINT (XINT (AREF (spec, FONT_SIZE_INDEX)) * 10, | |
3170 dpi); | |
100167
b80052504b85
Handle fonts with corrupted size specs, i.e. non-int and non-float.
Chong Yidong <cyd@stupidchicken.com>
parents:
100165
diff
changeset
|
3171 attrs[LFACE_HEIGHT_INDEX] = make_number (point); |
94926 | 3172 } |
3173 else if (FLOATP (AREF (spec, FONT_SIZE_INDEX))) | |
100167
b80052504b85
Handle fonts with corrupted size specs, i.e. non-int and non-float.
Chong Yidong <cyd@stupidchicken.com>
parents:
100165
diff
changeset
|
3174 { |
b80052504b85
Handle fonts with corrupted size specs, i.e. non-int and non-float.
Chong Yidong <cyd@stupidchicken.com>
parents:
100165
diff
changeset
|
3175 point = XFLOAT_DATA (AREF (spec, FONT_SIZE_INDEX)) * 10; |
b80052504b85
Handle fonts with corrupted size specs, i.e. non-int and non-float.
Chong Yidong <cyd@stupidchicken.com>
parents:
100165
diff
changeset
|
3176 attrs[LFACE_HEIGHT_INDEX] = make_number (point); |
b80052504b85
Handle fonts with corrupted size specs, i.e. non-int and non-float.
Chong Yidong <cyd@stupidchicken.com>
parents:
100165
diff
changeset
|
3177 } |
94926 | 3178 } |
90400 | 3179 } |
3180 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3181 |
102415
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3182 /* Selecte a font from ENTITIES that supports C and matches best with |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3183 ATTRS and PIXEL_SIZE. */ |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3184 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3185 static Lisp_Object |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3186 font_select_entity (frame, entities, attrs, pixel_size, c) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3187 Lisp_Object frame, entities, *attrs; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3188 int pixel_size, c; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3189 { |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3190 Lisp_Object font_entity; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3191 Lisp_Object prefer; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3192 Lisp_Object props[FONT_REGISTRY_INDEX + 1] ; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3193 int result, i; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3194 FRAME_PTR f = XFRAME (frame); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3195 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3196 if (ASIZE (entities) == 1) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3197 { |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3198 font_entity = AREF (entities, 0); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3199 if (c < 0 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3200 || (result = font_has_char (f, font_entity, c)) > 0) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3201 return font_entity; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3202 return Qnil; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3203 } |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3204 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3205 /* Sort fonts by properties specified in ATTRS. */ |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3206 prefer = scratch_font_prefer; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3207 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3208 for (i = FONT_WEIGHT_INDEX; i <= FONT_SIZE_INDEX; i++) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3209 ASET (prefer, i, Qnil); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3210 if (FONTP (attrs[LFACE_FONT_INDEX])) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3211 { |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3212 Lisp_Object face_font = attrs[LFACE_FONT_INDEX]; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3213 |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3214 for (i = FONT_WEIGHT_INDEX; i <= FONT_SIZE_INDEX; i++) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3215 ASET (prefer, i, AREF (face_font, i)); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3216 } |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3217 if (NILP (AREF (prefer, FONT_WEIGHT_INDEX))) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3218 FONT_SET_STYLE (prefer, FONT_WEIGHT_INDEX, attrs[LFACE_WEIGHT_INDEX]); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3219 if (NILP (AREF (prefer, FONT_SLANT_INDEX))) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3220 FONT_SET_STYLE (prefer, FONT_SLANT_INDEX, attrs[LFACE_SLANT_INDEX]); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3221 if (NILP (AREF (prefer, FONT_WIDTH_INDEX))) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3222 FONT_SET_STYLE (prefer, FONT_WIDTH_INDEX, attrs[LFACE_SWIDTH_INDEX]); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3223 ASET (prefer, FONT_SIZE_INDEX, make_number (pixel_size)); |
102990
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
3224 |
a706504f064e
(font_sort_entites): Change the meaning of the arg
Kenichi Handa <handa@m17n.org>
parents:
102963
diff
changeset
|
3225 return font_sort_entites (entities, prefer, frame, c); |
102415
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3226 } |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3227 |
94926 | 3228 /* Return a font-entity satisfying SPEC and best matching with face's |
3229 font related attributes in ATTRS. C, if not negative, is a | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
3230 character that the entity must support. */ |
90400 | 3231 |
3232 Lisp_Object | |
94926 | 3233 font_find_for_lface (f, attrs, spec, c) |
90400 | 3234 FRAME_PTR f; |
94926 | 3235 Lisp_Object *attrs; |
90400 | 3236 Lisp_Object spec; |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
3237 int c; |
90400 | 3238 { |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3239 Lisp_Object work; |
94926 | 3240 Lisp_Object frame, entities, val, props[FONT_REGISTRY_INDEX + 1] ; |
96200
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3241 Lisp_Object size, foundry[3], *family, registry[3], adstyle[3]; |
95475
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3242 int pixel_size; |
96200
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3243 int i, j, k, l, result; |
95888
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3244 |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3245 registry[0] = AREF (spec, FONT_REGISTRY_INDEX); |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3246 if (NILP (registry[0])) |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3247 { |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
3248 registry[0] = DEFAULT_ENCODING; |
95888
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3249 registry[1] = Qascii_0; |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3250 registry[2] = null_vector; |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3251 } |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3252 else |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3253 registry[1] = null_vector; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3254 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3255 if (c >= 0 && ! NILP (AREF (spec, FONT_REGISTRY_INDEX))) |
94926 | 3256 { |
3257 struct charset *encoding, *repertory; | |
3258 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3259 if (font_registry_charsets (AREF (spec, FONT_REGISTRY_INDEX), |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3260 &encoding, &repertory) < 0) |
94926 | 3261 return Qnil; |
3262 if (repertory) | |
3263 { | |
3264 if (ENCODE_CHAR (repertory, c) == CHARSET_INVALID_CODE (repertory)) | |
3265 return Qnil; | |
3266 /* Any font of this registry support C. So, let's | |
3267 suppress the further checking. */ | |
3268 c = -1; | |
3269 } | |
3270 else if (c > encoding->max_char) | |
3271 return Qnil; | |
3272 } | |
3273 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3274 work = Fcopy_font_spec (spec); |
90507
4a6034a7c870
(font_find_for_lface): Code optimized.
Kenichi Handa <handa@m17n.org>
parents:
90503
diff
changeset
|
3275 XSETFRAME (frame, f); |
94926 | 3276 size = AREF (spec, FONT_SIZE_INDEX); |
95475
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3277 pixel_size = font_pixel_size (f, spec); |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3278 if (pixel_size == 0) |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3279 { |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3280 double pt = XINT (attrs[LFACE_HEIGHT_INDEX]); |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3281 |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3282 pixel_size = POINT_TO_PIXEL (pt / 10, f->resy); |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3283 } |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3284 ASET (work, FONT_SIZE_INDEX, Qnil); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3285 foundry[0] = AREF (work, FONT_FOUNDRY_INDEX); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3286 if (! NILP (foundry[0])) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3287 foundry[1] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3288 else if (STRINGP (attrs[LFACE_FOUNDRY_INDEX])) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3289 { |
97822 | 3290 val = attrs[LFACE_FOUNDRY_INDEX]; |
3291 foundry[0] = font_intern_prop ((char *) SDATA (val), SBYTES (val), 1); | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3292 foundry[1] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3293 foundry[2] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3294 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3295 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3296 foundry[0] = Qnil, foundry[1] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3297 |
96200
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3298 adstyle[0] = AREF (work, FONT_ADSTYLE_INDEX); |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3299 if (! NILP (adstyle[0])) |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3300 adstyle[1] = null_vector; |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3301 else if (FONTP (attrs[LFACE_FONT_INDEX])) |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3302 { |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3303 Lisp_Object face_font = attrs[LFACE_FONT_INDEX]; |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3304 |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3305 if (! NILP (AREF (face_font, FONT_ADSTYLE_INDEX))) |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3306 { |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3307 adstyle[0] = AREF (face_font, FONT_ADSTYLE_INDEX); |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3308 adstyle[1] = Qnil; |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3309 adstyle[2] = null_vector; |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3310 } |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3311 else |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3312 adstyle[0] = Qnil, adstyle[1] = null_vector; |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3313 } |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3314 else |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3315 adstyle[0] = Qnil, adstyle[1] = null_vector; |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3316 |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3317 |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3318 val = AREF (work, FONT_FAMILY_INDEX); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3319 if (NILP (val) && STRINGP (attrs[LFACE_FAMILY_INDEX])) |
97822 | 3320 { |
3321 val = attrs[LFACE_FAMILY_INDEX]; | |
3322 val = font_intern_prop ((char *) SDATA (val), SBYTES (val), 1); | |
3323 } | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3324 if (NILP (val)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3325 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3326 family = alloca ((sizeof family[0]) * 2); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3327 family[0] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3328 family[1] = null_vector; /* terminator. */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3329 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3330 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3331 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3332 Lisp_Object alters |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3333 = Fassoc_string (val, Vface_alternative_font_family_alist, |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3334 #ifndef HAVE_NS |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3335 Qt |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3336 #else |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3337 Qnil |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3338 #endif |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3339 ); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3340 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3341 if (! NILP (alters)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3342 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3343 family = alloca ((sizeof family[0]) * (XINT (Flength (alters)) + 2)); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3344 for (i = 0; CONSP (alters); i++, alters = XCDR (alters)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3345 family[i] = XCAR (alters); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3346 if (NILP (AREF (spec, FONT_FAMILY_INDEX))) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3347 family[i++] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3348 family[i] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3349 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3350 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3351 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3352 family = alloca ((sizeof family[0]) * 3); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3353 i = 0; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3354 family[i++] = val; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3355 if (NILP (AREF (spec, FONT_FAMILY_INDEX))) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3356 family[i++] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3357 family[i] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3358 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3359 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3360 |
95888
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3361 for (i = 0; SYMBOLP (family[i]); i++) |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3362 { |
95888
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3363 ASET (work, FONT_FAMILY_INDEX, family[i]); |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3364 for (j = 0; SYMBOLP (foundry[j]); j++) |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3365 { |
95888
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3366 ASET (work, FONT_FOUNDRY_INDEX, foundry[j]); |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3367 for (k = 0; SYMBOLP (registry[k]); k++) |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3368 { |
95890
e6e6c351339d
(font_find_for_lface): Fix typo of the previous change.
Kenichi Handa <handa@m17n.org>
parents:
95888
diff
changeset
|
3369 ASET (work, FONT_REGISTRY_INDEX, registry[k]); |
96200
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3370 for (l = 0; SYMBOLP (adstyle[l]); l++) |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3371 { |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3372 ASET (work, FONT_ADSTYLE_INDEX, adstyle[l]); |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3373 entities = font_list_entities (frame, work); |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3374 if (ASIZE (entities) > 0) |
102415
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3375 { |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3376 val = font_select_entity (frame, entities, |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3377 attrs, pixel_size, c); |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3378 if (! NILP (val)) |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3379 return val; |
ccbe1c8ab377
(font_select_entity): New function.
Kenichi Handa <handa@m17n.org>
parents:
102298
diff
changeset
|
3380 } |
96200
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3381 } |
95888
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3382 } |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3383 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3384 } |
95888
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3385 return Qnil; |
90400 | 3386 } |
3387 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3388 |
90400 | 3389 Lisp_Object |
94926 | 3390 font_open_for_lface (f, entity, attrs, spec) |
90400 | 3391 FRAME_PTR f; |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3392 Lisp_Object entity; |
94926 | 3393 Lisp_Object *attrs; |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3394 Lisp_Object spec; |
90400 | 3395 { |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
3396 int size; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
3397 |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3398 if (INTEGERP (AREF (entity, FONT_SIZE_INDEX)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3399 && XINT (AREF (entity, FONT_SIZE_INDEX)) > 0) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3400 size = XINT (AREF (entity, FONT_SIZE_INDEX)); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3401 else if (FONT_SPEC_P (spec) && ! NILP (AREF (spec, FONT_SIZE_INDEX))) |
95475
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3402 size = font_pixel_size (f, spec); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3403 else |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3404 { |
100985
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3405 double pt; |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3406 if (INTEGERP (attrs[LFACE_HEIGHT_INDEX])) |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3407 pt = XINT (attrs[LFACE_HEIGHT_INDEX]); |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3408 else |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3409 { |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3410 struct face *def = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3411 Lisp_Object height = def->lface[LFACE_HEIGHT_INDEX]; |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3412 if (INTEGERP (height)) |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3413 pt = XINT (height); |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3414 else |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3415 abort(); /* We should never end up here. */ |
f82bae05534c
(font_open_for_lface): Handle unspecified height attribute.
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
3416 } |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3417 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3418 pt /= 10; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3419 size = POINT_TO_PIXEL (pt, f->resy); |
96831
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3420 #ifdef HAVE_NS |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3421 if (size == 0) |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3422 { |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3423 Lisp_Object ffsize = get_frame_param(f, Qfontsize); |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3424 size = NUMBERP (ffsize) ? POINT_TO_PIXEL (XINT (ffsize), f->resy) : 0; |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3425 } |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3426 #endif |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3427 } |
90400 | 3428 return font_open_entity (f, entity, size); |
3429 } | |
3430 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3431 |
94926 | 3432 /* Find a font satisfying SPEC and best matching with face's |
3433 attributes in ATTRS on FRAME, and return the opened | |
3434 font-object. */ | |
3435 | |
3436 Lisp_Object | |
3437 font_load_for_lface (f, attrs, spec) | |
90400 | 3438 FRAME_PTR f; |
94926 | 3439 Lisp_Object *attrs, spec; |
90400 | 3440 { |
94926 | 3441 Lisp_Object entity; |
3442 | |
103037
e04bcedc08be
(font_load_for_lface): Cancel previous change.
Kenichi Handa <handa@m17n.org>
parents:
103019
diff
changeset
|
3443 entity = font_find_for_lface (f, attrs, spec, -1); |
94926 | 3444 if (NILP (entity)) |
91350
9673276f310c
(font_load_for_face): Handle the case that the font in
Kenichi Handa <handa@m17n.org>
parents:
91337
diff
changeset
|
3445 { |
94926 | 3446 /* No font is listed for SPEC, but each font-backend may have |
3447 the different criteria about "font matching". So, try | |
3448 it. */ | |
3449 entity = font_matching_entity (f, attrs, spec); | |
3450 if (NILP (entity)) | |
3451 return Qnil; | |
91350
9673276f310c
(font_load_for_face): Handle the case that the font in
Kenichi Handa <handa@m17n.org>
parents:
91337
diff
changeset
|
3452 } |
94926 | 3453 return font_open_for_lface (f, entity, attrs, spec); |
90400 | 3454 } |
3455 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3456 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3457 /* Make FACE on frame F ready to use the font opened for FACE. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3458 |
90400 | 3459 void |
3460 font_prepare_for_face (f, face) | |
3461 FRAME_PTR f; | |
3462 struct face *face; | |
3463 { | |
94926 | 3464 if (face->font->driver->prepare_face) |
3465 face->font->driver->prepare_face (f, face); | |
90400 | 3466 } |
3467 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3468 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3469 /* Make FACE on frame F stop using the font opened for FACE. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3470 |
90400 | 3471 void |
3472 font_done_for_face (f, face) | |
3473 FRAME_PTR f; | |
3474 struct face *face; | |
3475 { | |
94926 | 3476 if (face->font->driver->done_face) |
3477 face->font->driver->done_face (f, face); | |
90400 | 3478 face->extra = NULL; |
3479 } | |
3480 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3481 |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3482 /* Open a font matching with font-spec SPEC on frame F. If no proper |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3483 font is found, return Qnil. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3484 |
90400 | 3485 Lisp_Object |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3486 font_open_by_spec (f, spec) |
90400 | 3487 FRAME_PTR f; |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3488 Lisp_Object spec; |
90400 | 3489 { |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3490 Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3491 |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3492 /* We set up the default font-related attributes of a face to prefer |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3493 a moderate font. */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3494 attrs[LFACE_FAMILY_INDEX] = attrs[LFACE_FOUNDRY_INDEX] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3495 attrs[LFACE_SWIDTH_INDEX] = attrs[LFACE_WEIGHT_INDEX] |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3496 = attrs[LFACE_SLANT_INDEX] = Qnormal; |
96831
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3497 #ifndef HAVE_NS |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3498 attrs[LFACE_HEIGHT_INDEX] = make_number (120); |
96831
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3499 #else |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3500 attrs[LFACE_HEIGHT_INDEX] = make_number (0); |
47bb47a5494d
restore ability under NS to change font size from font panel (lost during some recent font backend refactoring)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96675
diff
changeset
|
3501 #endif |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3502 attrs[LFACE_FONT_INDEX] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3503 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3504 return font_load_for_lface (f, attrs, spec); |
90400 | 3505 } |
3506 | |
3507 | |
102483
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3508 /* Open a font matching with NAME on frame F. If no proper font is |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3509 found, return Qnil. */ |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3510 |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3511 Lisp_Object |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3512 font_open_by_name (f, name) |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3513 FRAME_PTR f; |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3514 char *name; |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3515 { |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3516 Lisp_Object args[2]; |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3517 Lisp_Object spec; |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3518 |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3519 args[0] = QCname; |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3520 args[1] = make_unibyte_string (name, strlen (name)); |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3521 spec = Ffont_spec (2, args); |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3522 return font_open_by_spec (f, spec); |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3523 } |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3524 |
d25713758c3e
(font_open_by_spec): New function.
Kenichi Handa <handa@m17n.org>
parents:
102415
diff
changeset
|
3525 |
90400 | 3526 /* Register font-driver DRIVER. This function is used in two ways. |
3527 | |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3528 The first is with frame F non-NULL. In this case, make DRIVER |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3529 available (but not yet activated) on F. All frame creaters |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3530 (e.g. Fx_create_frame) must call this function at least once with |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3531 an available font-driver. |
90400 | 3532 |
3533 The second is with frame F NULL. In this case, DRIVER is globally | |
3534 registered in the variable `font_driver_list'. All font-driver | |
3535 implementations must call this function in its syms_of_XXXX | |
3536 (e.g. syms_of_xfont). */ | |
3537 | |
3538 void | |
3539 register_font_driver (driver, f) | |
3540 struct font_driver *driver; | |
3541 FRAME_PTR f; | |
3542 { | |
3543 struct font_driver_list *root = f ? f->font_driver_list : font_driver_list; | |
3544 struct font_driver_list *prev, *list; | |
3545 | |
3546 if (f && ! driver->draw) | |
92113
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
3547 error ("Unusable font driver for a frame: %s", |
90400 | 3548 SDATA (SYMBOL_NAME (driver->type))); |
3549 | |
3550 for (prev = NULL, list = root; list; prev = list, list = list->next) | |
90695
a1cd7344d6a2
(font_parse_xlfd): Fix the array size of `f'.
Kenichi Handa <handa@m17n.org>
parents:
90677
diff
changeset
|
3551 if (EQ (list->driver->type, driver->type)) |
90400 | 3552 error ("Duplicated font driver: %s", SDATA (SYMBOL_NAME (driver->type))); |
3553 | |
100103
c2ef1c8b2d64
(register_font_driver): Use xmalloc.
Andreas Schwab <schwab@suse.de>
parents:
99076
diff
changeset
|
3554 list = xmalloc (sizeof (struct font_driver_list)); |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3555 list->on = 0; |
90400 | 3556 list->driver = driver; |
3557 list->next = NULL; | |
3558 if (prev) | |
3559 prev->next = list; | |
3560 else if (f) | |
3561 f->font_driver_list = list; | |
3562 else | |
3563 font_driver_list = list; | |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
3564 if (! f) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
3565 num_font_drivers++; |
90400 | 3566 } |
3567 | |
100406
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3568 void |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3569 free_font_driver_list (f) |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3570 FRAME_PTR f; |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3571 { |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3572 struct font_driver_list *list, *next; |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3573 |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3574 for (list = f->font_driver_list; list; list = next) |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3575 { |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3576 next = list->next; |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3577 xfree (list); |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3578 } |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3579 f->font_driver_list = NULL; |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3580 } |
b8012399df73
(free_font_driver_list): Implement missing function.
Chong Yidong <cyd@stupidchicken.com>
parents:
100385
diff
changeset
|
3581 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3582 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3583 /* Make the frame F use font backends listed in NEW_DRIVERS (list of |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
3584 symbols, e.g. xft, x). If NEW_DRIVERS is t, make F use all |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
3585 available font drivers. If NEW_DRIVERS is nil, finalize all drivers. |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
3586 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
3587 A caller must free all realized faces if any in advance. The |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
3588 return value is a list of font backends actually made used on |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
3589 F. */ |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
3590 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
3591 Lisp_Object |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
3592 font_update_drivers (f, new_drivers) |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3593 FRAME_PTR f; |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3594 Lisp_Object new_drivers; |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3595 { |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3596 Lisp_Object active_drivers = Qnil; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3597 struct font_driver *driver; |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3598 struct font_driver_list *list; |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3599 |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3600 /* At first, turn off non-requested drivers, and turn on requested |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3601 drivers. */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3602 for (list = f->font_driver_list; list; list = list->next) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3603 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3604 driver = list->driver; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3605 if ((EQ (new_drivers, Qt) || ! NILP (Fmemq (driver->type, new_drivers))) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3606 != list->on) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3607 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3608 if (list->on) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3609 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3610 if (driver->end_for_frame) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3611 driver->end_for_frame (f); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3612 font_finish_cache (f, driver); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3613 list->on = 0; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3614 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3615 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3616 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3617 if (! driver->start_for_frame |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3618 || driver->start_for_frame (f) == 0) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3619 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3620 font_prepare_cache (f, driver); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3621 list->on = 1; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3622 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3623 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3624 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3625 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3626 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3627 if (NILP (new_drivers)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3628 return Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3629 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3630 if (! EQ (new_drivers, Qt)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3631 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3632 /* Re-order the driver list according to new_drivers. */ |
95958
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3633 struct font_driver_list **list_table, **next; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3634 Lisp_Object tail; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3635 int i; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3636 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3637 list_table = alloca (sizeof list_table[0] * (num_font_drivers + 1)); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3638 for (i = 0, tail = new_drivers; ! NILP (tail); tail = XCDR (tail)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3639 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3640 for (list = f->font_driver_list; list; list = list->next) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3641 if (list->on && EQ (list->driver->type, XCAR (tail))) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3642 break; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3643 if (list) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3644 list_table[i++] = list; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3645 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3646 for (list = f->font_driver_list; list; list = list->next) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3647 if (! list->on) |
100442
71dc8b382715
(font_update_drivers): Fix mistake in reconstructing the driver list.
Chong Yidong <cyd@stupidchicken.com>
parents:
100406
diff
changeset
|
3648 list_table[i++] = list; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3649 list_table[i] = NULL; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3650 |
95958
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3651 next = &f->font_driver_list; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3652 for (i = 0; list_table[i]; i++) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3653 { |
95958
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3654 *next = list_table[i]; |
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3655 next = &(*next)->next; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3656 } |
95958
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3657 *next = NULL; |
103162
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3658 |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3659 if (! f->font_driver_list->on) |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3660 { /* None of the drivers is enabled: enable them all. |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3661 Happens if you set the list of drivers to (xft x) in your .emacs |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3662 and then use it under w32 or ns. */ |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3663 for (list = f->font_driver_list; list; list = list->next) |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3664 { |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3665 struct font_driver *driver = list->driver; |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3666 eassert (! list->on); |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3667 if (! driver->start_for_frame |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3668 || driver->start_for_frame (f) == 0) |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3669 { |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3670 font_prepare_cache (f, driver); |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3671 list->on = 1; |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3672 } |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3673 } |
cb1886d1427b
(font_update_drivers): Sanity fallback to avoid disabling all drivers.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
103114
diff
changeset
|
3674 } |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3675 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3676 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3677 for (list = f->font_driver_list; list; list = list->next) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3678 if (list->on) |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3679 active_drivers = nconc2 (active_drivers, |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3680 Fcons (list->driver->type, Qnil)); |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
3681 return active_drivers; |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3682 } |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3683 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3684 int |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3685 font_put_frame_data (f, driver, data) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3686 FRAME_PTR f; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3687 struct font_driver *driver; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3688 void *data; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3689 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3690 struct font_data_list *list, *prev; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3691 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3692 for (prev = NULL, list = f->font_data_list; list; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3693 prev = list, list = list->next) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3694 if (list->driver == driver) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3695 break; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3696 if (! data) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3697 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3698 if (list) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3699 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3700 if (prev) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3701 prev->next = list->next; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3702 else |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3703 f->font_data_list = list->next; |
103019
413229f94ec7
(font_put_frame_data): Use xfree instead of free.
Andreas Schwab <schwab@linux-m68k.org>
parents:
103011
diff
changeset
|
3704 xfree (list); |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3705 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3706 return 0; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3707 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3708 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3709 if (! list) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3710 { |
100103
c2ef1c8b2d64
(register_font_driver): Use xmalloc.
Andreas Schwab <schwab@suse.de>
parents:
99076
diff
changeset
|
3711 list = xmalloc (sizeof (struct font_data_list)); |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3712 list->driver = driver; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3713 list->next = f->font_data_list; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3714 f->font_data_list = list; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3715 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3716 list->data = data; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3717 return 0; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3718 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3719 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3720 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3721 void * |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3722 font_get_frame_data (f, driver) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3723 FRAME_PTR f; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3724 struct font_driver *driver; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3725 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3726 struct font_data_list *list; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3727 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3728 for (list = f->font_data_list; list; list = list->next) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3729 if (list->driver == driver) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3730 break; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3731 if (! list) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3732 return NULL; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3733 return list->data; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3734 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3735 |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3736 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3737 /* Return the font used to draw character C by FACE at buffer position |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3738 POS in window W. If STRING is non-nil, it is a string containing C |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3739 at index POS. If C is negative, get C from the current buffer or |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3740 STRING. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3741 |
90541 | 3742 Lisp_Object |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3743 font_at (c, pos, face, w, string) |
90541 | 3744 int c; |
3745 EMACS_INT pos; | |
3746 struct face *face; | |
3747 struct window *w; | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3748 Lisp_Object string; |
90541 | 3749 { |
3750 FRAME_PTR f; | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3751 int multibyte; |
94926 | 3752 Lisp_Object font_object; |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3753 |
100173
d704965776e6
(font_at): Set `multibyte' at first.
Kenichi Handa <handa@m17n.org>
parents:
100167
diff
changeset
|
3754 multibyte = (NILP (string) |
d704965776e6
(font_at): Set `multibyte' at first.
Kenichi Handa <handa@m17n.org>
parents:
100167
diff
changeset
|
3755 ? ! NILP (current_buffer->enable_multibyte_characters) |
d704965776e6
(font_at): Set `multibyte' at first.
Kenichi Handa <handa@m17n.org>
parents:
100167
diff
changeset
|
3756 : STRING_MULTIBYTE (string)); |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3757 if (c < 0) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3758 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3759 if (NILP (string)) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3760 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3761 if (multibyte) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3762 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3763 EMACS_INT pos_byte = CHAR_TO_BYTE (pos); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3764 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3765 c = FETCH_CHAR (pos_byte); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3766 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3767 else |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3768 c = FETCH_BYTE (pos); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3769 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3770 else |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3771 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3772 unsigned char *str; |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3773 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3774 multibyte = STRING_MULTIBYTE (string); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3775 if (multibyte) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3776 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3777 EMACS_INT pos_byte = string_char_to_byte (string, pos); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3778 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3779 str = SDATA (string) + pos_byte; |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3780 c = STRING_CHAR (str, 0); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3781 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3782 else |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3783 c = SDATA (string)[pos]; |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3784 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3785 } |
90541 | 3786 |
3787 f = XFRAME (w->frame); | |
90811
c1ed0fd37416
(font_at): If the window W is not on a window system,
Kenichi Handa <handa@m17n.org>
parents:
90695
diff
changeset
|
3788 if (! FRAME_WINDOW_P (f)) |
c1ed0fd37416
(font_at): If the window W is not on a window system,
Kenichi Handa <handa@m17n.org>
parents:
90695
diff
changeset
|
3789 return Qnil; |
90541 | 3790 if (! face) |
3791 { | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3792 int face_id; |
92237
ce06567a933d
* dispextern.h (face_at_buffer_position, face_for_overlay_string)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92233
diff
changeset
|
3793 EMACS_INT endptr; |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3794 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3795 if (STRINGP (string)) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3796 face_id = face_at_string_position (w, string, pos, 0, -1, -1, &endptr, |
90541 | 3797 DEFAULT_FACE_ID, 0); |
3798 else | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3799 face_id = face_at_buffer_position (w, pos, -1, -1, &endptr, |
103114
fa8e2c663118
* xfaces.c (face_at_buffer_position): New arg base_face_id.
Chong Yidong <cyd@stupidchicken.com>
parents:
103041
diff
changeset
|
3800 pos + 100, 0, -1); |
90541 | 3801 face = FACE_FROM_ID (f, face_id); |
3802 } | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3803 if (multibyte) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3804 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3805 int face_id = FACE_FOR_CHAR (f, face, c, pos, string); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3806 face = FACE_FROM_ID (f, face_id); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3807 } |
94926 | 3808 if (! face->font) |
90541 | 3809 return Qnil; |
94926 | 3810 |
3811 XSETFONT (font_object, face->font); | |
3812 return font_object; | |
3813 } | |
3814 | |
3815 | |
97822 | 3816 #ifdef HAVE_WINDOW_SYSTEM |
3817 | |
3818 /* Check how many characters after POS (at most to *LIMIT) can be | |
3819 displayed by the same font on the window W. FACE, if non-NULL, is | |
3820 the face selected for the character at POS. If STRING is not nil, | |
3821 it is the string to check instead of the current buffer. In that | |
3822 case, FACE must be not NULL. | |
3823 | |
3824 The return value is the font-object for the character at POS. | |
3825 *LIMIT is set to the position where that font can't be used. | |
3826 | |
3827 It is assured that the current buffer (or STRING) is multibyte. */ | |
3828 | |
3829 Lisp_Object | |
3830 font_range (pos, limit, w, face, string) | |
3831 EMACS_INT pos, *limit; | |
3832 struct window *w; | |
94926 | 3833 struct face *face; |
3834 Lisp_Object string; | |
3835 { | |
97822 | 3836 EMACS_INT pos_byte, ignore, start, start_byte; |
94926 | 3837 int c; |
97822 | 3838 Lisp_Object font_object = Qnil; |
94926 | 3839 |
3840 if (NILP (string)) | |
3841 { | |
3842 pos_byte = CHAR_TO_BYTE (pos); | |
97822 | 3843 if (! face) |
3844 { | |
3845 int face_id; | |
3846 | |
103114
fa8e2c663118
* xfaces.c (face_at_buffer_position): New arg base_face_id.
Chong Yidong <cyd@stupidchicken.com>
parents:
103041
diff
changeset
|
3847 face_id = face_at_buffer_position (w, pos, 0, 0, &ignore, |
fa8e2c663118
* xfaces.c (face_at_buffer_position): New arg base_face_id.
Chong Yidong <cyd@stupidchicken.com>
parents:
103041
diff
changeset
|
3848 *limit, 0, -1); |
97822 | 3849 face = FACE_FROM_ID (XFRAME (w->frame), face_id); |
3850 } | |
94926 | 3851 } |
3852 else | |
3853 { | |
97822 | 3854 font_assert (face); |
94926 | 3855 pos_byte = string_char_to_byte (string, pos); |
3856 } | |
3857 | |
97822 | 3858 start = pos, start_byte = pos_byte; |
3859 while (pos < *limit) | |
94926 | 3860 { |
97822 | 3861 Lisp_Object category; |
94926 | 3862 |
3863 if (NILP (string)) | |
3864 FETCH_CHAR_ADVANCE_NO_CHECK (c, pos, pos_byte); | |
3865 else | |
3866 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, string, pos, pos_byte); | |
97822 | 3867 if (NILP (font_object)) |
94926 | 3868 { |
97822 | 3869 font_object = font_for_char (face, c, pos - 1, string); |
3870 if (NILP (font_object)) | |
3871 return Qnil; | |
94926 | 3872 continue; |
3873 } | |
97822 | 3874 |
3875 category = CHAR_TABLE_REF (Vunicode_category_table, c); | |
3876 if (! EQ (category, QCf) | |
100793
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
3877 && ! CHAR_VARIATION_SELECTOR_P (c) |
97822 | 3878 && font_encode_char (font_object, c) == FONT_INVALID_CODE) |
94926 | 3879 { |
97822 | 3880 Lisp_Object f = font_for_char (face, c, pos - 1, string); |
3881 EMACS_INT i, i_byte; | |
3882 | |
3883 | |
3884 if (NILP (f)) | |
3885 { | |
3886 *limit = pos - 1; | |
3887 return font_object; | |
3888 } | |
3889 i = start, i_byte = start_byte; | |
3890 while (i < pos - 1) | |
3891 { | |
3892 | |
3893 if (NILP (string)) | |
3894 FETCH_CHAR_ADVANCE_NO_CHECK (c, i, i_byte); | |
3895 else | |
3896 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, string, i, i_byte); | |
3897 category = CHAR_TABLE_REF (Vunicode_category_table, c); | |
3898 if (! EQ (category, QCf) | |
100793
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
3899 && ! CHAR_VARIATION_SELECTOR_P (c) |
97822 | 3900 && font_encode_char (f, c) == FONT_INVALID_CODE) |
3901 { | |
3902 *limit = pos - 1; | |
3903 return font_object; | |
3904 } | |
3905 } | |
3906 font_object = f; | |
94926 | 3907 } |
3908 } | |
97822 | 3909 return font_object; |
90541 | 3910 } |
97822 | 3911 #endif |
90541 | 3912 |
90400 | 3913 |
3914 /* Lisp API */ | |
3915 | |
94926 | 3916 DEFUN ("fontp", Ffontp, Sfontp, 1, 2, 0, |
91353
b93ade1a3602
(font_find_for_lface): Check if the character C is
Kenichi Handa <handa@m17n.org>
parents:
91350
diff
changeset
|
3917 doc: /* Return t if OBJECT is a font-spec, font-entity, or font-object. |
94926 | 3918 Return nil otherwise. |
3919 Optional 2nd argument EXTRA-TYPE, if non-nil, specifies to check | |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
3920 which kind of font it is. It must be one of `font-spec', `font-entity', |
94926 | 3921 `font-object'. */) |
3922 (object, extra_type) | |
3923 Lisp_Object object, extra_type; | |
90400 | 3924 { |
94926 | 3925 if (NILP (extra_type)) |
3926 return (FONTP (object) ? Qt : Qnil); | |
3927 if (EQ (extra_type, Qfont_spec)) | |
3928 return (FONT_SPEC_P (object) ? Qt : Qnil); | |
3929 if (EQ (extra_type, Qfont_entity)) | |
3930 return (FONT_ENTITY_P (object) ? Qt : Qnil); | |
3931 if (EQ (extra_type, Qfont_object)) | |
3932 return (FONT_OBJECT_P (object) ? Qt : Qnil); | |
3933 wrong_type_argument (intern ("font-extra-type"), extra_type); | |
90400 | 3934 } |
3935 | |
3936 DEFUN ("font-spec", Ffont_spec, Sfont_spec, 0, MANY, 0, | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3937 doc: /* Return a newly created font-spec with arguments as properties. |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3938 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3939 ARGS must come in pairs KEY VALUE of font properties. KEY must be a |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3940 valid font property name listed below: |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3941 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3942 `:family', `:weight', `:slant', `:width' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3943 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3944 They are the same as face attributes of the same name. See |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
3945 `set-face-attribute'. |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3946 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3947 `:foundry' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3948 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3949 VALUE must be a string or a symbol specifying the font foundry, e.g. ``misc''. |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3950 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3951 `:adstyle' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3952 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3953 VALUE must be a string or a symbol specifying the additional |
94926 | 3954 typographic style information of a font, e.g. ``sans''. |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3955 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3956 `:registry' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3957 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3958 VALUE must be a string or a symbol specifying the charset registry and |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3959 encoding of a font, e.g. ``iso8859-1''. |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3960 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3961 `:size' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3962 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3963 VALUE must be a non-negative integer or a floating point number |
102082
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3964 specifying the font size. It specifies the font size in pixels (if |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3965 VALUE is an integer), or in points (if VALUE is a float). |
96010
c0401e586ca3
(Ffont_get): Return a symbol for :weight, :slant, and :width.
Kenichi Handa <handa@m17n.org>
parents:
96005
diff
changeset
|
3966 |
c0401e586ca3
(Ffont_get): Return a symbol for :weight, :slant, and :width.
Kenichi Handa <handa@m17n.org>
parents:
96005
diff
changeset
|
3967 `:name' |
c0401e586ca3
(Ffont_get): Return a symbol for :weight, :slant, and :width.
Kenichi Handa <handa@m17n.org>
parents:
96005
diff
changeset
|
3968 |
96013
04be82e0cbd3
(Ffont_spec): Fix usage in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
96012
diff
changeset
|
3969 VALUE must be a string of XLFD-style or fontconfig-style font name. |
99075
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
3970 |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
3971 `:script' |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
3972 |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
3973 VALUE must be a symbol representing a script that the font must |
101806
73703b41e43a
(Ffont_spec): Docstring modified.
Kenichi Handa <handa@m17n.org>
parents:
101422
diff
changeset
|
3974 support. It may be a symbol representing a subgroup of a script |
73703b41e43a
(Ffont_spec): Docstring modified.
Kenichi Handa <handa@m17n.org>
parents:
101422
diff
changeset
|
3975 listed in the variable `script-representative-chars'. |
102082
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3976 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3977 `:lang' |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3978 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3979 VALUE must be a symbol of two-letter ISO-639 language names, |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3980 e.g. `ja'. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3981 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3982 `:otf' |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3983 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3984 VALUE must be a list (SCRIPT-TAG LANGSYS-TAG GSUB [ GPOS ]) to specify |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3985 required OpenType features. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3986 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3987 SCRIPT-TAG: OpenType script tag symbol (e.g. `deva'). |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3988 LANGSYS-TAG: OpenType language system tag symbol, |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3989 or nil for the default language system. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3990 GSUB: List of OpenType GSUB feature tag symbols, or nil if none required. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3991 GPOS: List of OpenType GPOS feature tag symbols, or nil if none required. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3992 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3993 GSUB and GPOS may contain `nil' element. In such a case, the font |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3994 must not have any of the remaining elements. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3995 |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3996 For instance, if the VALUE is `(thai nil nil (mark))', the font must |
102085 | 3997 be an OpenType font, and whose GPOS table of `thai' script's default |
102082
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3998 language system must contain `mark' feature. |
6bd3d2a26db9
(font_check_otf_features): Fix handling of `nil' element.
Kenichi Handa <handa@m17n.org>
parents:
101943
diff
changeset
|
3999 |
100336
d53183123ad7
* font.c (Ffont_spec): Move usage to end of docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100173
diff
changeset
|
4000 usage: (font-spec ARGS...) */) |
90400 | 4001 (nargs, args) |
4002 int nargs; | |
4003 Lisp_Object *args; | |
4004 { | |
94926 | 4005 Lisp_Object spec = font_make_spec (); |
90400 | 4006 int i; |
4007 | |
4008 for (i = 0; i < nargs; i += 2) | |
4009 { | |
4010 Lisp_Object key = args[i], val = args[i + 1]; | |
4011 | |
94926 | 4012 if (EQ (key, QCname)) |
4013 { | |
4014 CHECK_STRING (val); | |
4015 font_parse_name ((char *) SDATA (val), spec); | |
4016 font_put_extra (spec, key, val); | |
4017 } | |
90400 | 4018 else |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
4019 { |
94926 | 4020 int idx = get_font_prop_index (key); |
4021 | |
4022 if (idx >= 0) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4023 { |
94926 | 4024 val = font_prop_validate (idx, Qnil, val); |
4025 if (idx < FONT_EXTRA_INDEX) | |
4026 ASET (spec, idx, val); | |
4027 else | |
4028 font_put_extra (spec, key, val); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4029 } |
94926 | 4030 else |
4031 font_put_extra (spec, key, font_prop_validate (0, key, val)); | |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
4032 } |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
4033 } |
90400 | 4034 return spec; |
4035 } | |
4036 | |
94926 | 4037 DEFUN ("copy-font-spec", Fcopy_font_spec, Scopy_font_spec, 1, 1, 0, |
4038 doc: /* Return a copy of FONT as a font-spec. */) | |
4039 (font) | |
4040 Lisp_Object font; | |
4041 { | |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4042 Lisp_Object new_spec, tail, prev, extra; |
94926 | 4043 int i; |
4044 | |
4045 CHECK_FONT (font); | |
4046 new_spec = font_make_spec (); | |
4047 for (i = 1; i < FONT_EXTRA_INDEX; i++) | |
4048 ASET (new_spec, i, AREF (font, i)); | |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4049 extra = Fcopy_sequence (AREF (font, FONT_EXTRA_INDEX)); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4050 /* We must remove :font-entity property. */ |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4051 for (prev = Qnil, tail = extra; CONSP (tail); prev = tail, tail = XCDR (tail)) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4052 if (EQ (XCAR (XCAR (tail)), QCfont_entity)) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4053 { |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4054 if (NILP (prev)) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4055 extra = XCDR (extra); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4056 else |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4057 XSETCDR (prev, XCDR (tail)); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4058 break; |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4059 } |
94926 | 4060 ASET (new_spec, FONT_EXTRA_INDEX, extra); |
4061 return new_spec; | |
4062 } | |
4063 | |
4064 DEFUN ("merge-font-spec", Fmerge_font_spec, Smerge_font_spec, 2, 2, 0, | |
4065 doc: /* Merge font-specs FROM and TO, and return a new font-spec. | |
4066 Every specified properties in FROM override the corresponding | |
4067 properties in TO. */) | |
4068 (from, to) | |
4069 Lisp_Object from, to; | |
4070 { | |
4071 Lisp_Object extra, tail; | |
4072 int i; | |
4073 | |
4074 CHECK_FONT (from); | |
4075 CHECK_FONT (to); | |
4076 to = Fcopy_font_spec (to); | |
4077 for (i = 0; i < FONT_EXTRA_INDEX; i++) | |
4078 ASET (to, i, AREF (from, i)); | |
4079 extra = AREF (to, FONT_EXTRA_INDEX); | |
4080 for (tail = AREF (from, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail)) | |
4081 if (! EQ (XCAR (XCAR (tail)), Qfont_entity)) | |
4082 { | |
4083 Lisp_Object slot = assq_no_quit (XCAR (XCAR (tail)), extra); | |
4084 | |
4085 if (! NILP (slot)) | |
4086 XSETCDR (slot, XCDR (XCAR (tail))); | |
4087 else | |
4088 extra = Fcons (Fcons (XCAR (XCAR (tail)), XCDR (XCAR (tail))), extra); | |
4089 } | |
4090 ASET (to, FONT_EXTRA_INDEX, extra); | |
4091 return to; | |
4092 } | |
90400 | 4093 |
4094 DEFUN ("font-get", Ffont_get, Sfont_get, 2, 2, 0, | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4095 doc: /* Return the value of FONT's property KEY. |
99075
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4096 FONT is a font-spec, a font-entity, or a font-object. |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4097 KEY must be one of these symbols: |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4098 :family, :weight, :slant, :width, :foundry, :adstyle, :registry, |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4099 :size, :name, :script |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4100 See the documentation of `font-spec' for their meanings. |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4101 If FONT is a font-entity or font-object, the value of :script may be |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
4102 a list of scripts that are supported by the font. */) |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4103 (font, key) |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4104 Lisp_Object font, key; |
90400 | 4105 { |
94926 | 4106 int idx; |
4107 | |
4108 CHECK_FONT (font); | |
4109 CHECK_SYMBOL (key); | |
4110 | |
4111 idx = get_font_prop_index (key); | |
96010
c0401e586ca3
(Ffont_get): Return a symbol for :weight, :slant, and :width.
Kenichi Handa <handa@m17n.org>
parents:
96005
diff
changeset
|
4112 if (idx >= FONT_WEIGHT_INDEX && idx <= FONT_WIDTH_INDEX) |
c0401e586ca3
(Ffont_get): Return a symbol for :weight, :slant, and :width.
Kenichi Handa <handa@m17n.org>
parents:
96005
diff
changeset
|
4113 return font_style_symbolic (font, idx, 0); |
94926 | 4114 if (idx >= 0 && idx < FONT_EXTRA_INDEX) |
90400 | 4115 return AREF (font, idx); |
94926 | 4116 return Fcdr (Fassq (key, AREF (font, FONT_EXTRA_INDEX))); |
90400 | 4117 } |
4118 | |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4119 #ifdef HAVE_WINDOW_SYSTEM |
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4120 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4121 DEFUN ("font-face-attributes", Ffont_face_attributes, Sfont_face_attributes, 1, 2, 0, |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4122 doc: /* Return a plist of face attributes generated by FONT. |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4123 FONT is a font name, a font-spec, a font-entity, or a font-object. |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4124 The return value is a list of the form |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4125 |
96012
c04088bb7b0d
(Ffont_face_attributes): Fix definition.
Andreas Schwab <schwab@suse.de>
parents:
96010
diff
changeset
|
4126 \(:family FAMILY :height HEIGHT :weight WEIGHT :slant SLANT :width WIDTH) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4127 |
96014
f4a50aac009c
(Ffont_face_attributes): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
96013
diff
changeset
|
4128 where FAMILY, HEIGHT, WEIGHT, SLANT, and WIDTH are face attribute values |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4129 compatible with `set-face-attribute'. Some of these key-attribute pairs |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4130 may be omitted from the list if they are not specified by FONT. |
96014
f4a50aac009c
(Ffont_face_attributes): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
96013
diff
changeset
|
4131 |
f4a50aac009c
(Ffont_face_attributes): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
96013
diff
changeset
|
4132 The optional argument FRAME specifies the frame that the face attributes |
f4a50aac009c
(Ffont_face_attributes): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
96013
diff
changeset
|
4133 are to be displayed on. If omitted, the selected frame is used. */) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4134 (font, frame) |
96012
c04088bb7b0d
(Ffont_face_attributes): Fix definition.
Andreas Schwab <schwab@suse.de>
parents:
96010
diff
changeset
|
4135 Lisp_Object font, frame; |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4136 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4137 struct frame *f; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4138 Lisp_Object plist[10]; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4139 Lisp_Object val; |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4140 int n = 0; |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4141 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4142 if (NILP (frame)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4143 frame = selected_frame; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4144 CHECK_LIVE_FRAME (frame); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4145 f = XFRAME (frame); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4146 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4147 if (STRINGP (font)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4148 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4149 int fontset = fs_query_fontset (font, 0); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4150 Lisp_Object name = font; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4151 if (fontset >= 0) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4152 font = fontset_ascii (fontset); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4153 font = font_spec_from_name (name); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4154 if (! FONTP (font)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4155 signal_error ("Invalid font name", name); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4156 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4157 else if (! FONTP (font)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4158 signal_error ("Invalid font object", font); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4159 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4160 val = AREF (font, FONT_FAMILY_INDEX); |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4161 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4162 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4163 plist[n++] = QCfamily; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4164 plist[n++] = SYMBOL_NAME (val); |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4165 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4166 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4167 val = AREF (font, FONT_SIZE_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4168 if (INTEGERP (val)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4169 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4170 Lisp_Object font_dpi = AREF (font, FONT_DPI_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4171 int dpi = INTEGERP (font_dpi) ? XINT (font_dpi) : f->resy; |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4172 plist[n++] = QCheight; |
96227
f9eb9f0d6678
(Ffont_face_attributes): Multiply pixel size before point
Jason Rumney <jasonr@gnu.org>
parents:
96224
diff
changeset
|
4173 plist[n++] = make_number (PIXEL_TO_POINT (XINT (val) * 10, dpi)); |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4174 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4175 else if (FLOATP (val)) |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4176 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4177 plist[n++] = QCheight; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4178 plist[n++] = make_number (10 * (int) XFLOAT_DATA (val)); |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4179 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4180 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4181 val = FONT_WEIGHT_FOR_FACE (font); |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4182 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4183 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4184 plist[n++] = QCweight; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4185 plist[n++] = val; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4186 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4187 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4188 val = FONT_SLANT_FOR_FACE (font); |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4189 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4190 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4191 plist[n++] = QCslant; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4192 plist[n++] = val; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4193 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4194 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4195 val = FONT_WIDTH_FOR_FACE (font); |
96136
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4196 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4197 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4198 plist[n++] = QCwidth; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4199 plist[n++] = val; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4200 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4201 |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4202 return Flist (n, plist); |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4203 } |
90400 | 4204 |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4205 #endif |
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4206 |
90400 | 4207 DEFUN ("font-put", Ffont_put, Sfont_put, 3, 3, 0, |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4208 doc: /* Set one property of FONT-SPEC: give property PROP value VAL. */) |
90400 | 4209 (font_spec, prop, val) |
4210 Lisp_Object font_spec, prop, val; | |
4211 { | |
94926 | 4212 int idx; |
90400 | 4213 |
4214 CHECK_FONT_SPEC (font_spec); | |
94926 | 4215 idx = get_font_prop_index (prop); |
4216 if (idx >= 0 && idx < FONT_EXTRA_INDEX) | |
95573
0da1a8e03099
(Ffont_put): Don't use font_parse_family_registry for
Kenichi Handa <handa@m17n.org>
parents:
95572
diff
changeset
|
4217 ASET (font_spec, idx, font_prop_validate (idx, Qnil, val)); |
90400 | 4218 else |
94926 | 4219 font_put_extra (font_spec, prop, font_prop_validate (0, prop, val)); |
90400 | 4220 return val; |
4221 } | |
4222 | |
4223 DEFUN ("list-fonts", Flist_fonts, Slist_fonts, 1, 4, 0, | |
4224 doc: /* List available fonts matching FONT-SPEC on the current frame. | |
4225 Optional 2nd argument FRAME specifies the target frame. | |
4226 Optional 3rd argument NUM, if non-nil, limits the number of returned fonts. | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4227 Optional 4th argument PREFER, if non-nil, is a font-spec to |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
4228 control the order of the returned list. Fonts are sorted by |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4229 how close they are to PREFER. */) |
90400 | 4230 (font_spec, frame, num, prefer) |
4231 Lisp_Object font_spec, frame, num, prefer; | |
4232 { | |
4233 Lisp_Object vec, list, tail; | |
4234 int n = 0, i, len; | |
4235 | |
4236 if (NILP (frame)) | |
4237 frame = selected_frame; | |
4238 CHECK_LIVE_FRAME (frame); | |
94926 | 4239 CHECK_FONT_SPEC (font_spec); |
90400 | 4240 if (! NILP (num)) |
4241 { | |
4242 CHECK_NUMBER (num); | |
4243 n = XINT (num); | |
4244 if (n <= 0) | |
4245 return Qnil; | |
4246 } | |
4247 if (! NILP (prefer)) | |
94926 | 4248 CHECK_FONT_SPEC (prefer); |
90400 | 4249 |
4250 vec = font_list_entities (frame, font_spec); | |
4251 len = ASIZE (vec); | |
4252 if (len == 0) | |
4253 return Qnil; | |
4254 if (len == 1) | |
4255 return Fcons (AREF (vec, 0), Qnil); | |
4256 | |
4257 if (! NILP (prefer)) | |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
4258 vec = font_sort_entites (vec, prefer, frame, 0); |
90400 | 4259 |
4260 list = tail = Fcons (AREF (vec, 0), Qnil); | |
4261 if (n == 0 || n > len) | |
4262 n = len; | |
4263 for (i = 1; i < n; i++) | |
4264 { | |
4265 Lisp_Object val = Fcons (AREF (vec, i), Qnil); | |
4266 | |
4267 XSETCDR (tail, val); | |
4268 tail = val; | |
4269 } | |
4270 return list; | |
4271 } | |
4272 | |
94926 | 4273 DEFUN ("font-family-list", Ffont_family_list, Sfont_family_list, 0, 1, 0, |
90400 | 4274 doc: /* List available font families on the current frame. |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4275 Optional argument FRAME, if non-nil, specifies the target frame. */) |
90400 | 4276 (frame) |
4277 Lisp_Object frame; | |
4278 { | |
4279 FRAME_PTR f; | |
4280 struct font_driver_list *driver_list; | |
4281 Lisp_Object list; | |
4282 | |
4283 if (NILP (frame)) | |
4284 frame = selected_frame; | |
4285 CHECK_LIVE_FRAME (frame); | |
4286 f = XFRAME (frame); | |
4287 list = Qnil; | |
4288 for (driver_list = f->font_driver_list; driver_list; | |
4289 driver_list = driver_list->next) | |
4290 if (driver_list->driver->list_family) | |
4291 { | |
4292 Lisp_Object val = driver_list->driver->list_family (frame); | |
101028
d3a67a9e7177
(Ffont_family_list): Return a list of strings, not symbols.
Chong Yidong <cyd@stupidchicken.com>
parents:
100985
diff
changeset
|
4293 Lisp_Object tail = list; |
d3a67a9e7177
(Ffont_family_list): Return a list of strings, not symbols.
Chong Yidong <cyd@stupidchicken.com>
parents:
100985
diff
changeset
|
4294 |
d3a67a9e7177
(Ffont_family_list): Return a list of strings, not symbols.
Chong Yidong <cyd@stupidchicken.com>
parents:
100985
diff
changeset
|
4295 for (; CONSP (val); val = XCDR (val)) |
d3a67a9e7177
(Ffont_family_list): Return a list of strings, not symbols.
Chong Yidong <cyd@stupidchicken.com>
parents:
100985
diff
changeset
|
4296 if (NILP (Fmemq (XCAR (val), tail)) |
d3a67a9e7177
(Ffont_family_list): Return a list of strings, not symbols.
Chong Yidong <cyd@stupidchicken.com>
parents:
100985
diff
changeset
|
4297 && SYMBOLP (XCAR (val))) |
d3a67a9e7177
(Ffont_family_list): Return a list of strings, not symbols.
Chong Yidong <cyd@stupidchicken.com>
parents:
100985
diff
changeset
|
4298 list = Fcons (SYMBOL_NAME (XCAR (val)), list); |
90400 | 4299 } |
4300 return list; | |
4301 } | |
4302 | |
4303 DEFUN ("find-font", Ffind_font, Sfind_font, 1, 2, 0, | |
4304 doc: /* Return a font-entity matching with FONT-SPEC on the current frame. | |
4305 Optional 2nd argument FRAME, if non-nil, specifies the target frame. */) | |
4306 (font_spec, frame) | |
4307 Lisp_Object font_spec, frame; | |
4308 { | |
4309 Lisp_Object val = Flist_fonts (font_spec, frame, make_number (1), Qnil); | |
4310 | |
4311 if (CONSP (val)) | |
4312 val = XCAR (val); | |
4313 return val; | |
4314 } | |
4315 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4316 DEFUN ("font-xlfd-name", Ffont_xlfd_name, Sfont_xlfd_name, 1, 2, 0, |
90400 | 4317 doc: /* Return XLFD name of FONT. |
4318 FONT is a font-spec, font-entity, or font-object. | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4319 If the name is too long for XLFD (maximum 255 chars), return nil. |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4320 If the 2nd optional arg FOLD-WILDCARDS is non-nil, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4321 the consecutive wildcards are folded to one. */) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4322 (font, fold_wildcards) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4323 Lisp_Object font, fold_wildcards; |
90400 | 4324 { |
4325 char name[256]; | |
4326 int pixel_size = 0; | |
4327 | |
94926 | 4328 CHECK_FONT (font); |
4329 | |
4330 if (FONT_OBJECT_P (font)) | |
90400 | 4331 { |
94926 | 4332 Lisp_Object font_name = AREF (font, FONT_NAME_INDEX); |
4333 | |
4334 if (STRINGP (font_name) | |
4335 && SDATA (font_name)[0] == '-') | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4336 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4337 if (NILP (fold_wildcards)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4338 return font_name; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4339 strcpy (name, (char *) SDATA (font_name)); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4340 goto done; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4341 } |
94926 | 4342 pixel_size = XFONT_OBJECT (font)->pixel_size; |
90400 | 4343 } |
4344 if (font_unparse_xlfd (font, pixel_size, name, 256) < 0) | |
4345 return Qnil; | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4346 done: |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4347 if (! NILP (fold_wildcards)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4348 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4349 char *p0 = name, *p1; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4350 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4351 while ((p1 = strstr (p0, "-*-*"))) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4352 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4353 strcpy (p1, p1 + 2); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4354 p0 = p1; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4355 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4356 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4357 |
90400 | 4358 return build_string (name); |
4359 } | |
4360 | |
4361 DEFUN ("clear-font-cache", Fclear_font_cache, Sclear_font_cache, 0, 0, 0, | |
4362 doc: /* Clear font cache. */) | |
4363 () | |
4364 { | |
4365 Lisp_Object list, frame; | |
4366 | |
4367 FOR_EACH_FRAME (list, frame) | |
4368 { | |
4369 FRAME_PTR f = XFRAME (frame); | |
4370 struct font_driver_list *driver_list = f->font_driver_list; | |
4371 | |
4372 for (; driver_list; driver_list = driver_list->next) | |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4373 if (driver_list->on) |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4374 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4375 Lisp_Object cache = driver_list->driver->get_cache (f); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4376 Lisp_Object val; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4377 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4378 val = XCDR (cache); |
91909 | 4379 while (! NILP (val) |
4380 && ! EQ (XCAR (XCAR (val)), driver_list->driver->type)) | |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4381 val = XCDR (val); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4382 font_assert (! NILP (val)); |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4383 val = XCDR (XCAR (val)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4384 if (XINT (XCAR (val)) == 0) |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4385 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4386 font_clear_cache (f, XCAR (val), driver_list->driver); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4387 XSETCDR (cache, XCDR (val)); |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4388 } |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4389 } |
90400 | 4390 } |
4391 | |
4392 return Qnil; | |
4393 } | |
4394 | |
97822 | 4395 |
4396 void | |
4397 font_fill_lglyph_metrics (glyph, font_object) | |
4398 Lisp_Object glyph, font_object; | |
90400 | 4399 { |
97822 | 4400 struct font *font = XFONT_OBJECT (font_object); |
97853
fa1023e4960c
(font_fill_lglyph_metrics): Use EMACS_INT in LGLYPH_SET_CODE to avoid
Eli Zaretskii <eliz@gnu.org>
parents:
97822
diff
changeset
|
4401 unsigned code; |
fa1023e4960c
(font_fill_lglyph_metrics): Use EMACS_INT in LGLYPH_SET_CODE to avoid
Eli Zaretskii <eliz@gnu.org>
parents:
97822
diff
changeset
|
4402 /* ecode used in LGLYPH_SET_CODE to avoid compiler warnings. */ |
fa1023e4960c
(font_fill_lglyph_metrics): Use EMACS_INT in LGLYPH_SET_CODE to avoid
Eli Zaretskii <eliz@gnu.org>
parents:
97822
diff
changeset
|
4403 EMACS_INT ecode = font->driver->encode_char (font, LGLYPH_CHAR (glyph)); |
97822 | 4404 struct font_metrics metrics; |
4405 | |
97853
fa1023e4960c
(font_fill_lglyph_metrics): Use EMACS_INT in LGLYPH_SET_CODE to avoid
Eli Zaretskii <eliz@gnu.org>
parents:
97822
diff
changeset
|
4406 LGLYPH_SET_CODE (glyph, ecode); |
fa1023e4960c
(font_fill_lglyph_metrics): Use EMACS_INT in LGLYPH_SET_CODE to avoid
Eli Zaretskii <eliz@gnu.org>
parents:
97822
diff
changeset
|
4407 code = ecode; |
97822 | 4408 font->driver->text_extents (font, &code, 1, &metrics); |
4409 LGLYPH_SET_LBEARING (glyph, metrics.lbearing); | |
4410 LGLYPH_SET_RBEARING (glyph, metrics.rbearing); | |
4411 LGLYPH_SET_WIDTH (glyph, metrics.width); | |
4412 LGLYPH_SET_ASCENT (glyph, metrics.ascent); | |
4413 LGLYPH_SET_DESCENT (glyph, metrics.descent); | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4414 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4415 |
97822 | 4416 |
4417 DEFUN ("font-shape-gstring", Ffont_shape_gstring, Sfont_shape_gstring, 1, 1, 0, | |
4418 doc: /* Shape the glyph-string GSTRING. | |
4419 Shaping means substituting glyphs and/or adjusting positions of glyphs | |
4420 to get the correct visual image of character sequences set in the | |
4421 header of the glyph-string. | |
4422 | |
4423 If the shaping was successful, the value is GSTRING itself or a newly | |
4424 created glyph-string. Otherwise, the value is nil. */) | |
4425 (gstring) | |
4426 Lisp_Object gstring; | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4427 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4428 struct font *font; |
97822 | 4429 Lisp_Object font_object, n, glyph; |
98124
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4430 int i, j, from, to; |
100336
d53183123ad7
* font.c (Ffont_spec): Move usage to end of docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100173
diff
changeset
|
4431 |
97822 | 4432 if (! composition_gstring_p (gstring)) |
4433 signal_error ("Invalid glyph-string: ", gstring); | |
4434 if (! NILP (LGSTRING_ID (gstring))) | |
4435 return gstring; | |
4436 font_object = LGSTRING_FONT (gstring); | |
4437 CHECK_FONT_OBJECT (font_object); | |
94926 | 4438 font = XFONT_OBJECT (font_object); |
92183
275e5e980fc4
If the font driver doesn't have `shape' function, return Qnil.
Kenichi Handa <handa@m17n.org>
parents:
92113
diff
changeset
|
4439 if (! font->driver->shape) |
275e5e980fc4
If the font driver doesn't have `shape' function, return Qnil.
Kenichi Handa <handa@m17n.org>
parents:
92113
diff
changeset
|
4440 return Qnil; |
275e5e980fc4
If the font driver doesn't have `shape' function, return Qnil.
Kenichi Handa <handa@m17n.org>
parents:
92113
diff
changeset
|
4441 |
91273
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4442 /* Try at most three times with larger gstring each time. */ |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4443 for (i = 0; i < 3; i++) |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4444 { |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4445 n = font->driver->shape (gstring); |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4446 if (INTEGERP (n)) |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4447 break; |
97822 | 4448 gstring = larger_vector (gstring, |
4449 ASIZE (gstring) + LGSTRING_GLYPH_LEN (gstring), | |
4450 Qnil); | |
91273
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4451 } |
97822 | 4452 if (i == 3 || XINT (n) == 0) |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4453 return Qnil; |
100336
d53183123ad7
* font.c (Ffont_spec): Move usage to end of docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100173
diff
changeset
|
4454 |
97822 | 4455 glyph = LGSTRING_GLYPH (gstring, 0); |
98124
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4456 from = LGLYPH_FROM (glyph); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4457 to = LGLYPH_TO (glyph); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4458 for (i = 1, j = 0; i < LGSTRING_GLYPH_LEN (gstring); i++) |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4459 { |
97822 | 4460 Lisp_Object this = LGSTRING_GLYPH (gstring, i); |
4461 | |
4462 if (NILP (this)) | |
4463 break; | |
4464 if (NILP (LGLYPH_ADJUSTMENT (this))) | |
98124
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4465 { |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4466 if (j < i - 1) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4467 for (; j < i; j++) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4468 { |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4469 glyph = LGSTRING_GLYPH (gstring, j); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4470 LGLYPH_SET_FROM (glyph, from); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4471 LGLYPH_SET_TO (glyph, to); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4472 } |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4473 from = LGLYPH_FROM (this); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4474 to = LGLYPH_TO (this); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4475 j = i; |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4476 } |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4477 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4478 { |
98124
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4479 if (from > LGLYPH_FROM (this)) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4480 from = LGLYPH_FROM (this); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4481 if (to < LGLYPH_TO (this)) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4482 to = LGLYPH_TO (this); |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4483 } |
90541 | 4484 } |
98124
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4485 if (j < i - 1) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4486 for (; j < i; j++) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4487 { |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4488 glyph = LGSTRING_GLYPH (gstring, j); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4489 LGLYPH_SET_FROM (glyph, from); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4490 LGLYPH_SET_TO (glyph, to); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4491 } |
97822 | 4492 return composition_gstring_put_cache (gstring, XINT (n)); |
90400 | 4493 } |
4494 | |
100793
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4495 DEFUN ("font-variation-glyphs", Ffont_variation_glyphs, Sfont_variation_glyphs, |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4496 2, 2, 0, |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4497 doc: /* Return a list of variation glyphs for CHAR in FONT-OBJECT. |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4498 Each element of the value is a cons (VARIATION-SELECTOR . GLYPH-ID), |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4499 where |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4500 VARIATION-SELECTOR is a chracter code of variation selection |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4501 (#xFE00..#xFE0F or #xE0100..#xE01EF) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4502 GLYPH-ID is a glyph code of the corresponding variation glyph. */) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4503 (font_object, character) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4504 Lisp_Object font_object, character; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4505 { |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4506 unsigned variations[256]; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4507 struct font *font; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4508 int i, n; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4509 Lisp_Object val; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4510 |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4511 CHECK_FONT_OBJECT (font_object); |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4512 CHECK_CHARACTER (character); |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4513 font = XFONT_OBJECT (font_object); |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4514 if (! font->driver->get_variation_glyphs) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4515 return Qnil; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4516 n = font->driver->get_variation_glyphs (font, XINT (character), variations); |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4517 if (! n) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4518 return Qnil; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4519 val = Qnil; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4520 for (i = 0; i < 255; i++) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4521 if (variations[i]) |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4522 { |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4523 Lisp_Object code; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4524 int vs = (i < 16 ? 0xFE00 + i : 0xE0100 + (i - 16)); |
101226
63d9f73bf9d9
(Ffont_variation_glyphs): Silence compiler.
Glenn Morris <rgm@gnu.org>
parents:
101156
diff
changeset
|
4525 /* Stops GCC whining about limited range of data type. */ |
63d9f73bf9d9
(Ffont_variation_glyphs): Silence compiler.
Glenn Morris <rgm@gnu.org>
parents:
101156
diff
changeset
|
4526 EMACS_INT var = variations[i]; |
63d9f73bf9d9
(Ffont_variation_glyphs): Silence compiler.
Glenn Morris <rgm@gnu.org>
parents:
101156
diff
changeset
|
4527 |
63d9f73bf9d9
(Ffont_variation_glyphs): Silence compiler.
Glenn Morris <rgm@gnu.org>
parents:
101156
diff
changeset
|
4528 if (var > MOST_POSITIVE_FIXNUM) |
100793
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4529 code = Fcons (make_number ((variations[i]) >> 16), |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4530 make_number ((variations[i]) & 0xFFFF)); |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4531 else |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4532 code = make_number (variations[i]); |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4533 val = Fcons (Fcons (make_number (vs), code), val); |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4534 } |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4535 return val; |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4536 } |
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
4537 |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4538 #if 0 |
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4539 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4540 DEFUN ("font-drive-otf", Ffont_drive_otf, Sfont_drive_otf, 6, 6, 0, |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4541 doc: /* Apply OpenType features on glyph-string GSTRING-IN. |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4542 OTF-FEATURES specifies which features to apply in this format: |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4543 (SCRIPT LANGSYS GSUB GPOS) |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4544 where |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4545 SCRIPT is a symbol specifying a script tag of OpenType, |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4546 LANGSYS is a symbol specifying a langsys tag of OpenType, |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4547 GSUB and GPOS, if non-nil, are lists of symbols specifying feature tags. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4548 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4549 If LANGYS is nil, the default langsys is selected. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4550 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4551 The features are applied in the order they appear in the list. The |
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4552 symbol `*' means to apply all available features not present in this |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4553 list, and the remaining features are ignored. For instance, (vatu |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4554 pstf * haln) is to apply vatu and pstf in this order, then to apply |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4555 all available features other than vatu, pstf, and haln. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4556 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4557 The features are applied to the glyphs in the range FROM and TO of |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4558 the glyph-string GSTRING-IN. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4559 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4560 If some feature is actually applicable, the resulting glyphs are |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4561 produced in the glyph-string GSTRING-OUT from the index INDEX. In |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4562 this case, the value is the number of produced glyphs. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4563 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4564 If no feature is applicable, no glyph is produced in GSTRING-OUT, and |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4565 the value is 0. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4566 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4567 If GSTRING-OUT is too short to hold produced glyphs, no glyphs are |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4568 produced in GSTRING-OUT, and the value is nil. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4569 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4570 See the documentation of `font-make-gstring' for the format of |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4571 glyph-string. */) |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4572 (otf_features, gstring_in, from, to, gstring_out, index) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4573 Lisp_Object otf_features, gstring_in, from, to, gstring_out, index; |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4574 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4575 Lisp_Object font_object = LGSTRING_FONT (gstring_in); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4576 Lisp_Object val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4577 struct font *font; |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4578 int len, num; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4579 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4580 check_otf_features (otf_features); |
94926 | 4581 CHECK_FONT_OBJECT (font_object); |
4582 font = XFONT_OBJECT (font_object); | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4583 if (! font->driver->otf_drive) |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4584 error ("Font backend %s can't drive OpenType GSUB table", |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4585 SDATA (SYMBOL_NAME (font->driver->type))); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4586 CHECK_CONS (otf_features); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4587 CHECK_SYMBOL (XCAR (otf_features)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4588 val = XCDR (otf_features); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4589 CHECK_SYMBOL (XCAR (val)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4590 val = XCDR (otf_features); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4591 if (! NILP (val)) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4592 CHECK_CONS (val); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4593 len = check_gstring (gstring_in); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4594 CHECK_VECTOR (gstring_out); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4595 CHECK_NATNUM (from); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4596 CHECK_NATNUM (to); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4597 CHECK_NATNUM (index); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4598 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4599 if (XINT (from) >= XINT (to) || XINT (to) > len) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4600 args_out_of_range_3 (from, to, make_number (len)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4601 if (XINT (index) >= ASIZE (gstring_out)) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4602 args_out_of_range (index, make_number (ASIZE (gstring_out))); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4603 num = font->driver->otf_drive (font, otf_features, |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4604 gstring_in, XINT (from), XINT (to), |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4605 gstring_out, XINT (index), 0); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4606 if (num < 0) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4607 return Qnil; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4608 return make_number (num); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4609 } |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4610 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4611 DEFUN ("font-otf-alternates", Ffont_otf_alternates, Sfont_otf_alternates, |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4612 3, 3, 0, |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4613 doc: /* Return a list of alternate glyphs of CHARACTER in FONT-OBJECT. |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4614 OTF-FEATURES specifies which features of the font FONT-OBJECT to apply |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4615 in this format: |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4616 (SCRIPT LANGSYS FEATURE ...) |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4617 See the documentation of `font-drive-otf' for more detail. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4618 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4619 The value is a list of cons cells of the format (GLYPH-ID . CHARACTER), |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4620 where GLYPH-ID is a glyph index of the font, and CHARACTER is a |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4621 character code corresponding to the glyph or nil if there's no |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4622 corresponding character. */) |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4623 (font_object, character, otf_features) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4624 Lisp_Object font_object, character, otf_features; |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4625 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4626 struct font *font; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4627 Lisp_Object gstring_in, gstring_out, g; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4628 Lisp_Object alternates; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4629 int i, num; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4630 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4631 CHECK_FONT_GET_OBJECT (font_object, font); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4632 if (! font->driver->otf_drive) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
4633 error ("Font backend %s can't drive OpenType GSUB table", |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
4634 SDATA (SYMBOL_NAME (font->driver->type))); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4635 CHECK_CHARACTER (character); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4636 CHECK_CONS (otf_features); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4637 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4638 gstring_in = Ffont_make_gstring (font_object, make_number (1)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4639 g = LGSTRING_GLYPH (gstring_in, 0); |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
4640 LGLYPH_SET_CHAR (g, XINT (character)); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4641 gstring_out = Ffont_make_gstring (font_object, make_number (10)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4642 while ((num = font->driver->otf_drive (font, otf_features, gstring_in, 0, 1, |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4643 gstring_out, 0, 1)) < 0) |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4644 gstring_out = Ffont_make_gstring (font_object, |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4645 make_number (ASIZE (gstring_out) * 2)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4646 alternates = Qnil; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4647 for (i = 0; i < num; i++) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4648 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4649 Lisp_Object g = LGSTRING_GLYPH (gstring_out, i); |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
4650 int c = LGLYPH_CHAR (g); |
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
4651 unsigned code = LGLYPH_CODE (g); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4652 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4653 alternates = Fcons (Fcons (make_number (code), |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4654 c > 0 ? make_number (c) : Qnil), |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4655 alternates); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4656 } |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4657 return Fnreverse (alternates); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4658 } |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4659 #endif /* 0 */ |
90400 | 4660 |
4661 #ifdef FONT_DEBUG | |
4662 | |
4663 DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0, | |
4664 doc: /* Open FONT-ENTITY. */) | |
4665 (font_entity, size, frame) | |
4666 Lisp_Object font_entity; | |
4667 Lisp_Object size; | |
4668 Lisp_Object frame; | |
4669 { | |
4670 int isize; | |
4671 | |
4672 CHECK_FONT_ENTITY (font_entity); | |
4673 if (NILP (frame)) | |
4674 frame = selected_frame; | |
4675 CHECK_LIVE_FRAME (frame); | |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4676 |
94926 | 4677 if (NILP (size)) |
4678 isize = XINT (AREF (font_entity, FONT_SIZE_INDEX)); | |
4679 else | |
4680 { | |
4681 CHECK_NUMBER_OR_FLOAT (size); | |
4682 if (FLOATP (size)) | |
100165
7add351b47c9
(Fopen_font): Compute pixel size correctly.
Chong Yidong <cyd@stupidchicken.com>
parents:
100126
diff
changeset
|
4683 isize = POINT_TO_PIXEL (XFLOAT_DATA (size), XFRAME (frame)->resy); |
94926 | 4684 else |
4685 isize = XINT (size); | |
4686 if (isize == 0) | |
4687 isize = 120; | |
4688 } | |
90400 | 4689 return font_open_entity (XFRAME (frame), font_entity, isize); |
4690 } | |
4691 | |
4692 DEFUN ("close-font", Fclose_font, Sclose_font, 1, 2, 0, | |
4693 doc: /* Close FONT-OBJECT. */) | |
4694 (font_object, frame) | |
4695 Lisp_Object font_object, frame; | |
4696 { | |
4697 CHECK_FONT_OBJECT (font_object); | |
4698 if (NILP (frame)) | |
4699 frame = selected_frame; | |
4700 CHECK_LIVE_FRAME (frame); | |
4701 font_close_object (XFRAME (frame), font_object); | |
4702 return Qnil; | |
4703 } | |
4704 | |
4705 DEFUN ("query-font", Fquery_font, Squery_font, 1, 1, 0, | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4706 doc: /* Return information about FONT-OBJECT. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4707 The value is a vector: |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4708 [ NAME FILENAME PIXEL-SIZE SIZE ASCENT DESCENT SPACE-WIDTH AVERAGE-WIDTH |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4709 CAPABILITY ] |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4710 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4711 NAME is a string of the font name (or nil if the font backend doesn't |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4712 provide a name). |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4713 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4714 FILENAME is a string of the font file (or nil if the font backend |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4715 doesn't provide a file name). |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4716 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4717 PIXEL-SIZE is a pixel size by which the font is opened. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4718 |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4719 SIZE is a maximum advance width of the font in pixels. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4720 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4721 ASCENT, DESCENT, SPACE-WIDTH, AVERAGE-WIDTH are metrics of the font in |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4722 pixels. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4723 |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4724 CAPABILITY is a list whose first element is a symbol representing the |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4725 font format \(x, opentype, truetype, type1, pcf, or bdf) and the |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4726 remaining elements describe the details of the font capability. |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4727 |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4728 If the font is OpenType font, the form of the list is |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4729 \(opentype GSUB GPOS) |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4730 where GSUB shows which "GSUB" features the font supports, and GPOS |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4731 shows which "GPOS" features the font supports. Both GSUB and GPOS are |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4732 lists of the format: |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4733 \((SCRIPT (LANGSYS FEATURE ...) ...) ...) |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4734 |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4735 If the font is not OpenType font, currently the length of the form is |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4736 one. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4737 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4738 SCRIPT is a symbol representing OpenType script tag. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4739 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4740 LANGSYS is a symbol representing OpenType langsys tag, or nil |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4741 representing the default langsys. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4742 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4743 FEATURE is a symbol representing OpenType feature tag. |
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4744 |
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4745 If the font is not OpenType font, CAPABILITY is nil. */) |
90400 | 4746 (font_object) |
4747 Lisp_Object font_object; | |
4748 { | |
4749 struct font *font; | |
4750 Lisp_Object val; | |
4751 | |
4752 CHECK_FONT_GET_OBJECT (font_object, font); | |
4753 | |
4754 val = Fmake_vector (make_number (9), Qnil); | |
94926 | 4755 ASET (val, 0, AREF (font_object, FONT_NAME_INDEX)); |
4756 ASET (val, 1, AREF (font_object, FONT_FILE_INDEX)); | |
90400 | 4757 ASET (val, 2, make_number (font->pixel_size)); |
94926 | 4758 ASET (val, 3, make_number (font->max_width)); |
90400 | 4759 ASET (val, 4, make_number (font->ascent)); |
4760 ASET (val, 5, make_number (font->descent)); | |
94926 | 4761 ASET (val, 6, make_number (font->space_width)); |
4762 ASET (val, 7, make_number (font->average_width)); | |
90400 | 4763 if (font->driver->otf_capability) |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4764 ASET (val, 8, Fcons (Qopentype, font->driver->otf_capability (font))); |
90400 | 4765 return val; |
4766 } | |
4767 | |
4768 DEFUN ("get-font-glyphs", Fget_font_glyphs, Sget_font_glyphs, 2, 2, 0, | |
4769 doc: /* Return a vector of glyphs of FONT-OBJECT for drawing STRING. | |
4770 Each element is a vector [GLYPH-CODE LBEARING RBEARING WIDTH ASCENT DESCENT]. */) | |
4771 (font_object, string) | |
4772 Lisp_Object font_object, string; | |
4773 { | |
4774 struct font *font; | |
4775 int i, len; | |
4776 Lisp_Object vec; | |
4777 | |
4778 CHECK_FONT_GET_OBJECT (font_object, font); | |
4779 CHECK_STRING (string); | |
4780 len = SCHARS (string); | |
4781 vec = Fmake_vector (make_number (len), Qnil); | |
4782 for (i = 0; i < len; i++) | |
4783 { | |
4784 Lisp_Object ch = Faref (string, make_number (i)); | |
4785 Lisp_Object val; | |
4786 int c = XINT (ch); | |
4787 unsigned code; | |
91871
436548f01688
(Ffont_fill_gstring, Fget_font_glyphs): Fix compilation warnings.
Eli Zaretskii <eliz@gnu.org>
parents:
91553
diff
changeset
|
4788 EMACS_INT cod; |
90400 | 4789 struct font_metrics metrics; |
4790 | |
91871
436548f01688
(Ffont_fill_gstring, Fget_font_glyphs): Fix compilation warnings.
Eli Zaretskii <eliz@gnu.org>
parents:
91553
diff
changeset
|
4791 cod = code = font->driver->encode_char (font, c); |
90400 | 4792 if (code == FONT_INVALID_CODE) |
4793 continue; | |
4794 val = Fmake_vector (make_number (6), Qnil); | |
91871
436548f01688
(Ffont_fill_gstring, Fget_font_glyphs): Fix compilation warnings.
Eli Zaretskii <eliz@gnu.org>
parents:
91553
diff
changeset
|
4795 if (cod <= MOST_POSITIVE_FIXNUM) |
90400 | 4796 ASET (val, 0, make_number (code)); |
4797 else | |
4798 ASET (val, 0, Fcons (make_number (code >> 16), | |
4799 make_number (code & 0xFFFF))); | |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4800 font->driver->text_extents (font, &code, 1, &metrics); |
90400 | 4801 ASET (val, 1, make_number (metrics.lbearing)); |
4802 ASET (val, 2, make_number (metrics.rbearing)); | |
4803 ASET (val, 3, make_number (metrics.width)); | |
4804 ASET (val, 4, make_number (metrics.ascent)); | |
4805 ASET (val, 5, make_number (metrics.descent)); | |
4806 ASET (vec, i, val); | |
4807 } | |
4808 return vec; | |
4809 } | |
4810 | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4811 DEFUN ("font-match-p", Ffont_match_p, Sfont_match_p, 2, 2, 0, |
94745
a995b289585f
(Ffont_match_p): Don't use `iff' in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
94394
diff
changeset
|
4812 doc: /* Return t if and only if font-spec SPEC matches with FONT. |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4813 FONT is a font-spec, font-entity, or font-object. */) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4814 (spec, font) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4815 Lisp_Object spec, font; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4816 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4817 CHECK_FONT_SPEC (spec); |
94926 | 4818 CHECK_FONT (font); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4819 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4820 return (font_match_p (spec, font) ? Qt : Qnil); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4821 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4822 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4823 DEFUN ("font-at", Ffont_at, Sfont_at, 1, 3, 0, |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4824 doc: /* Return a font-object for displaying a character at POSITION. |
90541 | 4825 Optional second arg WINDOW, if non-nil, is a window displaying |
4826 the current buffer. It defaults to the currently selected window. */) | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4827 (position, window, string) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4828 Lisp_Object position, window, string; |
90541 | 4829 { |
4830 struct window *w; | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
4831 EMACS_INT pos; |
90541 | 4832 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4833 if (NILP (string)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4834 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4835 CHECK_NUMBER_COERCE_MARKER (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4836 pos = XINT (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4837 if (pos < BEGV || pos >= ZV) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4838 args_out_of_range_3 (position, make_number (BEGV), make_number (ZV)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4839 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4840 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4841 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4842 CHECK_NUMBER (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4843 CHECK_STRING (string); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4844 pos = XINT (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4845 if (pos < 0 || pos >= SCHARS (string)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4846 args_out_of_range (string, position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4847 } |
90541 | 4848 if (NILP (window)) |
4849 window = selected_window; | |
4850 CHECK_LIVE_WINDOW (window); | |
91273
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4851 w = XWINDOW (window); |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4852 |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4853 return font_at (-1, pos, NULL, w, string); |
90541 | 4854 } |
4855 | |
90400 | 4856 #if 0 |
4857 DEFUN ("draw-string", Fdraw_string, Sdraw_string, 2, 2, 0, | |
4858 doc: /* Draw STRING by FONT-OBJECT on the top left corner of the current frame. | |
4859 The value is a number of glyphs drawn. | |
4860 Type C-l to recover what previously shown. */) | |
4861 (font_object, string) | |
4862 Lisp_Object font_object, string; | |
4863 { | |
4864 Lisp_Object frame = selected_frame; | |
4865 FRAME_PTR f = XFRAME (frame); | |
4866 struct font *font; | |
4867 struct face *face; | |
4868 int i, len, width; | |
4869 unsigned *code; | |
4870 | |
4871 CHECK_FONT_GET_OBJECT (font_object, font); | |
4872 CHECK_STRING (string); | |
4873 len = SCHARS (string); | |
4874 code = alloca (sizeof (unsigned) * len); | |
4875 for (i = 0; i < len; i++) | |
4876 { | |
4877 Lisp_Object ch = Faref (string, make_number (i)); | |
4878 Lisp_Object val; | |
4879 int c = XINT (ch); | |
4880 | |
4881 code[i] = font->driver->encode_char (font, c); | |
4882 if (code[i] == FONT_INVALID_CODE) | |
4883 break; | |
4884 } | |
4885 face = FACE_FROM_ID (f, DEFAULT_FACE_ID); | |
4886 face->fontp = font; | |
4887 if (font->driver->prepare_face) | |
4888 font->driver->prepare_face (f, face); | |
4889 width = font->driver->text_extents (font, code, i, NULL); | |
4890 len = font->driver->draw_text (f, face, 0, font->ascent, code, i, width); | |
4891 if (font->driver->done_face) | |
4892 font->driver->done_face (f, face); | |
4893 face->fontp = NULL; | |
4894 return make_number (len); | |
4895 } | |
4896 #endif | |
4897 | |
4898 #endif /* FONT_DEBUG */ | |
4899 | |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
4900 #ifdef HAVE_WINDOW_SYSTEM |
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
4901 |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4902 DEFUN ("font-info", Ffont_info, Sfont_info, 1, 2, 0, |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4903 doc: /* Return information about a font named NAME on frame FRAME. |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4904 If FRAME is omitted or nil, use the selected frame. |
102963
b6011e455600
(Ffont_info): Fix docstring. Fix the second element of
Kenichi Handa <handa@m17n.org>
parents:
102943
diff
changeset
|
4905 The returned value is a vector of OPENED-NAME, FULL-NAME, SIZE, |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4906 HEIGHT, BASELINE-OFFSET, RELATIVE-COMPOSE, and DEFAULT-ASCENT, |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4907 where |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4908 OPENED-NAME is the name used for opening the font, |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4909 FULL-NAME is the full name of the font, |
102963
b6011e455600
(Ffont_info): Fix docstring. Fix the second element of
Kenichi Handa <handa@m17n.org>
parents:
102943
diff
changeset
|
4910 SIZE is the pixelsize of the font, |
b6011e455600
(Ffont_info): Fix docstring. Fix the second element of
Kenichi Handa <handa@m17n.org>
parents:
102943
diff
changeset
|
4911 HEIGHT is the pixel-height of the font (i.e ascent + descent), |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4912 BASELINE-OFFSET is the upward offset pixels from ASCII baseline, |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4913 RELATIVE-COMPOSE and DEFAULT-ASCENT are the numbers controlling |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4914 how to compose characters. |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4915 If the named font is not yet loaded, return nil. */) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4916 (name, frame) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4917 Lisp_Object name, frame; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4918 { |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4919 FRAME_PTR f; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4920 struct font *font; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4921 Lisp_Object info; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4922 Lisp_Object font_object; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4923 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4924 (*check_window_system_func) (); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4925 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4926 if (! FONTP (name)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4927 CHECK_STRING (name); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4928 if (NILP (frame)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4929 frame = selected_frame; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4930 CHECK_LIVE_FRAME (frame); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4931 f = XFRAME (frame); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4932 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4933 if (STRINGP (name)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4934 { |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4935 int fontset = fs_query_fontset (name, 0); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4936 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4937 if (fontset >= 0) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4938 name = fontset_ascii (fontset); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4939 font_object = font_open_by_name (f, (char *) SDATA (name)); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4940 } |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4941 else if (FONT_OBJECT_P (name)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4942 font_object = name; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4943 else if (FONT_ENTITY_P (name)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4944 font_object = font_open_entity (f, name, 0); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4945 else |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4946 { |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4947 struct face *face = FACE_FROM_ID (f, DEFAULT_FACE_ID); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4948 Lisp_Object entity = font_matching_entity (f, face->lface, name); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4949 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4950 font_object = ! NILP (entity) ? font_open_entity (f, entity, 0) : Qnil; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4951 } |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4952 if (NILP (font_object)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4953 return Qnil; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4954 font = XFONT_OBJECT (font_object); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4955 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4956 info = Fmake_vector (make_number (7), Qnil); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4957 XVECTOR (info)->contents[0] = AREF (font_object, FONT_NAME_INDEX); |
102963
b6011e455600
(Ffont_info): Fix docstring. Fix the second element of
Kenichi Handa <handa@m17n.org>
parents:
102943
diff
changeset
|
4958 XVECTOR (info)->contents[1] = AREF (font_object, FONT_FULLNAME_INDEX); |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4959 XVECTOR (info)->contents[2] = make_number (font->pixel_size); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4960 XVECTOR (info)->contents[3] = make_number (font->height); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4961 XVECTOR (info)->contents[4] = make_number (font->baseline_offset); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4962 XVECTOR (info)->contents[5] = make_number (font->relative_compose); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4963 XVECTOR (info)->contents[6] = make_number (font->default_ascent); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4964 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4965 #if 0 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4966 /* As font_object is still in FONT_OBJLIST of the entity, we can't |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4967 close it now. Perhaps, we should manage font-objects |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4968 by `reference-count'. */ |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4969 font_close_object (f, font_object); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4970 #endif |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4971 return info; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4972 } |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
4973 #endif |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4974 |
90400 | 4975 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4976 #define BUILD_STYLE_TABLE(TBL) \ |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4977 build_style_table ((TBL), sizeof TBL / sizeof (struct table_entry)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4978 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4979 static Lisp_Object |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4980 build_style_table (entry, nelement) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4981 struct table_entry *entry; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4982 int nelement; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4983 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4984 int i, j; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4985 Lisp_Object table, elt; |
95886
c8bc52f94b6d
(syms_of_font) <font-weight-table, font-slant-table, font-width-table>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95875
diff
changeset
|
4986 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4987 table = Fmake_vector (make_number (nelement), Qnil); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4988 for (i = 0; i < nelement; i++) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4989 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4990 for (j = 0; entry[i].names[j]; j++); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4991 elt = Fmake_vector (make_number (j + 1), Qnil); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4992 ASET (elt, 0, make_number (entry[i].numeric)); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4993 for (j = 0; entry[i].names[j]; j++) |
95886
c8bc52f94b6d
(syms_of_font) <font-weight-table, font-slant-table, font-width-table>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95875
diff
changeset
|
4994 ASET (elt, j + 1, intern (entry[i].names[j])); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4995 ASET (table, i, elt); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4996 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4997 return table; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4998 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4999 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5000 static Lisp_Object Vfont_log; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5001 static int font_log_env_checked; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5002 |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5003 /* The deferred font-log data of the form [ACTION ARG RESULT]. |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5004 If ACTION is not nil, that is added to the log when font_add_log is |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5005 called next time. At that time, ACTION is set back to nil. */ |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5006 static Lisp_Object Vfont_log_deferred; |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5007 |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5008 /* Prepend the font-related logging data in Vfont_log if it is not |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5009 `t'. ACTION describes a kind of font-related action (e.g. listing, |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5010 opening), ARG is the argument for the action, and RESULT is the |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5011 result of the action. */ |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5012 void |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5013 font_add_log (action, arg, result) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5014 char *action; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5015 Lisp_Object arg, result; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5016 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5017 Lisp_Object tail, val; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5018 int i; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5019 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5020 if (! font_log_env_checked) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5021 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5022 Vfont_log = egetenv ("EMACS_FONT_LOG") ? Qnil : Qt; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5023 font_log_env_checked = 1; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5024 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5025 if (EQ (Vfont_log, Qt)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5026 return; |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5027 if (STRINGP (AREF (Vfont_log_deferred, 0))) |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5028 { |
97822 | 5029 char *str = (char *) SDATA (AREF (Vfont_log_deferred, 0)); |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5030 |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5031 ASET (Vfont_log_deferred, 0, Qnil); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5032 font_add_log (str, AREF (Vfont_log_deferred, 1), |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5033 AREF (Vfont_log_deferred, 2)); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5034 } |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5035 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5036 if (FONTP (arg)) |
97538
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5037 { |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5038 Lisp_Object tail, elt; |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5039 Lisp_Object equalstr = build_string ("="); |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5040 |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5041 val = Ffont_xlfd_name (arg, Qt); |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5042 for (tail = AREF (arg, FONT_EXTRA_INDEX); CONSP (tail); |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5043 tail = XCDR (tail)) |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5044 { |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5045 elt = XCAR (tail); |
99072
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
5046 if (EQ (XCAR (elt), QCscript) |
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
5047 && SYMBOLP (XCDR (elt))) |
97538
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5048 val = concat3 (val, SYMBOL_NAME (QCscript), |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5049 concat2 (equalstr, SYMBOL_NAME (XCDR (elt)))); |
99072
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
5050 else if (EQ (XCAR (elt), QClang) |
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
5051 && SYMBOLP (XCDR (elt))) |
97538
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5052 val = concat3 (val, SYMBOL_NAME (QClang), |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5053 concat2 (equalstr, SYMBOL_NAME (XCDR (elt)))); |
99072
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
5054 else if (EQ (XCAR (elt), QCotf) |
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
5055 && CONSP (XCDR (elt)) && SYMBOLP (XCAR (XCDR (elt)))) |
97538
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5056 val = concat3 (val, SYMBOL_NAME (QCotf), |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5057 concat2 (equalstr, |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5058 SYMBOL_NAME (XCAR (XCDR (elt))))); |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5059 } |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5060 arg = val; |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
5061 } |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5062 if (FONTP (result)) |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5063 { |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5064 val = Ffont_xlfd_name (result, Qt); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5065 if (! FONT_SPEC_P (result)) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5066 val = concat3 (SYMBOL_NAME (AREF (result, FONT_TYPE_INDEX)), |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5067 build_string (":"), val); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5068 result = val; |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
5069 } |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5070 else if (CONSP (result)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5071 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5072 result = Fcopy_sequence (result); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5073 for (tail = result; CONSP (tail); tail = XCDR (tail)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5074 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5075 val = XCAR (tail); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5076 if (FONTP (val)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5077 val = Ffont_xlfd_name (val, Qt); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5078 XSETCAR (tail, val); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5079 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5080 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5081 else if (VECTORP (result)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5082 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5083 result = Fcopy_sequence (result); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5084 for (i = 0; i < ASIZE (result); i++) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5085 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5086 val = AREF (result, i); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5087 if (FONTP (val)) |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5088 val = Ffont_xlfd_name (val, Qt); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5089 ASET (result, i, val); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5090 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5091 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5092 Vfont_log = Fcons (list3 (intern (action), arg, result), Vfont_log); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5093 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5094 |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5095 /* Record a font-related logging data to be added to Vfont_log when |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5096 font_add_log is called next time. ACTION, ARG, RESULT are the same |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5097 as font_add_log. */ |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5098 |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5099 void |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5100 font_deferred_log (action, arg, result) |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5101 char *action; |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5102 Lisp_Object arg, result; |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5103 { |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5104 ASET (Vfont_log_deferred, 0, build_string (action)); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5105 ASET (Vfont_log_deferred, 1, arg); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5106 ASET (Vfont_log_deferred, 2, result); |
100336
d53183123ad7
* font.c (Ffont_spec): Move usage to end of docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
100173
diff
changeset
|
5107 } |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5108 |
90400 | 5109 extern void syms_of_ftfont P_ (()); |
5110 extern void syms_of_xfont P_ (()); | |
5111 extern void syms_of_xftfont P_ (()); | |
5112 extern void syms_of_ftxfont P_ (()); | |
5113 extern void syms_of_bdffont P_ (()); | |
5114 extern void syms_of_w32font P_ (()); | |
5115 extern void syms_of_atmfont P_ (()); | |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
5116 extern void syms_of_nsfont P_ (()); |
90400 | 5117 |
5118 void | |
5119 syms_of_font () | |
5120 { | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
5121 sort_shift_bits[FONT_TYPE_INDEX] = 0; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
5122 sort_shift_bits[FONT_SLANT_INDEX] = 2; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
5123 sort_shift_bits[FONT_WEIGHT_INDEX] = 9; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
5124 sort_shift_bits[FONT_SIZE_INDEX] = 16; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
5125 sort_shift_bits[FONT_WIDTH_INDEX] = 23; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
5126 /* Note that the other elements in sort_shift_bits are not used. */ |
90400 | 5127 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
5128 staticpro (&font_charset_alist); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
5129 font_charset_alist = Qnil; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
5130 |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
5131 DEFSYM (Qopentype, "opentype"); |
90400 | 5132 |
95699 | 5133 DEFSYM (Qascii_0, "ascii-0"); |
90439
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
5134 DEFSYM (Qiso8859_1, "iso8859-1"); |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
5135 DEFSYM (Qiso10646_1, "iso10646-1"); |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
5136 DEFSYM (Qunicode_bmp, "unicode-bmp"); |
90622
bb9362e3a03b
(Qunicode_sip): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90590
diff
changeset
|
5137 DEFSYM (Qunicode_sip, "unicode-sip"); |
90439
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
5138 |
97822 | 5139 DEFSYM (QCf, "Cf"); |
5140 | |
90400 | 5141 DEFSYM (QCotf, ":otf"); |
94926 | 5142 DEFSYM (QClang, ":lang"); |
90400 | 5143 DEFSYM (QCscript, ":script"); |
91125
6c9a19ff6c55
(Qfontp): Remove unused symbol.
Jason Rumney <jasonr@gnu.org>
parents:
91112
diff
changeset
|
5144 DEFSYM (QCantialias, ":antialias"); |
90400 | 5145 |
5146 DEFSYM (QCfoundry, ":foundry"); | |
5147 DEFSYM (QCadstyle, ":adstyle"); | |
5148 DEFSYM (QCregistry, ":registry"); | |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
5149 DEFSYM (QCspacing, ":spacing"); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
5150 DEFSYM (QCdpi, ":dpi"); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5151 DEFSYM (QCscalable, ":scalable"); |
94926 | 5152 DEFSYM (QCavgwidth, ":avgwidth"); |
5153 DEFSYM (QCfont_entity, ":font-entity"); | |
5154 DEFSYM (QCfc_unknown_spec, ":fc-unknown-spec"); | |
90400 | 5155 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5156 DEFSYM (Qc, "c"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5157 DEFSYM (Qm, "m"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5158 DEFSYM (Qp, "p"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5159 DEFSYM (Qd, "d"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5160 |
103011
8f0fbb48af5a
* font.c (Qja, Qko): Move definitions here from ftfont.c.
Chong Yidong <cyd@stupidchicken.com>
parents:
102990
diff
changeset
|
5161 DEFSYM (Qja, "ja"); |
8f0fbb48af5a
* font.c (Qja, Qko): Move definitions here from ftfont.c.
Chong Yidong <cyd@stupidchicken.com>
parents:
102990
diff
changeset
|
5162 DEFSYM (Qko, "ko"); |
8f0fbb48af5a
* font.c (Qja, Qko): Move definitions here from ftfont.c.
Chong Yidong <cyd@stupidchicken.com>
parents:
102990
diff
changeset
|
5163 |
90400 | 5164 staticpro (&null_vector); |
5165 null_vector = Fmake_vector (make_number (0), Qnil); | |
5166 | |
5167 staticpro (&scratch_font_spec); | |
5168 scratch_font_spec = Ffont_spec (0, NULL); | |
5169 staticpro (&scratch_font_prefer); | |
5170 scratch_font_prefer = Ffont_spec (0, NULL); | |
5171 | |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5172 staticpro (&Vfont_log_deferred); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5173 Vfont_log_deferred = Fmake_vector (make_number (3), Qnil); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
5174 |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
5175 #if 0 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
5176 #ifdef HAVE_LIBOTF |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
5177 staticpro (&otf_list); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
5178 otf_list = Qnil; |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
5179 #endif /* HAVE_LIBOTF */ |
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
5180 #endif /* 0 */ |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
5181 |
90400 | 5182 defsubr (&Sfontp); |
5183 defsubr (&Sfont_spec); | |
5184 defsubr (&Sfont_get); | |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
5185 #ifdef HAVE_WINDOW_SYSTEM |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
5186 defsubr (&Sfont_face_attributes); |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
5187 #endif |
90400 | 5188 defsubr (&Sfont_put); |
5189 defsubr (&Slist_fonts); | |
94926 | 5190 defsubr (&Sfont_family_list); |
90400 | 5191 defsubr (&Sfind_font); |
5192 defsubr (&Sfont_xlfd_name); | |
5193 defsubr (&Sclear_font_cache); | |
97822 | 5194 defsubr (&Sfont_shape_gstring); |
100793
04bd84418dd7
(font_range): Don't require a font for a variation
Kenichi Handa <handa@m17n.org>
parents:
100759
diff
changeset
|
5195 defsubr (&Sfont_variation_glyphs); |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
5196 #if 0 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
5197 defsubr (&Sfont_drive_otf); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
5198 defsubr (&Sfont_otf_alternates); |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
5199 #endif /* 0 */ |
90400 | 5200 |
5201 #ifdef FONT_DEBUG | |
5202 defsubr (&Sopen_font); | |
5203 defsubr (&Sclose_font); | |
5204 defsubr (&Squery_font); | |
5205 defsubr (&Sget_font_glyphs); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5206 defsubr (&Sfont_match_p); |
90541 | 5207 defsubr (&Sfont_at); |
90400 | 5208 #if 0 |
5209 defsubr (&Sdraw_string); | |
5210 #endif | |
5211 #endif /* FONT_DEBUG */ | |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
5212 #ifdef HAVE_WINDOW_SYSTEM |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
5213 defsubr (&Sfont_info); |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
5214 #endif |
90400 | 5215 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5216 DEFVAR_LISP ("font-encoding-alist", &Vfont_encoding_alist, |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5217 doc: /* |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5218 Alist of fontname patterns vs the corresponding encoding and repertory info. |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5219 Each element looks like (REGEXP . (ENCODING . REPERTORY)), |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5220 where ENCODING is a charset or a char-table, |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5221 and REPERTORY is a charset, a char-table, or nil. |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5222 |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
5223 If ENCODING and REPERTORY are the same, the element can have the form |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5224 \(REGEXP . ENCODING). |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5225 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5226 ENCODING is for converting a character to a glyph code of the font. |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5227 If ENCODING is a charset, encoding a character by the charset gives |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5228 the corresponding glyph code. If ENCODING is a char-table, looking up |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5229 the table by a character gives the corresponding glyph code. |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5230 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5231 REPERTORY specifies a repertory of characters supported by the font. |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5232 If REPERTORY is a charset, all characters beloging to the charset are |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5233 supported. If REPERTORY is a char-table, all characters who have a |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
5234 non-nil value in the table are supported. If REPERTORY is nil, Emacs |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5235 gets the repertory information by an opened font and ENCODING. */); |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5236 Vfont_encoding_alist = Qnil; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5237 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5238 DEFVAR_LISP_NOPRO ("font-weight-table", &Vfont_weight_table, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5239 doc: /* Vector of valid font weight values. |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5240 Each element has the form: |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5241 [NUMERIC-VALUE SYMBOLIC-NAME ALIAS-NAME ...] |
95886
c8bc52f94b6d
(syms_of_font) <font-weight-table, font-slant-table, font-width-table>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95875
diff
changeset
|
5242 NUMERIC-VALUE is an integer, and SYMBOLIC-NAME and ALIAS-NAME are symbols. */); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5243 Vfont_weight_table = BUILD_STYLE_TABLE (weight_table); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5244 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5245 DEFVAR_LISP_NOPRO ("font-slant-table", &Vfont_slant_table, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5246 doc: /* Vector of font slant symbols vs the corresponding numeric values. |
95886
c8bc52f94b6d
(syms_of_font) <font-weight-table, font-slant-table, font-width-table>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95875
diff
changeset
|
5247 See `font-weight-table' for the format of the vector. */); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5248 Vfont_slant_table = BUILD_STYLE_TABLE (slant_table); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5249 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5250 DEFVAR_LISP_NOPRO ("font-width-table", &Vfont_width_table, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5251 doc: /* Alist of font width symbols vs the corresponding numeric values. |
95886
c8bc52f94b6d
(syms_of_font) <font-weight-table, font-slant-table, font-width-table>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95875
diff
changeset
|
5252 See `font-weight-table' for the format of the vector. */); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5253 Vfont_width_table = BUILD_STYLE_TABLE (width_table); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5254 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5255 staticpro (&font_style_table); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5256 font_style_table = Fmake_vector (make_number (3), Qnil); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5257 ASET (font_style_table, 0, Vfont_weight_table); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5258 ASET (font_style_table, 1, Vfont_slant_table); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5259 ASET (font_style_table, 2, Vfont_width_table); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5260 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5261 DEFVAR_LISP ("font-log", &Vfont_log, doc: /* |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5262 *Logging list of font related actions and results. |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5263 The value t means to suppress the logging. |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5264 The initial value is set to nil if the environment variable |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5265 EMACS_FONT_LOG is set. Otherwise, it is set to t. */); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5266 Vfont_log = Qnil; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5267 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5268 #ifdef HAVE_WINDOW_SYSTEM |
90400 | 5269 #ifdef HAVE_FREETYPE |
94926 | 5270 syms_of_ftfont (); |
90400 | 5271 #ifdef HAVE_X_WINDOWS |
94926 | 5272 syms_of_xfont (); |
5273 syms_of_ftxfont (); | |
90400 | 5274 #ifdef HAVE_XFT |
94926 | 5275 syms_of_xftfont (); |
90400 | 5276 #endif /* HAVE_XFT */ |
5277 #endif /* HAVE_X_WINDOWS */ | |
5278 #else /* not HAVE_FREETYPE */ | |
5279 #ifdef HAVE_X_WINDOWS | |
94926 | 5280 syms_of_xfont (); |
90400 | 5281 #endif /* HAVE_X_WINDOWS */ |
5282 #endif /* not HAVE_FREETYPE */ | |
5283 #ifdef HAVE_BDFFONT | |
94926 | 5284 syms_of_bdffont (); |
90400 | 5285 #endif /* HAVE_BDFFONT */ |
5286 #ifdef WINDOWSNT | |
94926 | 5287 syms_of_w32font (); |
90400 | 5288 #endif /* WINDOWSNT */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
5289 #ifdef HAVE_NS |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
5290 syms_of_nsfont (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
5291 #endif /* HAVE_NS */ |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5292 #endif /* HAVE_WINDOW_SYSTEM */ |
90400 | 5293 } |
90427 | 5294 |
5295 /* arch-tag: 74c9475d-5976-4c93-a327-942ae3072846 | |
5296 (do not change this comment) */ |