Mercurial > emacs
annotate src/font.c @ 99114:e71b3b67d831
(end-of-sexp, beginning-of-sexp, forward-same-syntax): Omit default
arguments to char-after and char-before.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 25 Oct 2008 00:12:37 +0000 |
parents | 06c37ccf1b58 |
children | c2ef1c8b2d64 |
rev | line source |
---|---|
90400 | 1 /* font.c -- "Font" primitives. |
91553 | 2 Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. |
3 Copyright (C) 2006, 2007, 2008 | |
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 |
94926 | 50 Lisp_Object Qfont_spec, Qfont_entity, Qfont_object; |
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
|
51 |
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 #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
|
53 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
|
54 #endif |
90400 | 55 |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
56 Lisp_Object Qopentype; |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
57 |
94926 | 58 /* Important character set strings. */ |
95699 | 59 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
|
60 |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
61 #ifdef HAVE_NS |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
62 #define DEFAULT_ENCODING Qiso10646_1 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
63 #else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
64 #define DEFAULT_ENCODING Qiso8859_1 |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
65 #endif |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
66 |
97822 | 67 /* Unicode category `Cf'. */ |
68 static Lisp_Object QCf; | |
69 | |
90400 | 70 /* Special vector of zero length. This is repeatedly used by (struct |
71 font_driver *)->list when a specified font is not found. */ | |
94926 | 72 static Lisp_Object null_vector; |
73 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
74 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
|
75 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
76 /* Vector of Vfont_weight_table, Vfont_slant_table, and Vfont_width_table. */ |
90400 | 77 static Lisp_Object font_style_table; |
78 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
79 /* 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
|
80 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
|
81 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
82 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
|
83 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
84 int numeric; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
85 /* 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
|
86 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
|
87 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
|
88 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
|
89 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
90 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
91 /* 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
|
92 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
|
93 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
94 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
|
95 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
96 { 0, { "thin" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
97 { 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
|
98 { 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
|
99 { 50, { "light" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
100 { 75, { "semi-light", "semilight", "demilight", "book" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
101 { 100, { "normal", "medium", "regular" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
102 { 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
|
103 { 200, { "bold" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
104 { 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
|
105 { 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
|
106 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
107 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
108 /* 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
|
109 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
|
110 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
111 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
|
112 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
113 { 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
|
114 { 10, { "reverse-italic", "ri" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
115 { 100, { "normal", "r" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
116 { 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
|
117 { 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
|
118 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
119 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
120 /* 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
|
121 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
|
122 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
123 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
|
124 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
125 { 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
|
126 { 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
|
127 { 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
|
128 { 87, { "semi-condensed", "semicondensed", "demicondensed" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
129 { 100, { "normal", "medium", "regular" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
130 { 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
|
131 { 125, { "expanded" }}, |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
132 { 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
|
133 { 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
|
134 }; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
135 |
94926 | 136 extern Lisp_Object Qnormal; |
90400 | 137 |
138 /* 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
|
139 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
|
140 extern Lisp_Object QCheight, QCsize, QCname; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
141 |
94926 | 142 Lisp_Object QCfoundry, QCadstyle, QCregistry; |
90400 | 143 /* Symbols representing keys of font extra info. */ |
94926 | 144 Lisp_Object QCspacing, QCdpi, QCscalable, QCotf, QClang, QCscript, QCavgwidth; |
145 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
|
146 /* Symbols representing values of font spacing property. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
147 Lisp_Object Qc, Qm, Qp, Qd; |
90400 | 148 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
149 Lisp_Object Vfont_encoding_alist; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
150 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
151 /* 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
|
152 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
|
153 Vfont_encoding_alist on demand. |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
154 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
155 Eash element has the form: |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
156 (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
|
157 or |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
158 (REGISTRY . nil) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
159 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
160 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
|
161 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
|
162 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
|
163 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
|
164 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
165 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
|
166 retrieved. */ |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
167 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
|
168 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
169 /* 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
|
170 register_font_driver in syms_of_XXXfont to register its font-driver |
90400 | 171 here. */ |
172 static struct font_driver_list *font_driver_list; | |
173 | |
94926 | 174 |
175 | |
176 /* Creaters of font-related Lisp object. */ | |
177 | |
178 Lisp_Object | |
179 font_make_spec () | |
180 { | |
181 Lisp_Object font_spec; | |
182 struct font_spec *spec | |
183 = ((struct font_spec *) | |
184 allocate_pseudovector (VECSIZE (struct font_spec), | |
185 FONT_SPEC_MAX, PVEC_FONT)); | |
186 XSETFONT (font_spec, spec); | |
187 return font_spec; | |
188 } | |
189 | |
190 Lisp_Object | |
191 font_make_entity () | |
192 { | |
193 Lisp_Object font_entity; | |
194 struct font_entity *entity | |
195 = ((struct font_entity *) | |
196 allocate_pseudovector (VECSIZE (struct font_entity), | |
197 FONT_ENTITY_MAX, PVEC_FONT)); | |
198 XSETFONT (font_entity, entity); | |
199 return font_entity; | |
200 } | |
201 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
202 /* 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
|
203 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
|
204 PIXELSIZE is positive, set the `size' property to PIXELSIZE. */ |
94926 | 205 Lisp_Object |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
206 font_make_object (size, entity, pixelsize) |
94926 | 207 int size; |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
208 Lisp_Object entity; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
209 int pixelsize; |
94926 | 210 { |
211 Lisp_Object font_object; | |
212 struct font *font | |
213 = (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
|
214 int i; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
215 |
94926 | 216 XSETFONT (font_object, font); |
217 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
218 if (! NILP (entity)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
219 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
220 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
|
221 font->props[i] = AREF (entity, i); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
222 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
|
223 font->props[FONT_EXTRA_INDEX] |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
224 = 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
|
225 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
226 if (size > 0) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
227 font->props[FONT_SIZE_INDEX] = make_number (pixelsize); |
94926 | 228 return font_object; |
229 } | |
230 | |
231 | |
232 | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
233 static int font_pixel_size P_ ((FRAME_PTR f, Lisp_Object)); |
94926 | 234 static Lisp_Object font_open_entity P_ ((FRAME_PTR, Lisp_Object, int)); |
235 static Lisp_Object font_matching_entity P_ ((FRAME_PTR, Lisp_Object *, | |
90400 | 236 Lisp_Object)); |
237 | |
238 /* Number of registered font drivers. */ | |
239 static int num_font_drivers; | |
240 | |
94926 | 241 |
242 /* Return a Lispy value of a font property value at STR and LEN bytes. | |
243 If STR is "*", it returns nil. | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
244 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
|
245 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
|
246 STR. */ |
94926 | 247 |
248 Lisp_Object | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
249 font_intern_prop (str, len, force_symbol) |
94926 | 250 char *str; |
251 int len; | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
252 int force_symbol; |
94926 | 253 { |
254 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
|
255 Lisp_Object tem; |
94926 | 256 Lisp_Object obarray; |
257 | |
258 if (len == 1 && *str == '*') | |
259 return Qnil; | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
260 if (!force_symbol && len >=1 && isdigit (*str)) |
94926 | 261 { |
262 for (i = 1; i < len; i++) | |
263 if (! isdigit (str[i])) | |
264 break; | |
265 if (i == len) | |
266 return make_number (atoi (str)); | |
267 } | |
268 | |
269 /* The following code is copied from the function intern (in lread.c). */ | |
270 obarray = Vobarray; | |
271 if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0) | |
272 obarray = check_obarray (obarray); | |
273 tem = oblookup (obarray, str, len, len); | |
274 if (SYMBOLP (tem)) | |
275 return tem; | |
276 return Fintern (make_unibyte_string (str, len), obarray); | |
277 } | |
278 | |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
279 /* 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
|
280 |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
281 static int |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
282 font_pixel_size (f, spec) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
283 FRAME_PTR f; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
284 Lisp_Object spec; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
285 { |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
286 #ifdef HAVE_WINDOW_SYSTEM |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
287 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
|
288 double point_size; |
94926 | 289 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
|
290 Lisp_Object val; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
291 |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
292 if (INTEGERP (size)) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
293 return XINT (size); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
294 if (NILP (size)) |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
295 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
|
296 font_assert (FLOATP (size)); |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
297 point_size = XFLOAT_DATA (size); |
94926 | 298 val = AREF (spec, FONT_DPI_INDEX); |
299 if (INTEGERP (val)) | |
95483
d3cbd7d56845
(font_pixel_size): Don't take cdr of an integer.
Chong Yidong <cyd@stupidchicken.com>
parents:
95475
diff
changeset
|
300 dpi = XINT (val); |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
301 else |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
302 dpi = f->resy; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
303 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
|
304 return pixel_size; |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
305 #else |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
306 return 1; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
307 #endif |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
308 } |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
309 |
94926 | 310 |
311 /* Return a value of PROP's VAL (symbol or integer) to be stored in a | |
312 font vector. If VAL is not valid (i.e. not registered in | |
313 font_style_table), return -1 if NOERROR is zero, and return a | |
314 proper index if NOERROR is nonzero. In that case, register VAL in | |
315 font_style_table if VAL is a symbol, and return a closest index if | |
316 VAL is an integer. */ | |
317 | |
318 int | |
319 font_style_to_value (prop, val, noerror) | |
90400 | 320 enum font_property_index prop; |
94926 | 321 Lisp_Object val; |
322 int noerror; | |
90400 | 323 { |
94926 | 324 Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX); |
325 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
|
326 int i, j; |
94926 | 327 |
328 if (SYMBOLP (val)) | |
90400 | 329 { |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
330 unsigned char *s; |
94926 | 331 Lisp_Object args[2], elt; |
332 | |
333 /* At first try exact match. */ | |
334 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
|
335 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
|
336 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
|
337 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
|
338 | (i << 4) | (j - 1)); |
94926 | 339 /* 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
|
340 s = SDATA (SYMBOL_NAME (val)); |
94926 | 341 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
|
342 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
|
343 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
344 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
|
345 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
|
346 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
|
347 | (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
|
348 } |
94926 | 349 if (! noerror) |
350 return -1; | |
351 if (len == 255) | |
352 abort (); | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
353 elt = Fmake_vector (make_number (2), make_number (255)); |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
354 ASET (elt, 1, val); |
94926 | 355 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
|
356 args[1] = Fmake_vector (make_number (1), elt); |
94926 | 357 ASET (font_style_table, prop - FONT_WEIGHT_INDEX, Fvconcat (2, args)); |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
358 return (255 << 8) | (i << 4); |
90400 | 359 } |
94926 | 360 else |
361 { | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
362 int i, last_n; |
94926 | 363 int numeric = XINT (val); |
364 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
365 for (i = 0, last_n = -1; i < len; i++) |
94926 | 366 { |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
367 int n = XINT (AREF (AREF (table, i), 0)); |
94926 | 368 |
369 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
|
370 return (n << 8) | (i << 4); |
94926 | 371 if (numeric < n) |
372 { | |
373 if (! noerror) | |
374 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
|
375 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
|
376 ? (n << 8) | (i << 4): (last_n << 8 | ((i - 1) << 4))); |
94926 | 377 } |
378 last_n = n; | |
379 } | |
380 if (! noerror) | |
381 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
|
382 return ((last_n << 8) | ((i - 1) << 4)); |
94926 | 383 } |
90400 | 384 } |
385 | |
386 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
|
387 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
|
388 Lisp_Object font; |
94926 | 389 enum font_property_index prop; |
390 int for_face; | |
90400 | 391 { |
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
|
392 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
|
393 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
|
394 int i; |
94926 | 395 |
396 if (NILP (val)) | |
397 return Qnil; | |
398 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
|
399 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
|
400 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
|
401 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
|
402 font_assert ((i & 0xF) + 1 < ASIZE (elt)); |
95894
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95890
diff
changeset
|
403 return (for_face ? AREF (elt, 1) : AREF (elt, (i & 0xF) + 1)); |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95890
diff
changeset
|
404 } |
76261fd18708
* w32fns.c (Fw32_select_font): Removed old font API function.
Jason Rumney <jasonr@gnu.org>
parents:
95890
diff
changeset
|
405 |
90400 | 406 extern Lisp_Object Vface_alternative_font_family_alist; |
407 | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
408 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
|
409 |
94926 | 410 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
411 /* 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
|
412 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
|
413 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
|
414 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
415 Lisp_Object |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
416 find_font_encoding (fontname) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
417 Lisp_Object fontname; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
418 { |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
419 Lisp_Object tail, elt; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
420 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
421 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
|
422 { |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
423 elt = XCAR (tail); |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
424 if (CONSP (elt) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
425 && STRINGP (XCAR (elt)) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
426 && 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
|
427 && (SYMBOLP (XCDR (elt)) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
428 ? CHARSETP (XCDR (elt)) |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
429 : 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
|
430 return (XCDR (elt)); |
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 /* We don't know the encoding of this font. Let's assume `ascii'. */ |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
433 return Qascii; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
434 } |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
435 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
436 /* 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
|
437 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
|
438 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
|
439 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
440 int |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
441 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
|
442 Lisp_Object registry; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
443 struct charset **encoding, **repertory; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
444 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
445 Lisp_Object val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
446 int encoding_id, repertory_id; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
447 |
94926 | 448 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
|
449 if (! NILP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
450 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
451 val = XCDR (val); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
452 if (NILP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
453 return -1; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
454 encoding_id = XINT (XCAR (val)); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
455 repertory_id = XINT (XCDR (val)); |
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 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
458 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
459 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
|
460 if (SYMBOLP (val) && CHARSETP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
461 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
462 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
|
463 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
464 else if (CONSP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
465 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
466 if (! CHARSETP (XCAR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
467 goto invalid_entry; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
468 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
|
469 if (NILP (XCDR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
470 repertory_id = -1; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
471 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
472 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
473 if (! CHARSETP (XCDR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
474 goto invalid_entry; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
475 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
|
476 } |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
477 } |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
478 else |
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 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
|
481 font_charset_alist |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
482 = 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
|
483 } |
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 (encoding) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
486 *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
|
487 if (repertory) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
488 *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
|
489 return 0; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
490 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
491 invalid_entry: |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
492 font_charset_alist |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
493 = 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
|
494 return -1; |
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 |
90400 | 497 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
498 /* 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
|
499 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
|
500 |
94926 | 501 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
|
502 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
|
503 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
|
504 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
|
505 static Lisp_Object font_prop_validate_spacing P_ ((Lisp_Object, Lisp_Object)); |
94926 | 506 static int get_font_prop_index P_ ((Lisp_Object)); |
90400 | 507 |
508 static Lisp_Object | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
509 font_prop_validate_symbol (prop, val) |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
510 Lisp_Object prop, val; |
90400 | 511 { |
512 if (STRINGP (val)) | |
94926 | 513 val = Fintern (val, Qnil); |
514 if (! SYMBOLP (val)) | |
515 val = Qerror; | |
516 else if (EQ (prop, QCregistry)) | |
517 val = Fintern (Fdowncase (SYMBOL_NAME (val)), Qnil); | |
518 return val; | |
519 } | |
520 | |
521 | |
522 static Lisp_Object | |
523 font_prop_validate_style (style, val) | |
524 Lisp_Object style, val; | |
525 { | |
526 enum font_property_index prop = (EQ (style, QCweight) ? FONT_WEIGHT_INDEX | |
527 : EQ (style, QCslant) ? FONT_SLANT_INDEX | |
528 : FONT_WIDTH_INDEX); | |
529 int n; | |
530 if (INTEGERP (val)) | |
531 { | |
532 n = XINT (val); | |
95194
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
533 if (((n >> 4) & 0xF) |
94926 | 534 >= ASIZE (AREF (font_style_table, prop - FONT_WEIGHT_INDEX))) |
535 val = Qerror; | |
536 else | |
537 { | |
95194
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
538 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
|
539 |
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
540 if ((n & 0xF) + 1 >= ASIZE (elt)) |
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
541 val = Qerror; |
6be267398fe5
(font_prop_validate_style): Adjusted for the format
Kenichi Handa <handa@m17n.org>
parents:
95177
diff
changeset
|
542 else if (XINT (AREF (elt, 0)) != (n >> 8)) |
94926 | 543 val = Qerror; |
544 } | |
545 } | |
90400 | 546 else if (SYMBOLP (val)) |
547 { | |
94926 | 548 int n = font_style_to_value (prop, val, 0); |
549 | |
550 val = n >= 0 ? make_number (n) : Qerror; | |
90400 | 551 } |
552 else | |
553 val = Qerror; | |
554 return val; | |
555 } | |
556 | |
557 static Lisp_Object | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
558 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
|
559 Lisp_Object prop, val; |
90400 | 560 { |
561 return (NATNUMP (val) || (FLOATP (val) && XFLOAT_DATA (val) >= 0) | |
562 ? val : Qerror); | |
563 } | |
564 | |
565 static Lisp_Object | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
566 font_prop_validate_spacing (prop, val) |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
567 Lisp_Object prop, val; |
90400 | 568 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
569 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
|
570 return val; |
95504
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
571 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
|
572 { |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
573 char spacing = SDATA (SYMBOL_NAME (val))[0]; |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
574 |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
575 if (spacing == 'c' || spacing == 'C') |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
576 return make_number (FONT_SPACING_CHARCELL); |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
577 if (spacing == 'm' || spacing == 'M') |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
578 return make_number (FONT_SPACING_MONO); |
95523
3c4256715c94
(font_prop_validate_spacing): Fix last change.
Andreas Schwab <schwab@suse.de>
parents:
95516
diff
changeset
|
579 if (spacing == 'p' || spacing == 'P') |
95504
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
580 return make_number (FONT_SPACING_PROPORTIONAL); |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
581 if (spacing == 'd' || spacing == 'D') |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
582 return make_number (FONT_SPACING_DUAL); |
00bdff60fc10
(font_prop_validate_spacing): Handle uppercase symbols.
Kenichi Handa <handa@m17n.org>
parents:
95483
diff
changeset
|
583 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
584 return Qerror; |
90400 | 585 } |
586 | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
587 static Lisp_Object |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
588 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
|
589 Lisp_Object prop, val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
590 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
591 Lisp_Object tail, tmp; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
592 int i; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
593 |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
594 /* 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
|
595 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
|
596 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
|
597 if (! CONSP (val)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
598 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
599 if (! SYMBOLP (XCAR (val))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
600 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
601 tail = XCDR (val); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
602 if (NILP (tail)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
603 return val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
604 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
|
605 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
606 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
|
607 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
608 tail = XCDR (tail); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
609 if (NILP (tail)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
610 return val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
611 if (! CONSP (tail)) |
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 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
|
614 if (! SYMBOLP (XCAR (tmp))) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
615 return Qerror; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
616 if (! NILP (tmp)) |
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 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
619 return val; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
620 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
621 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
622 /* 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
|
623 values. */ |
90400 | 624 struct |
625 { | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
626 /* Pointer to the key symbol. */ |
90400 | 627 Lisp_Object *key; |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
628 /* 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
|
629 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
|
630 and Qerror if not. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
631 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
|
632 } font_property_table[] = |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
633 { { &QCtype, font_prop_validate_symbol }, |
90400 | 634 { &QCfoundry, font_prop_validate_symbol }, |
635 { &QCfamily, font_prop_validate_symbol }, | |
636 { &QCadstyle, font_prop_validate_symbol }, | |
637 { &QCregistry, font_prop_validate_symbol }, | |
638 { &QCweight, font_prop_validate_style }, | |
639 { &QCslant, font_prop_validate_style }, | |
640 { &QCwidth, font_prop_validate_style }, | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
641 { &QCsize, font_prop_validate_non_neg }, |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
642 { &QCdpi, font_prop_validate_non_neg }, |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
643 { &QCspacing, font_prop_validate_spacing }, |
94926 | 644 { &QCavgwidth, font_prop_validate_non_neg }, |
645 /* The order of the above entries must match with enum | |
646 font_property_index. */ | |
647 { &QClang, font_prop_validate_symbol }, | |
648 { &QCscript, font_prop_validate_symbol }, | |
649 { &QCotf, font_prop_validate_otf } | |
90400 | 650 }; |
651 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
652 /* 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
|
653 #define FONT_PROPERTY_TABLE_SIZE \ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
654 ((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
|
655 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
656 /* Return an index number of font property KEY or -1 if KEY is not an |
94926 | 657 already known property. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
658 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
659 static int |
94926 | 660 get_font_prop_index (key) |
90400 | 661 Lisp_Object key; |
662 { | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
663 int i; |
94926 | 664 |
665 for (i = 0; i < FONT_PROPERTY_TABLE_SIZE; i++) | |
666 if (EQ (key, *font_property_table[i].key)) | |
667 return i; | |
668 return -1; | |
669 } | |
670 | |
671 /* Validate the font property. The property key is specified by the | |
672 symbol PROP, or the index IDX (if PROP is nil). If VAL is invalid, | |
673 signal an error. The value is VAL or the regularized one. */ | |
674 | |
675 static Lisp_Object | |
676 font_prop_validate (idx, prop, val) | |
677 int idx; | |
678 Lisp_Object prop, val; | |
679 { | |
680 Lisp_Object validated; | |
681 | |
94964
5ffc88767cc1
(font_prop_validate): Make nil a valid value.
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
682 if (NILP (val)) |
5ffc88767cc1
(font_prop_validate): Make nil a valid value.
Kenichi Handa <handa@m17n.org>
parents:
94963
diff
changeset
|
683 return val; |
94926 | 684 if (NILP (prop)) |
685 prop = *font_property_table[idx].key; | |
686 else | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
687 { |
94926 | 688 idx = get_font_prop_index (prop); |
689 if (idx < 0) | |
690 return val; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
691 } |
94926 | 692 validated = (font_property_table[idx].validater) (prop, val); |
693 if (EQ (validated, Qerror)) | |
694 signal_error ("invalid font property", Fcons (prop, val)); | |
695 return validated; | |
90400 | 696 } |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
697 |
94926 | 698 |
699 /* Store VAL as a value of extra font property PROP in FONT while | |
700 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
|
701 |
90888
5f03b3602143
(font_put_extra): Expose externally.
Jason Rumney <jasonr@gnu.org>
parents:
90883
diff
changeset
|
702 Lisp_Object |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
703 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
|
704 Lisp_Object font, prop, val; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
705 { |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
706 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
|
707 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
|
708 |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
709 if (NILP (slot)) |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
710 { |
94926 | 711 Lisp_Object prev = Qnil; |
712 | |
713 while (CONSP (extra) | |
714 && NILP (Fstring_lessp (prop, XCAR (XCAR (extra))))) | |
715 prev = extra, extra = XCDR (extra); | |
716 if (NILP (prev)) | |
717 ASET (font, FONT_EXTRA_INDEX, Fcons (Fcons (prop, val), extra)); | |
718 else | |
719 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
|
720 return val; |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
721 } |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
722 XSETCDR (slot, val); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
723 return val; |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
724 } |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
725 |
90400 | 726 |
727 /* Font name parser and unparser */ | |
728 | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
729 static int parse_matrix P_ ((char *)); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
730 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
|
731 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
|
732 |
90400 | 733 /* An enumerator for each field of an XLFD font name. */ |
734 enum xlfd_field_index | |
735 { | |
736 XLFD_FOUNDRY_INDEX, | |
737 XLFD_FAMILY_INDEX, | |
738 XLFD_WEIGHT_INDEX, | |
739 XLFD_SLANT_INDEX, | |
740 XLFD_SWIDTH_INDEX, | |
741 XLFD_ADSTYLE_INDEX, | |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
742 XLFD_PIXEL_INDEX, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
743 XLFD_POINT_INDEX, |
90400 | 744 XLFD_RESX_INDEX, |
745 XLFD_RESY_INDEX, | |
746 XLFD_SPACING_INDEX, | |
747 XLFD_AVGWIDTH_INDEX, | |
748 XLFD_REGISTRY_INDEX, | |
749 XLFD_ENCODING_INDEX, | |
750 XLFD_LAST_INDEX | |
751 }; | |
752 | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
753 /* 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
|
754 enum xlfd_field_mask |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
755 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
756 XLFD_FOUNDRY_MASK = 0x0001, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
757 XLFD_FAMILY_MASK = 0x0002, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
758 XLFD_WEIGHT_MASK = 0x0004, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
759 XLFD_SLANT_MASK = 0x0008, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
760 XLFD_SWIDTH_MASK = 0x0010, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
761 XLFD_ADSTYLE_MASK = 0x0020, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
762 XLFD_PIXEL_MASK = 0x0040, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
763 XLFD_POINT_MASK = 0x0080, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
764 XLFD_RESX_MASK = 0x0100, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
765 XLFD_RESY_MASK = 0x0200, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
766 XLFD_SPACING_MASK = 0x0400, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
767 XLFD_AVGWIDTH_MASK = 0x0800, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
768 XLFD_REGISTRY_MASK = 0x1000, |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
769 XLFD_ENCODING_MASK = 0x2000 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
770 }; |
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 |
90400 | 773 /* Parse P pointing the pixel/point size field of the form |
774 `[A B C D]' which specifies a transformation matrix: | |
775 | |
776 A B 0 | |
777 C D 0 | |
778 0 0 1 | |
779 | |
780 by which all glyphs of the font are transformed. The spec says | |
781 that scalar value N for the pixel/point size is equivalent to: | |
782 A = N * resx/resy, B = C = 0, D = N. | |
783 | |
784 Return the scalar value N if the form is valid. Otherwise return | |
785 -1. */ | |
786 | |
787 static int | |
788 parse_matrix (p) | |
789 char *p; | |
790 { | |
791 double matrix[4]; | |
792 char *end; | |
793 int i; | |
794 | |
795 for (i = 0, p++; i < 4 && *p && *p != ']'; i++) | |
796 { | |
797 if (*p == '~') | |
798 matrix[i] = - strtod (p + 1, &end); | |
799 else | |
800 matrix[i] = strtod (p, &end); | |
801 p = end; | |
802 } | |
803 return (i == 4 ? (int) matrix[3] : -1); | |
804 } | |
805 | |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
806 /* 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
|
807 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
|
808 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
|
809 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
810 static int |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
811 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
|
812 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
|
813 int n; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
814 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
815 /* Copy of FIELD. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
816 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
|
817 /* 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
|
818 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
|
819 struct { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
820 /* Minimum possible field. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
821 int from; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
822 /* Maxinum possible field. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
823 int to; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
824 /* 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
|
825 int mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
826 } range[XLFD_LAST_INDEX]; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
827 int i, j; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
828 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
|
829 unsigned range_mask; |
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 #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
|
832 | 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
|
833 #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
|
834 #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
|
835 | XLFD_AVGWIDTH_MASK) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
836 #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
|
837 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
838 /* 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
|
839 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
|
840 following loop. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
841 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
|
842 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
|
843 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
844 /* 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
|
845 position-based retriction for FIELD[I]. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
846 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
|
847 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
|
848 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
849 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
|
850 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
851 tmp[i] = val; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
852 if (NILP (val)) |
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 /* Wildcard. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
855 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
|
856 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
|
857 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
|
858 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
859 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
860 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
861 /* 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
|
862 retriction for FIELD[I]. */ |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
863 int from, to; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
864 unsigned mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
865 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
866 if (INTEGERP (val)) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
867 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
868 int numeric = XINT (val); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
869 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
870 if (i + 1 == n) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
871 from = to = XLFD_ENCODING_INDEX, |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
872 mask = XLFD_ENCODING_MASK; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
873 else if (numeric == 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
874 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
|
875 mask = XLFD_PIXEL_MASK | XLFD_LARGENUM_MASK; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
876 else if (numeric <= 48) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
877 from = to = XLFD_PIXEL_INDEX, |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
878 mask = XLFD_PIXEL_MASK; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
879 else |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
880 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
|
881 mask = XLFD_LARGENUM_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
882 } |
94926 | 883 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
|
884 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
|
885 mask = XLFD_NULL_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
886 else if (i == 0) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
887 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
|
888 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
|
889 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
890 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
|
891 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
892 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
|
893 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
|
894 mask = XLFD_REGENC_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
895 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
896 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
|
897 mask = XLFD_ENCODING_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
898 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
899 else if (range_from <= XLFD_WEIGHT_INDEX |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
900 && range_to >= XLFD_WEIGHT_INDEX |
94926 | 901 && 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
|
902 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
|
903 else if (range_from <= XLFD_SLANT_INDEX |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
904 && range_to >= XLFD_SLANT_INDEX |
94926 | 905 && 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
|
906 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
|
907 else if (range_from <= XLFD_SWIDTH_INDEX |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
908 && range_to >= XLFD_SWIDTH_INDEX |
94926 | 909 && 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
|
910 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
|
911 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
912 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
913 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
|
914 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
|
915 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
916 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
|
917 mask = XLFD_SYMBOL_MASK; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
918 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
919 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
920 /* 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
|
921 mask &= range_mask; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
922 while (from < range_from) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
923 mask &= ~(1 << from++); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
924 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
|
925 from++; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
926 while (to > range_to) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
927 mask &= ~(1 << to--); |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
928 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
|
929 to--; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
930 if (from > to) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
931 return -1; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
932 range[i].from = from; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
933 range[i].to = to; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
934 range[i].mask = mask; |
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 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
|
937 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
938 /* 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
|
939 Reflect it to the other fields. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
940 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
941 /* Following fields should be after FROM. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
942 range_from = from; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
943 /* Preceding fields should be before TO. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
944 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
|
945 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
946 /* Check FROM for non-wildcard field. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
947 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
|
948 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
949 while (range[j].from < from) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
950 range[j].mask &= ~(1 << range[j].from++); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
951 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
|
952 from++; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
953 range[j].from = from; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
954 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
955 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
956 from = range[j].from; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
957 if (range[j].to > to) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
958 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
959 while (range[j].to > to) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
960 range[j].mask &= ~(1 << range[j].to--); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
961 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
|
962 to--; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
963 range[j].to = to; |
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 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
966 to = range[j].to; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
967 if (from > to) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
968 return -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
969 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
970 } |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
971 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
972 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
973 |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
974 /* 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
|
975 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
|
976 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
977 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
|
978 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
979 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
|
980 /* 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
|
981 return -1; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
982 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
|
983 field[j] = Qnil; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
984 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
985 field[j++] = tmp[i]; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
986 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
987 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
|
988 return -1; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
989 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
|
990 field[j] = Qnil; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
991 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
|
992 field[XLFD_ENCODING_INDEX] |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
993 = 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
|
994 return 0; |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
995 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
996 |
92113
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
997 |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
998 #ifdef ENABLE_CHECKING |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
999 /* 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
|
1000 static int |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1001 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
|
1002 { |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1003 while (*pattern && *name) |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1004 { |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1005 if (*pattern == *name) |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1006 pattern++; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1007 else if (*pattern == '*') |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1008 if (*name == pattern[1]) |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1009 pattern += 2; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1010 else |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1011 ; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1012 else |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1013 return 0; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1014 name++; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1015 } |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1016 return 1; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1017 } |
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 /* 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
|
1020 static int |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1021 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
|
1022 { |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1023 char name_check[256]; |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1024 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
|
1025 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
|
1026 } |
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 #endif |
2a9ed1c080b4
(font_match_xlfd, font_check_xlfd_parse): New funs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91943
diff
changeset
|
1029 |
94926 | 1030 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1031 /* 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
|
1032 (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
|
1033 follows: |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1034 specified XLFD fields FONT property |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1035 --------------------- ------------- |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1036 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
|
1037 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
|
1038 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
|
1039 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1040 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
|
1041 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1042 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
|
1043 X font backend driver, it is a font-entity. In that case, NAME is |
94926 | 1044 a fully specified XLFD. */ |
90400 | 1045 |
1046 int | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1047 font_parse_xlfd (name, font) |
90400 | 1048 char *name; |
1049 Lisp_Object font; | |
1050 { | |
1051 int len = strlen (name); | |
94926 | 1052 int i, j, n; |
90695
a1cd7344d6a2
(font_parse_xlfd): Fix the array size of `f'.
Kenichi Handa <handa@m17n.org>
parents:
90677
diff
changeset
|
1053 char *f[XLFD_LAST_INDEX + 1]; |
90400 | 1054 Lisp_Object val; |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1055 char *p; |
90400 | 1056 |
1057 if (len > 255) | |
1058 /* Maximum XLFD name length is 255. */ | |
1059 return -1; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1060 /* Accept "*-.." as a fully specified XLFD. */ |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1061 if (name[0] == '*' && name[1] == '-') |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1062 i = 1, f[XLFD_FOUNDRY_INDEX] = name; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1063 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1064 i = 0; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1065 for (p = name + i; *p; p++) |
94926 | 1066 if (*p == '-') |
1067 { | |
1068 f[i++] = p + 1; | |
1069 if (i == XLFD_LAST_INDEX) | |
1070 break; | |
1071 } | |
1072 f[i] = name + len; | |
1073 | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1074 #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
|
1075 #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
|
1076 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1077 if (i == XLFD_LAST_INDEX) |
90400 | 1078 { |
94926 | 1079 /* Fully specified XLFD. */ |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1080 int pixel_size; |
94926 | 1081 |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1082 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
|
1083 ASET (font, FONT_FAMILY_INDEX, INTERN_FIELD_SYM (XLFD_FAMILY_INDEX)); |
94926 | 1084 for (i = XLFD_WEIGHT_INDEX, j = FONT_WEIGHT_INDEX; |
1085 i <= XLFD_SWIDTH_INDEX; i++, j++) | |
90400 | 1086 { |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1087 val = INTERN_FIELD_SYM (i); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1088 if (! NILP (val)) |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1089 { |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1090 if ((n = font_style_to_value (j, INTERN_FIELD_SYM (i), 0)) < 0) |
94926 | 1091 return -1; |
1092 ASET (font, j, make_number (n)); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1093 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1094 } |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1095 ASET (font, FONT_ADSTYLE_INDEX, INTERN_FIELD_SYM (XLFD_ADSTYLE_INDEX)); |
94926 | 1096 if (strcmp (f[XLFD_REGISTRY_INDEX], "*-*") == 0) |
1097 ASET (font, FONT_REGISTRY_INDEX, Qnil); | |
1098 else | |
1099 ASET (font, FONT_REGISTRY_INDEX, | |
1100 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
|
1101 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
|
1102 1)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1103 p = f[XLFD_PIXEL_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1104 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
|
1105 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
|
1106 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1107 { |
94926 | 1108 val = INTERN_FIELD (XLFD_PIXEL_INDEX); |
1109 if (INTEGERP (val)) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1110 ASET (font, FONT_SIZE_INDEX, val); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1111 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1112 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1113 double point_size = -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1114 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1115 font_assert (FONT_SPEC_P (font)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1116 p = f[XLFD_POINT_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1117 if (*p == '[') |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1118 point_size = parse_matrix (p); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1119 else if (isdigit (*p)) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1120 point_size = atoi (p), point_size /= 10; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1121 if (point_size >= 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1122 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
|
1123 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1124 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1125 |
94926 | 1126 ASET (font, FONT_DPI_INDEX, INTERN_FIELD (XLFD_RESY_INDEX)); |
1127 val = INTERN_FIELD (XLFD_SPACING_INDEX); | |
1128 if (! NILP (val)) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1129 { |
94926 | 1130 val = font_prop_validate_spacing (QCspacing, val); |
1131 if (! INTEGERP (val)) | |
1132 return -1; | |
1133 ASET (font, FONT_SPACING_INDEX, val); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1134 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1135 p = f[XLFD_AVGWIDTH_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1136 if (*p == '~') |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1137 p++; |
94926 | 1138 ASET (font, FONT_AVGWIDTH_INDEX, |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1139 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
|
1140 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1141 else |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1142 { |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1143 int wild_card_found = 0; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1144 Lisp_Object prop[XLFD_LAST_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1145 |
94926 | 1146 if (FONT_ENTITY_P (font)) |
1147 return -1; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1148 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
|
1149 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1150 if (*f[j] == '*') |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1151 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1152 if (f[j][1] && f[j][1] != '-') |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1153 return -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1154 prop[j] = Qnil; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1155 wild_card_found = 1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1156 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1157 else if (j + 1 < i) |
94926 | 1158 prop[j] = INTERN_FIELD (j); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1159 else |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1160 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
|
1161 } |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1162 if (! wild_card_found) |
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
1163 return -1; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1164 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
|
1165 return -1; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1166 |
94926 | 1167 ASET (font, FONT_FOUNDRY_INDEX, prop[XLFD_FOUNDRY_INDEX]); |
1168 ASET (font, FONT_FAMILY_INDEX, prop[XLFD_FAMILY_INDEX]); | |
1169 for (i = XLFD_WEIGHT_INDEX, j = FONT_WEIGHT_INDEX; | |
1170 i <= XLFD_SWIDTH_INDEX; i++, j++) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1171 if (! NILP (prop[i])) |
94926 | 1172 { |
1173 if ((n = font_style_to_value (j, prop[i], 1)) < 0) | |
1174 return -1; | |
1175 ASET (font, j, make_number (n)); | |
1176 } | |
1177 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
|
1178 val = prop[XLFD_REGISTRY_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1179 if (NILP (val)) |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1180 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1181 val = prop[XLFD_ENCODING_INDEX]; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1182 if (! NILP (val)) |
94926 | 1183 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
|
1184 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1185 else if (NILP (prop[XLFD_ENCODING_INDEX])) |
94926 | 1186 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
|
1187 else |
94926 | 1188 val = concat3 (SYMBOL_NAME (val), build_string ("-"), |
1189 SYMBOL_NAME (prop[XLFD_ENCODING_INDEX])); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1190 if (! NILP (val)) |
94926 | 1191 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
|
1192 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1193 if (INTEGERP (prop[XLFD_PIXEL_INDEX])) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1194 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
|
1195 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
|
1196 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1197 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
|
1198 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1199 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
|
1200 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1201 |
94926 | 1202 if (INTEGERP (prop[XLFD_RESX_INDEX])) |
1203 ASET (font, FONT_DPI_INDEX, prop[XLFD_RESY_INDEX]); | |
1204 if (! NILP (prop[XLFD_SPACING_INDEX])) | |
1205 { | |
1206 val = font_prop_validate_spacing (QCspacing, | |
1207 prop[XLFD_SPACING_INDEX]); | |
1208 if (! INTEGERP (val)) | |
1209 return -1; | |
1210 ASET (font, FONT_SPACING_INDEX, val); | |
1211 } | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1212 if (INTEGERP (prop[XLFD_AVGWIDTH_INDEX])) |
94926 | 1213 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
|
1214 } |
90400 | 1215 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1216 return 0; |
90400 | 1217 } |
1218 | |
1219 /* Store XLFD name of FONT (font-spec or font-entity) in NAME (NBYTES | |
1220 length), and return the name length. If FONT_SIZE_INDEX of FONT is | |
1221 0, use PIXEL_SIZE instead. */ | |
1222 | |
1223 int | |
1224 font_unparse_xlfd (font, pixel_size, name, nbytes) | |
1225 Lisp_Object font; | |
90439
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1226 int pixel_size; |
90400 | 1227 char *name; |
1228 int nbytes; | |
1229 { | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1230 char *f[XLFD_REGISTRY_INDEX + 1]; |
90400 | 1231 Lisp_Object val; |
1232 int i, j, len = 0; | |
1233 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1234 font_assert (FONTP (font)); |
90400 | 1235 |
1236 for (i = FONT_FOUNDRY_INDEX, j = XLFD_FOUNDRY_INDEX; i <= FONT_REGISTRY_INDEX; | |
1237 i++, j++) | |
1238 { | |
1239 if (i == FONT_ADSTYLE_INDEX) | |
1240 j = XLFD_ADSTYLE_INDEX; | |
1241 else if (i == FONT_REGISTRY_INDEX) | |
1242 j = XLFD_REGISTRY_INDEX; | |
1243 val = AREF (font, i); | |
1244 if (NILP (val)) | |
90439
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1245 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1246 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
|
1247 f[j] = "*-*", len += 4; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1248 else |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1249 f[j] = "*", len += 2; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1250 } |
90400 | 1251 else |
1252 { | |
1253 if (SYMBOLP (val)) | |
1254 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
|
1255 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
|
1256 && ! strchr ((char *) SDATA (val), '-')) |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1257 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1258 /* 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
|
1259 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
|
1260 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1261 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
|
1262 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
|
1263 len += SBYTES (val) + 3; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1264 } |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1265 else |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1266 { |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1267 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
|
1268 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
|
1269 len += SBYTES (val) + 4; |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1270 } |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1271 } |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1272 else |
fb253905e9c3
* font.c (Qiso8859_1, Qiso10646_1, Qunicode_bmp): Moved from
Kenichi Handa <handa@m17n.org>
parents:
90427
diff
changeset
|
1273 f[j] = (char *) SDATA (val), len += SBYTES (val) + 1; |
90400 | 1274 } |
1275 } | |
1276 | |
1277 for (i = FONT_WEIGHT_INDEX, j = XLFD_WEIGHT_INDEX; i <= FONT_WIDTH_INDEX; | |
1278 i++, j++) | |
1279 { | |
94926 | 1280 val = font_style_symbolic (font, i, 0); |
90400 | 1281 if (NILP (val)) |
1282 f[j] = "*", len += 2; | |
1283 else | |
1284 { | |
94926 | 1285 val = SYMBOL_NAME (val); |
90400 | 1286 f[j] = (char *) SDATA (val), len += SBYTES (val) + 1; |
1287 } | |
1288 } | |
1289 | |
1290 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
|
1291 font_assert (NUMBERP (val) || NILP (val)); |
90400 | 1292 if (INTEGERP (val)) |
1293 { | |
94926 | 1294 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
|
1295 if (i <= 0) |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1296 i = pixel_size; |
90400 | 1297 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
|
1298 { |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1299 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
|
1300 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
|
1301 } |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1302 else |
c5e5ad126614
(font_unparse_xlfd): Don't ignore integer pixel size specs.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91909
diff
changeset
|
1303 f[XLFD_PIXEL_INDEX] = "*-*", len += 4; |
90400 | 1304 } |
1305 else if (FLOATP (val)) | |
1306 { | |
94926 | 1307 i = XFLOAT_DATA (val) * 10; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1308 f[XLFD_PIXEL_INDEX] = alloca (12); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1309 len += sprintf (f[XLFD_PIXEL_INDEX], "*-%d", i) + 1; |
90400 | 1310 } |
1311 else | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1312 f[XLFD_PIXEL_INDEX] = "*-*", len += 4; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1313 |
94926 | 1314 if (INTEGERP (AREF (font, FONT_DPI_INDEX))) |
90400 | 1315 { |
94926 | 1316 i = XINT (AREF (font, FONT_DPI_INDEX)); |
1317 f[XLFD_RESX_INDEX] = alloca (22); | |
1318 len += sprintf (f[XLFD_RESX_INDEX], | |
1319 "%d-%d", i, i) + 1; | |
90400 | 1320 } |
1321 else | |
94926 | 1322 f[XLFD_RESX_INDEX] = "*-*", len += 4; |
1323 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
|
1324 { |
94926 | 1325 int spacing = XINT (AREF (font, FONT_SPACING_INDEX)); |
1326 | |
1327 f[XLFD_SPACING_INDEX] = (spacing <= FONT_SPACING_PROPORTIONAL ? "p" | |
1328 : spacing <= FONT_SPACING_DUAL ? "d" | |
1329 : spacing <= FONT_SPACING_MONO ? "m" | |
1330 : "c"); | |
1331 len += 2; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1332 } |
94926 | 1333 else |
1334 f[XLFD_SPACING_INDEX] = "*", len += 2; | |
1335 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) | |
1336 { | |
1337 f[XLFD_AVGWIDTH_INDEX] = alloca (11); | |
1338 len += sprintf (f[XLFD_AVGWIDTH_INDEX], | |
1339 "%d", XINT (AREF (font, FONT_AVGWIDTH_INDEX))) + 1; | |
1340 } | |
1341 else | |
1342 f[XLFD_AVGWIDTH_INDEX] = "*", len += 2; | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1343 len++; /* for terminating '\0'. */ |
90400 | 1344 if (len >= nbytes) |
1345 return -1; | |
94926 | 1346 return sprintf (name, "-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s-%s", |
90400 | 1347 f[XLFD_FOUNDRY_INDEX], f[XLFD_FAMILY_INDEX], |
1348 f[XLFD_WEIGHT_INDEX], f[XLFD_SLANT_INDEX], | |
94926 | 1349 f[XLFD_SWIDTH_INDEX], f[XLFD_ADSTYLE_INDEX], |
1350 f[XLFD_PIXEL_INDEX], f[XLFD_RESX_INDEX], | |
1351 f[XLFD_SPACING_INDEX], f[XLFD_AVGWIDTH_INDEX], | |
1352 f[XLFD_REGISTRY_INDEX]); | |
90400 | 1353 } |
1354 | |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1355 /* 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
|
1356 (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
|
1357 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
|
1358 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
|
1359 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1360 The fontconfig format is |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1361 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1362 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
|
1363 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1364 The GTK format is |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1365 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1366 FAMILY [PROPS...] [SIZE] |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1367 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1368 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
|
1369 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1370 int |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1371 font_parse_fcname (name, font) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1372 char *name; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1373 Lisp_Object font; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1374 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1375 char *p, *q; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1376 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
|
1377 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
|
1378 int len = strlen (name); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1379 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1380 if (len == 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1381 return -1; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1382 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1383 for (p = name; *p; p++) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1384 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1385 if (*p == '\\' && p[1]) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1386 p++; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1387 else if (*p == ':') |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1388 { |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1389 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
|
1390 break; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1391 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1392 else if (*p == '-') |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1393 { |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1394 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
|
1395 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
|
1396 if (! isdigit(*q)) |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1397 { |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1398 if (*q != '.' || decimal) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1399 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1400 size_found = 0; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1401 break; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1402 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1403 decimal = 1; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1404 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1405 if (size_found) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1406 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1407 family_end = p; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1408 size_beg = p + 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1409 size_end = q; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1410 break; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1411 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1412 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1413 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1414 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1415 if (family_end) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1416 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1417 /* 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
|
1418 if (family_end > name) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1419 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1420 Lisp_Object family; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1421 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
|
1422 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
|
1423 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1424 if (size_beg) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1425 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1426 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
|
1427 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
|
1428 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
|
1429 props_beg = size_end; |
95790
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 (props_beg) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1432 { |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1433 /* 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
|
1434 Lisp_Object val; |
96016
c1105df0f9c8
(font_parse_fcname): Fix handling of unknown-spec string.
Chong Yidong <cyd@stupidchicken.com>
parents:
96014
diff
changeset
|
1435 |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1436 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
|
1437 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1438 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
|
1439 if (*q != '=') |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1440 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1441 /* 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
|
1442 int word_len; |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1443 p = p + 1; |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1444 word_len = q - p; |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1445 val = font_intern_prop (p, q - p, 1); |
95984 | 1446 |
1447 #define PROP_MATCH(STR,N) ((word_len == N) && memcmp (p, STR, N) == 0) | |
1448 | |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1449 if (PROP_MATCH ("light", 5) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1450 || PROP_MATCH ("medium", 6) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1451 || PROP_MATCH ("demibold", 8) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1452 || PROP_MATCH ("bold", 4) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1453 || PROP_MATCH ("black", 5)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1454 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
|
1455 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
|
1456 || PROP_MATCH ("italic", 6) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1457 || PROP_MATCH ("oblique", 7)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1458 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
|
1459 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
|
1460 ASET (font, FONT_SPACING_INDEX, |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1461 make_number (FONT_SPACING_CHARCELL)); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1462 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
|
1463 ASET (font, FONT_SPACING_INDEX, |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1464 make_number (FONT_SPACING_MONO)); |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1465 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
|
1466 ASET (font, FONT_SPACING_INDEX, |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1467 make_number (FONT_SPACING_PROPORTIONAL)); |
95984 | 1468 #undef PROP_MATCH |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1469 } |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1470 else |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1471 { |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1472 /* KEY=VAL pairs */ |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1473 Lisp_Object key; |
96049
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1474 int prop; |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1475 |
380525b11593
(font_parse_fcname): For known key symbols, intern using correct
Chong Yidong <cyd@stupidchicken.com>
parents:
96030
diff
changeset
|
1476 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
|
1477 prop = FONT_SIZE_INDEX; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1478 else |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1479 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1480 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
|
1481 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
|
1482 } |
96016
c1105df0f9c8
(font_parse_fcname): Fix handling of unknown-spec string.
Chong Yidong <cyd@stupidchicken.com>
parents:
96014
diff
changeset
|
1483 |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1484 p = q + 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1485 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
|
1486 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
|
1487 |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1488 if (prop >= FONT_FOUNDRY_INDEX |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1489 && prop < FONT_EXTRA_INDEX) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1490 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
|
1491 else |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1492 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
|
1493 } |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
1494 p = q; |
95790
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 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1497 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1498 else |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1499 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1500 /* 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
|
1501 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
|
1502 Lisp_Object prop; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1503 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
|
1504 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1505 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
|
1506 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1507 if (isdigit (*p)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1508 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1509 int size_found = 1; |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
1510 |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1511 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
|
1512 if (! isdigit (*q)) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1513 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1514 size_found = 0; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1515 break; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1516 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1517 if (size_found) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1518 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1519 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
|
1520 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
|
1521 continue; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1522 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1523 } |
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 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
|
1526 if (*q == '\\' && q[1]) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1527 q++; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1528 word_len = q - p; |
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 #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
|
1531 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1532 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
|
1533 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1534 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1535 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
|
1536 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
|
1537 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1538 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
|
1539 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1540 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1541 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
|
1542 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
|
1543 } |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1544 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
|
1545 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1546 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1547 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
|
1548 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
|
1549 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1550 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
|
1551 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1552 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1553 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
|
1554 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
|
1555 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1556 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
|
1557 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1558 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1559 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
|
1560 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
|
1561 } |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1562 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
|
1563 { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1564 prop_found = 1; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1565 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
|
1566 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
|
1567 } |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1568 else { |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1569 if (prop_found) |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1570 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
|
1571 family_end = q; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1572 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1573 } |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1574 #undef PROP_MATCH |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1575 |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1576 if (family_end) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1577 { |
95790
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1578 Lisp_Object family; |
a486132d892c
(font_parse_fcname): Accept GTK-style font names too.
Chong Yidong <cyd@stupidchicken.com>
parents:
95746
diff
changeset
|
1579 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
|
1580 ASET (font, FONT_FAMILY_INDEX, family); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1581 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1582 } |
95886
c8bc52f94b6d
(syms_of_font) <font-weight-table, font-slant-table, font-width-table>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95875
diff
changeset
|
1583 |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
1584 return 0; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1585 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1586 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1587 /* 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
|
1588 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
|
1589 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
|
1590 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1591 int |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1592 font_unparse_fcname (font, pixel_size, name, nbytes) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1593 Lisp_Object font; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1594 int pixel_size; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1595 char *name; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1596 int nbytes; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1597 { |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1598 Lisp_Object family, foundry; |
94926 | 1599 Lisp_Object tail, val; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1600 int point_size; |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1601 int dpi; |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1602 int i, len = 1; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1603 char *p; |
90476
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1604 Lisp_Object styles[3]; |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
1605 char *style_names[3] = { "weight", "slant", "width" }; |
94926 | 1606 char work[256]; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1607 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1608 family = AREF (font, FONT_FAMILY_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1609 if (! NILP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1610 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1611 if (SYMBOLP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1612 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1613 family = SYMBOL_NAME (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1614 len += SBYTES (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1615 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1616 else |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1617 family = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1618 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1619 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1620 val = AREF (font, FONT_SIZE_INDEX); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1621 if (INTEGERP (val)) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1622 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1623 if (XINT (val) != 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1624 pixel_size = XINT (val); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1625 point_size = -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1626 len += 21; /* for ":pixelsize=NUM" */ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1627 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1628 else if (FLOATP (val)) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1629 { |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1630 pixel_size = -1; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1631 point_size = (int) XFLOAT_DATA (val); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1632 len += 11; /* for "-NUM" */ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1633 } |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1634 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1635 foundry = AREF (font, FONT_FOUNDRY_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1636 if (! NILP (foundry)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1637 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1638 if (SYMBOLP (foundry)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1639 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1640 foundry = SYMBOL_NAME (foundry); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1641 len += 9 + SBYTES (foundry); /* ":foundry=NAME" */ |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1642 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1643 else |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1644 foundry = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1645 } |
94926 | 1646 |
1647 for (i = 0; i < 3; i++) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1648 { |
94926 | 1649 styles[i] = font_style_symbolic (font, FONT_WEIGHT_INDEX + i, 0); |
1650 if (! NILP (styles[i])) | |
1651 len += sprintf (work, ":%s=%s", style_names[i], | |
1652 SDATA (SYMBOL_NAME (styles[i]))); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1653 } |
94926 | 1654 |
1655 if (INTEGERP (AREF (font, FONT_DPI_INDEX))) | |
1656 len += sprintf (work, ":dpi=%d", dpi); | |
1657 if (INTEGERP (AREF (font, FONT_SPACING_INDEX))) | |
1658 len += strlen (":spacing=100"); | |
1659 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) | |
1660 len += strlen (":scalable=false"); /* or ":scalable=true" */ | |
1661 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
|
1662 { |
94926 | 1663 Lisp_Object key = XCAR (XCAR (tail)), val = XCDR (XCAR (tail)); |
1664 | |
1665 len += SBYTES (SYMBOL_NAME (key)) + 1; /* for :KEY= */ | |
1666 if (STRINGP (val)) | |
1667 len += SBYTES (val); | |
1668 else if (INTEGERP (val)) | |
1669 len += sprintf (work, "%d", XINT (val)); | |
1670 else if (SYMBOLP (val)) | |
1671 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
|
1672 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1673 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1674 if (len > nbytes) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1675 return -1; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1676 p = name; |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1677 if (! NILP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1678 p += sprintf (p, "%s", SDATA (family)); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1679 if (point_size > 0) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1680 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1681 if (p == name) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1682 p += sprintf (p, "%d", point_size); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1683 else |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1684 p += sprintf (p, "-%d", point_size); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1685 } |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1686 else if (pixel_size > 0) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1687 p += sprintf (p, ":pixelsize=%d", pixel_size); |
94926 | 1688 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
|
1689 p += sprintf (p, ":foundry=%s", |
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1690 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
|
1691 for (i = 0; i < 3; i++) |
94926 | 1692 if (! NILP (styles[i])) |
90476
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
1693 p += sprintf (p, ":%s=%s", style_names[i], |
94926 | 1694 SDATA (SYMBOL_NAME (styles[i]))); |
1695 if (INTEGERP (AREF (font, FONT_DPI_INDEX))) | |
1696 p += sprintf (p, ":dpi=%d", XINT (AREF (font, FONT_DPI_INDEX))); | |
1697 if (INTEGERP (AREF (font, FONT_SPACING_INDEX))) | |
1698 p += sprintf (p, ":spacing=%d", XINT (AREF (font, FONT_SPACING_INDEX))); | |
1699 if (INTEGERP (AREF (font, FONT_AVGWIDTH_INDEX))) | |
1700 { | |
1701 if (XINT (AREF (font, FONT_AVGWIDTH_INDEX)) == 0) | |
1702 p += sprintf (p, ":scalable=true"); | |
1703 else | |
1704 p += sprintf (p, ":scalable=false"); | |
1705 } | |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1706 return (p - name); |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1707 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1708 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1709 /* 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
|
1710 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
|
1711 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
|
1712 size. */ |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1713 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1714 int |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1715 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
|
1716 Lisp_Object font; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1717 struct frame *f; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1718 char *name; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1719 int nbytes; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1720 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1721 char *p; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1722 int len = 1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1723 Lisp_Object family, weight, slant, size; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1724 int point_size = -1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1725 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1726 family = AREF (font, FONT_FAMILY_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1727 if (! NILP (family)) |
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 if (! SYMBOLP (family)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1730 return -1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1731 family = SYMBOL_NAME (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1732 len += SBYTES (family); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1733 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1734 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1735 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
|
1736 if (EQ (weight, Qnormal)) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1737 weight = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1738 else if (! NILP (weight)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1739 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1740 weight = SYMBOL_NAME (weight); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1741 len += SBYTES (weight); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1742 } |
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 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
|
1745 if (EQ (slant, Qnormal)) |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1746 slant = Qnil; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1747 else if (! NILP (slant)) |
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 slant = SYMBOL_NAME (slant); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1750 len += SBYTES (slant); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1751 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1752 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1753 size = AREF (font, FONT_SIZE_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1754 /* Convert pixel size to point size. */ |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1755 if (INTEGERP (size)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1756 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1757 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
|
1758 int dpi = 75; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1759 if (INTEGERP (font_dpi)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1760 dpi = XINT (font_dpi); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1761 else if (f) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1762 dpi = f->resy; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1763 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
|
1764 len += 11; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1765 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1766 else if (FLOATP (size)) |
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 point_size = (int) XFLOAT_DATA (size); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1769 len += 11; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1770 } |
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 if (len > nbytes) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1773 return -1; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1774 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1775 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
|
1776 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1777 if (! NILP (weight)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1778 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1779 char *q = p; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1780 p += sprintf (p, " %s", SDATA (weight)); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1781 q[1] = toupper (q[1]); |
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 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1784 if (! NILP (slant)) |
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 char *q = p; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1787 p += sprintf (p, " %s", SDATA (slant)); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1788 q[1] = toupper (q[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 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1791 if (point_size > 0) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1792 p += sprintf (p, " %d", point_size); |
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 return (p - name); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1795 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
1796 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1797 /* 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
|
1798 (font-spec or font-entity). If NAME is successfully parsed, return |
94926 | 1799 0. Otherwise return -1. */ |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1800 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1801 static int |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1802 font_parse_name (name, font) |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1803 char *name; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1804 Lisp_Object font; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1805 { |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1806 if (name[0] == '-' || index (name, '*')) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1807 return font_parse_xlfd (name, font); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
1808 return font_parse_fcname (name, font); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1809 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
1810 |
94926 | 1811 |
1812 /* Merge FAMILY and REGISTRY into FONT_SPEC. FAMILY may have the form | |
1813 "FAMILY-FOUNDRY". REGISTRY may not contain charset-encoding | |
1814 part. */ | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
1815 |
90400 | 1816 void |
94926 | 1817 font_parse_family_registry (family, registry, font_spec) |
1818 Lisp_Object family, registry, font_spec; | |
90400 | 1819 { |
94926 | 1820 int len; |
1821 char *p0, *p1; | |
1822 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1823 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
|
1824 && NILP (AREF (font_spec, FONT_FAMILY_INDEX))) |
90400 | 1825 { |
94926 | 1826 CHECK_STRING (family); |
1827 len = SBYTES (family); | |
1828 p0 = (char *) SDATA (family); | |
1829 p1 = index (p0, '-'); | |
1830 if (p1) | |
90400 | 1831 { |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
1832 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
|
1833 && 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
|
1834 Ffont_put (font_spec, QCfoundry, font_intern_prop (p0, p1 - p0, 1)); |
94926 | 1835 p1++; |
1836 len -= p1 - p0; | |
95746
b490fda95b13
(font_intern_prop): New arg force_symbol.
Kenichi Handa <handa@m17n.org>
parents:
95699
diff
changeset
|
1837 Ffont_put (font_spec, QCfamily, font_intern_prop (p1, len, 1)); |
90400 | 1838 } |
94926 | 1839 else |
1840 ASET (font_spec, FONT_FAMILY_INDEX, Fintern (family, Qnil)); | |
1841 } | |
1842 if (! NILP (registry)) | |
1843 { | |
1844 /* Convert "XXX" and "XXX*" to "XXX*-*". */ | |
1845 CHECK_STRING (registry); | |
1846 len = SBYTES (registry); | |
1847 p0 = (char *) SDATA (registry); | |
1848 p1 = index (p0, '-'); | |
1849 if (! p1) | |
1850 { | |
1851 if (SDATA (registry)[len - 1] == '*') | |
1852 registry = concat2 (registry, build_string ("-*")); | |
1853 else | |
1854 registry = concat2 (registry, build_string ("*-*")); | |
1855 } | |
1856 registry = Fdowncase (registry); | |
1857 ASET (font_spec, FONT_REGISTRY_INDEX, Fintern (registry, Qnil)); | |
90400 | 1858 } |
1859 } | |
1860 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
1861 |
94926 | 1862 /* This part (through the next ^L) is still experimental and not |
1863 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
|
1864 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
1865 /* OTF handler */ |
90541 | 1866 |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
1867 #if 0 |
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
1868 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1869 #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
|
1870 #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
|
1871 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1872 static int |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1873 check_gstring (gstring) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1874 Lisp_Object gstring; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1875 { |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1876 Lisp_Object val; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1877 int i, j; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1878 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1879 CHECK_VECTOR (gstring); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1880 val = AREF (gstring, 0); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1881 CHECK_VECTOR (val); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1882 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
|
1883 goto err; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1884 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
|
1885 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
|
1886 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
|
1887 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
|
1888 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
|
1889 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
|
1890 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
|
1891 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
|
1892 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
|
1893 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
|
1894 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
|
1895 |
97822 | 1896 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
|
1897 { |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1898 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
|
1899 CHECK_VECTOR (val); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1900 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
|
1901 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
|
1902 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
|
1903 break; |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1904 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
|
1905 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
|
1906 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
|
1907 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
|
1908 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
|
1909 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
|
1910 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
|
1911 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
|
1912 { |
91550
83267bc0360a
(check_gstring): Use them and AREF to access the vector before
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91360
diff
changeset
|
1913 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
|
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) < 3) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1916 goto err; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1917 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
|
1918 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
|
1919 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1920 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1921 return i; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1922 err: |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1923 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
|
1924 return -1; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1925 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
1926 |
90823
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1927 static void |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1928 check_otf_features (otf_features) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1929 Lisp_Object otf_features; |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1930 { |
94926 | 1931 Lisp_Object val; |
90823
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1932 |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1933 CHECK_CONS (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1934 CHECK_SYMBOL (XCAR (otf_features)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1935 otf_features = XCDR (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1936 CHECK_CONS (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1937 CHECK_SYMBOL (XCAR (otf_features)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1938 otf_features = XCDR (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1939 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
|
1940 { |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1941 CHECK_SYMBOL (Fcar (val)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1942 if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1943 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
|
1944 } |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1945 otf_features = XCDR (otf_features); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1946 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
|
1947 { |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1948 CHECK_SYMBOL (Fcar (val)); |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1949 if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4) |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1950 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
|
1951 } |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1952 } |
b08ad368c328
(check_otf_features): Define it regardless of
Kenichi Handa <handa@m17n.org>
parents:
90817
diff
changeset
|
1953 |
90400 | 1954 #ifdef HAVE_LIBOTF |
1955 #include <otf.h> | |
1956 | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1957 Lisp_Object otf_list; |
90400 | 1958 |
1959 static Lisp_Object | |
1960 otf_tag_symbol (tag) | |
1961 OTF_Tag tag; | |
1962 { | |
1963 char name[5]; | |
1964 | |
1965 OTF_tag_name (tag, name); | |
1966 return Fintern (make_unibyte_string (name, 4), Qnil); | |
1967 } | |
1968 | |
1969 static OTF * | |
94926 | 1970 otf_open (file) |
1971 Lisp_Object file; | |
90400 | 1972 { |
94926 | 1973 Lisp_Object val = Fassoc (file, otf_list); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1974 OTF *otf; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1975 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1976 if (! NILP (val)) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1977 otf = XSAVE_VALUE (XCDR (val))->pointer; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1978 else |
90400 | 1979 { |
94926 | 1980 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
|
1981 val = make_save_value (otf, 0); |
94926 | 1982 otf_list = Fcons (Fcons (file, val), otf_list); |
90400 | 1983 } |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
1984 return otf; |
90400 | 1985 } |
1986 | |
1987 | |
1988 /* Return a list describing which scripts/languages FONT supports by | |
1989 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
|
1990 (struct font_driver).otf_capability. */ |
90400 | 1991 |
1992 Lisp_Object | |
1993 font_otf_capability (font) | |
1994 struct font *font; | |
1995 { | |
1996 OTF *otf; | |
1997 Lisp_Object capability = Fcons (Qnil, Qnil); | |
1998 int i; | |
1999 | |
94926 | 2000 otf = otf_open (font->props[FONT_FILE_INDEX]); |
90400 | 2001 if (! otf) |
2002 return Qnil; | |
2003 for (i = 0; i < 2; i++) | |
2004 { | |
2005 OTF_GSUB_GPOS *gsub_gpos; | |
2006 Lisp_Object script_list = Qnil; | |
2007 int j; | |
2008 | |
2009 if (OTF_get_features (otf, i == 0) < 0) | |
2010 continue; | |
2011 gsub_gpos = i == 0 ? otf->gsub : otf->gpos; | |
2012 for (j = gsub_gpos->ScriptList.ScriptCount - 1; j >= 0; j--) | |
2013 { | |
2014 OTF_Script *script = gsub_gpos->ScriptList.Script + j; | |
2015 Lisp_Object langsys_list = Qnil; | |
2016 Lisp_Object script_tag = otf_tag_symbol (script->ScriptTag); | |
2017 int k; | |
2018 | |
2019 for (k = script->LangSysCount; k >= 0; k--) | |
2020 { | |
2021 OTF_LangSys *langsys; | |
2022 Lisp_Object feature_list = Qnil; | |
2023 Lisp_Object langsys_tag; | |
2024 int l; | |
2025 | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2026 if (k == script->LangSysCount) |
90400 | 2027 { |
2028 langsys = &script->DefaultLangSys; | |
2029 langsys_tag = Qnil; | |
2030 } | |
2031 else | |
2032 { | |
2033 langsys = script->LangSys + k; | |
2034 langsys_tag | |
2035 = otf_tag_symbol (script->LangSysRecord[k].LangSysTag); | |
2036 } | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2037 for (l = langsys->FeatureCount - 1; l >= 0; l--) |
90400 | 2038 { |
2039 OTF_Feature *feature | |
2040 = gsub_gpos->FeatureList.Feature + langsys->FeatureIndex[l]; | |
2041 Lisp_Object feature_tag | |
2042 = otf_tag_symbol (feature->FeatureTag); | |
2043 | |
2044 feature_list = Fcons (feature_tag, feature_list); | |
2045 } | |
2046 langsys_list = Fcons (Fcons (langsys_tag, feature_list), | |
2047 langsys_list); | |
2048 } | |
2049 script_list = Fcons (Fcons (script_tag, langsys_list), | |
2050 script_list); | |
2051 } | |
2052 | |
2053 if (i == 0) | |
2054 XSETCAR (capability, script_list); | |
2055 else | |
2056 XSETCDR (capability, script_list); | |
2057 } | |
2058 | |
2059 return capability; | |
2060 } | |
2061 | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2062 /* 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
|
2063 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
|
2064 assured that the sufficient memory has already allocated for |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2065 FEATURES. */ |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2066 |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2067 static void |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2068 generate_otf_features (spec, features) |
90400 | 2069 Lisp_Object spec; |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2070 char *features; |
90400 | 2071 { |
2072 Lisp_Object val; | |
94926 | 2073 char *p; |
90400 | 2074 int asterisk; |
2075 | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2076 p = features; |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2077 *p = '\0'; |
90400 | 2078 for (asterisk = 0; CONSP (spec); spec = XCDR (spec)) |
2079 { | |
2080 val = XCAR (spec); | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2081 CHECK_SYMBOL (val); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2082 if (p > features) |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2083 *p++ = ','; |
90400 | 2084 if (SREF (SYMBOL_NAME (val), 0) == '*') |
2085 { | |
2086 asterisk = 1; | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2087 *p++ = '*'; |
90400 | 2088 } |
2089 else if (! asterisk) | |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2090 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2091 val = SYMBOL_NAME (val); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2092 p += sprintf (p, "%s", SDATA (val)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2093 } |
90400 | 2094 else |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2095 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2096 val = SYMBOL_NAME (val); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2097 p += sprintf (p, "~%s", SDATA (val)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2098 } |
90400 | 2099 } |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2100 if (CONSP (spec)) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2101 error ("OTF spec too long"); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2102 } |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
2103 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2104 Lisp_Object |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2105 font_otf_DeviceTable (device_table) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2106 OTF_DeviceTable *device_table; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2107 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2108 int len = device_table->StartSize - device_table->EndSize + 1; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2109 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2110 return Fcons (make_number (len), |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2111 make_unibyte_string (device_table->DeltaValue, len)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2112 } |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2113 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2114 Lisp_Object |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2115 font_otf_ValueRecord (value_format, value_record) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2116 int value_format; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2117 OTF_ValueRecord *value_record; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2118 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2119 Lisp_Object val = Fmake_vector (make_number (8), Qnil); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2120 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2121 if (value_format & OTF_XPlacement) |
91909 | 2122 ASET (val, 0, make_number (value_record->XPlacement)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2123 if (value_format & OTF_YPlacement) |
91909 | 2124 ASET (val, 1, make_number (value_record->YPlacement)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2125 if (value_format & OTF_XAdvance) |
91909 | 2126 ASET (val, 2, make_number (value_record->XAdvance)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2127 if (value_format & OTF_YAdvance) |
91909 | 2128 ASET (val, 3, make_number (value_record->YAdvance)); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2129 if (value_format & OTF_XPlaDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2130 ASET (val, 4, font_otf_DeviceTable (&value_record->XPlaDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2131 if (value_format & OTF_YPlaDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2132 ASET (val, 4, font_otf_DeviceTable (&value_record->YPlaDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2133 if (value_format & OTF_XAdvDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2134 ASET (val, 4, font_otf_DeviceTable (&value_record->XAdvDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2135 if (value_format & OTF_YAdvDevice) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2136 ASET (val, 4, font_otf_DeviceTable (&value_record->YAdvDevice)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2137 return val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2138 } |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2139 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2140 Lisp_Object |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2141 font_otf_Anchor (anchor) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2142 OTF_Anchor *anchor; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2143 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2144 Lisp_Object val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2145 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2146 val = Fmake_vector (make_number (anchor->AnchorFormat + 1), Qnil); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2147 ASET (val, 0, make_number (anchor->XCoordinate)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2148 ASET (val, 1, make_number (anchor->YCoordinate)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2149 if (anchor->AnchorFormat == 2) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2150 ASET (val, 2, make_number (anchor->f.f1.AnchorPoint)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2151 else |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2152 { |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2153 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
|
2154 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
|
2155 } |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2156 return val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
2157 } |
90400 | 2158 #endif /* HAVE_LIBOTF */ |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
2159 #endif /* 0 */ |
90400 | 2160 |
2161 | |
2162 /* Font sorting */ | |
2163 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2164 static unsigned font_score P_ ((Lisp_Object, Lisp_Object *)); |
90400 | 2165 static int font_compare P_ ((const void *, const void *)); |
2166 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
|
2167 Lisp_Object, int)); |
90400 | 2168 |
2169 /* We sort fonts by scoring each of them against a specified | |
2170 font-spec. The score value is 32 bit (`unsigned'), and the smaller | |
2171 the value is, the closer the font is to the font-spec. | |
2172 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2173 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
|
2174 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
|
2175 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2176 Each 7-bit in the higher 28 bits are used for numeric properties |
90400 | 2177 WEIGHT, SLANT, WIDTH, and SIZE. */ |
2178 | |
2179 /* How many bits to shift to store the difference value of each font | |
94926 | 2180 property in a score. Note that flots for FONT_TYPE_INDEX and |
2181 FONT_REGISTRY_INDEX are not used. */ | |
90400 | 2182 static int sort_shift_bits[FONT_SIZE_INDEX + 1]; |
2183 | |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2184 /* 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
|
2185 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
|
2186 SPEC_PROP. */ |
90400 | 2187 |
2188 static unsigned | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2189 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
|
2190 Lisp_Object entity, *spec_prop; |
90400 | 2191 { |
2192 unsigned score = 0; | |
2193 int i; | |
94926 | 2194 |
2195 /* Score three style numeric fields. Maximum difference is 127. */ | |
2196 for (i = FONT_WEIGHT_INDEX; i <= FONT_WIDTH_INDEX; i++) | |
2197 if (! NILP (spec_prop[i]) && ! EQ (AREF (entity, i), spec_prop[i])) | |
2198 { | |
2199 int diff = (XINT (AREF (entity, i)) >> 8) - (XINT (spec_prop[i]) >> 8); | |
2200 | |
2201 if (diff < 0) | |
2202 diff = - diff; | |
95875
d56319d0f726
(font_score): Ignore the diffference of alias style symbols.
Kenichi Handa <handa@m17n.org>
parents:
95869
diff
changeset
|
2203 if (diff > 0) |
d56319d0f726
(font_score): Ignore the diffference of alias style symbols.
Kenichi Handa <handa@m17n.org>
parents:
95869
diff
changeset
|
2204 score |= min (diff, 127) << sort_shift_bits[i]; |
94926 | 2205 } |
2206 | |
2207 /* Score the size. Maximum difference is 127. */ | |
2208 i = FONT_SIZE_INDEX; | |
96224
0fdf03fe1e8d
(font_score): Even if the PIXEL_SIZE is the same, check
Kenichi Handa <handa@m17n.org>
parents:
96200
diff
changeset
|
2209 if (! NILP (spec_prop[i]) && XINT (AREF (entity, i)) > 0) |
90400 | 2210 { |
94926 | 2211 /* We use the higher 6-bit for the actual size difference. The |
2212 lowest bit is set if the DPI is different. */ | |
2213 int diff = XINT (spec_prop[i]) - XINT (AREF (entity, i)); | |
2214 | |
2215 if (diff < 0) | |
2216 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
|
2217 diff <<= 1; |
94926 | 2218 if (! NILP (spec_prop[FONT_DPI_INDEX]) |
2219 && ! EQ (spec_prop[FONT_DPI_INDEX], AREF (entity, FONT_DPI_INDEX))) | |
2220 diff |= 1; | |
2221 score |= min (diff, 127) << sort_shift_bits[FONT_SIZE_INDEX]; | |
90400 | 2222 } |
2223 | |
2224 return score; | |
2225 } | |
2226 | |
2227 | |
2228 /* The comparison function for qsort. */ | |
2229 | |
2230 static int | |
2231 font_compare (d1, d2) | |
2232 const void *d1, *d2; | |
2233 { | |
94926 | 2234 return (*(unsigned *) d1 - *(unsigned *) d2); |
90400 | 2235 } |
2236 | |
2237 | |
2238 /* The structure for elements being sorted by qsort. */ | |
2239 struct font_sort_data | |
2240 { | |
2241 unsigned score; | |
2242 Lisp_Object entity; | |
2243 }; | |
2244 | |
2245 | |
2246 /* Sort font-entities in vector VEC by closeness to font-spec PREFER. | |
2247 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
|
2248 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
|
2249 of FRAME before sorting. |
94926 | 2250 |
2251 If BEST-ONLY is nonzero, return the best matching entity. Otherwise, | |
2252 return the sorted VEC. */ | |
90400 | 2253 |
2254 static Lisp_Object | |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2255 font_sort_entites (vec, prefer, frame, best_only) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2256 Lisp_Object vec, prefer, frame; |
94926 | 2257 int best_only; |
90400 | 2258 { |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2259 Lisp_Object prefer_prop[FONT_SPEC_MAX]; |
90400 | 2260 int len, i; |
2261 struct font_sort_data *data; | |
94926 | 2262 unsigned best_score; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2263 Lisp_Object best_entity, driver_type; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2264 int driver_order; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2265 struct frame *f = XFRAME (frame); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2266 struct font_driver_list *list; |
90400 | 2267 USE_SAFE_ALLOCA; |
2268 | |
2269 len = ASIZE (vec); | |
2270 if (len <= 1) | |
94926 | 2271 return best_only ? AREF (vec, 0) : vec; |
2272 | |
96224
0fdf03fe1e8d
(font_score): Even if the PIXEL_SIZE is the same, check
Kenichi Handa <handa@m17n.org>
parents:
96200
diff
changeset
|
2273 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
|
2274 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
|
2275 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
|
2276 prefer_prop[FONT_SIZE_INDEX] |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
2277 = 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
|
2278 |
90400 | 2279 /* Scoring and sorting. */ |
2280 SAFE_ALLOCA (data, struct font_sort_data *, (sizeof *data) * len); | |
94926 | 2281 best_score = 0xFFFFFFFF; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2282 /* 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
|
2283 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
|
2284 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
|
2285 driver_order++, list = list->next) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2286 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
|
2287 break; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2288 best_entity = data[0].entity = AREF (vec, 0); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2289 best_score = data[0].score |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2290 = font_score (data[0].entity, prefer_prop) | driver_order; |
90400 | 2291 for (i = 0; i < len; i++) |
2292 { | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2293 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
|
2294 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
|
2295 driver_order++, list = list->next) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2296 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
|
2297 break; |
90400 | 2298 data[i].entity = AREF (vec, i); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2299 data[i].score = font_score (data[i].entity, prefer_prop) | driver_order; |
94926 | 2300 if (best_only && best_score > data[i].score) |
2301 { | |
2302 best_score = data[i].score; | |
2303 best_entity = data[i].entity; | |
2304 if (best_score == 0) | |
2305 break; | |
2306 } | |
90400 | 2307 } |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2308 if (! best_only) |
94926 | 2309 { |
2310 qsort (data, len, sizeof *data, font_compare); | |
2311 for (i = 0; i < len; i++) | |
2312 ASET (vec, i, data[i].entity); | |
2313 } | |
2314 else | |
2315 vec = best_entity; | |
90400 | 2316 SAFE_FREE (); |
2317 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2318 font_add_log ("sort-by", prefer, vec); |
90400 | 2319 return vec; |
2320 } | |
2321 | |
2322 | |
2323 /* API of Font Service Layer. */ | |
2324 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2325 /* 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
|
2326 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
|
2327 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
|
2328 |
90400 | 2329 void |
2330 font_update_sort_order (order) | |
2331 int *order; | |
2332 { | |
94926 | 2333 int i, shift_bits; |
2334 | |
95869
14ab94c436d7
(font_update_sort_order): Setting of sort_shift_bits adjusted for the
Kenichi Handa <handa@m17n.org>
parents:
95867
diff
changeset
|
2335 for (i = 0, shift_bits = 23; i < 4; i++, shift_bits -= 7) |
90400 | 2336 { |
2337 int xlfd_idx = order[i]; | |
2338 | |
2339 if (xlfd_idx == XLFD_WEIGHT_INDEX) | |
2340 sort_shift_bits[FONT_WEIGHT_INDEX] = shift_bits; | |
2341 else if (xlfd_idx == XLFD_SLANT_INDEX) | |
2342 sort_shift_bits[FONT_SLANT_INDEX] = shift_bits; | |
2343 else if (xlfd_idx == XLFD_SWIDTH_INDEX) | |
2344 sort_shift_bits[FONT_WIDTH_INDEX] = shift_bits; | |
2345 else | |
2346 sort_shift_bits[FONT_SIZE_INDEX] = shift_bits; | |
2347 } | |
2348 } | |
2349 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2350 static int |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2351 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
|
2352 Lisp_Object script, langsys, features, table; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2353 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2354 Lisp_Object val; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2355 int negative; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2356 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2357 table = assq_no_quit (script, table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2358 if (NILP (table)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2359 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2360 table = XCDR (table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2361 if (! NILP (langsys)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2362 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2363 table = assq_no_quit (langsys, table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2364 if (NILP (table)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2365 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2366 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2367 else |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2368 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2369 val = assq_no_quit (Qnil, table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2370 if (NILP (val)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2371 table = XCAR (table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2372 else |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2373 table = val; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2374 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2375 table = XCDR (table); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2376 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
|
2377 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2378 if (NILP (XCAR (features))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2379 negative = 1; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2380 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
|
2381 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2382 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2383 return 1; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2384 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2385 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2386 /* 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
|
2387 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2388 static int |
96573
3de01ebe30b7
* fontset.c (fontset_get_font_group):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
96565
diff
changeset
|
2389 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
|
2390 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2391 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
|
2392 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2393 script = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2394 spec = XCDR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2395 if (! NILP (spec)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2396 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2397 langsys = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2398 spec = XCDR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2399 if (! NILP (spec)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2400 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2401 gsub = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2402 spec = XCDR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2403 if (! NILP (spec)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2404 gpos = XCAR (spec); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2405 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2406 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2407 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2408 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
|
2409 XCAR (otf_capability))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2410 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2411 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
|
2412 XCDR (otf_capability))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2413 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2414 return 1; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2415 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2416 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2417 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2418 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2419 /* 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
|
2420 specification SPEC. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2421 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2422 int |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2423 font_match_p (spec, font) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2424 Lisp_Object spec, font; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2425 { |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2426 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
|
2427 Lisp_Object extra, font_extra; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2428 int i; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2429 |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2430 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
|
2431 if (! NILP (AREF (spec, i)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2432 && ! NILP (AREF (font, i)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2433 && ! 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
|
2434 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2435 props = XFONT_SPEC (spec)->props; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2436 if (FLOATP (props[FONT_SIZE_INDEX])) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2437 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2438 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
|
2439 prop[i] = AREF (spec, i); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2440 prop[FONT_SIZE_INDEX] |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2441 = 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
|
2442 props = prop; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2443 } |
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 if (font_score (font, props) > 0) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2446 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2447 extra = AREF (spec, FONT_EXTRA_INDEX); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2448 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
|
2449 for (; CONSP (extra); extra = XCDR (extra)) |
94926 | 2450 { |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2451 Lisp_Object key = XCAR (XCAR (extra)); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2452 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
|
2453 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2454 if (EQ (key, QClang)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2455 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2456 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
|
2457 if (NILP (val2)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2458 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2459 val2 = XCDR (val2); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2460 if (CONSP (val)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2461 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2462 if (! CONSP (val2)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2463 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2464 while (CONSP (val)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2465 if (NILP (Fmemq (val, val2))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2466 return 0; |
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 else |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2469 if (CONSP (val2) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2470 ? NILP (Fmemq (val, XCDR (val2))) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2471 : ! EQ (val, val2)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2472 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2473 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2474 else if (EQ (key, QCscript)) |
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 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
|
2477 if (CONSP (val2)) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2478 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2479 val2 = XCDR (val2); |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2480 if (CONSP (val2)) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2481 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2482 /* 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
|
2483 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
|
2484 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2485 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
|
2486 continue; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2487 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
|
2488 == FONT_INVALID_CODE) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2489 return 0; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2490 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2491 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2492 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
|
2493 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2494 /* 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
|
2495 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
|
2496 { |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2497 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
|
2498 continue; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2499 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
|
2500 != FONT_INVALID_CODE) |
99076
06c37ccf1b58
(font_match_p): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
99075
diff
changeset
|
2501 break; |
99075
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2502 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2503 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
|
2504 return 0; |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2505 } |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
2506 } |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2507 } |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2508 else if (EQ (key, QCotf)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2509 { |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2510 struct font *fontp; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2511 |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2512 if (! FONT_OBJECT_P (font)) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2513 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2514 fontp = XFONT_OBJECT (font); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2515 if (! fontp->driver->otf_capability) |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2516 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2517 val2 = fontp->driver->otf_capability (fontp); |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2518 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
|
2519 return 0; |
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2520 } |
94926 | 2521 } |
2522 | |
96559
34bb8a9f2b7f
(font_make_object): New arg entity and pixelsize.
Kenichi Handa <handa@m17n.org>
parents:
96262
diff
changeset
|
2523 return 1; |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2524 } |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2525 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
2526 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2527 /* Font cache |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2528 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2529 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
|
2530 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
|
2531 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
|
2532 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
|
2533 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2534 ((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
|
2535 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2536 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
|
2537 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
|
2538 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
|
2539 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2540 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
|
2541 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
|
2542 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
|
2543 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
|
2544 struct font_driver *)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2545 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2546 static void |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2547 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
|
2548 FRAME_PTR f; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2549 struct font_driver *driver; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2550 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2551 Lisp_Object cache, val; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2552 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2553 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
|
2554 val = XCDR (cache); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2555 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
|
2556 val = XCDR (val); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2557 if (NILP (val)) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2558 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2559 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
|
2560 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
|
2561 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2562 else |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2563 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2564 val = XCDR (XCAR (val)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2565 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
|
2566 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2567 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2568 |
91909 | 2569 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2570 static void |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2571 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
|
2572 FRAME_PTR f; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2573 struct font_driver *driver; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2574 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2575 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
|
2576 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2577 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2578 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
|
2579 val = XCDR (cache); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2580 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
|
2581 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
|
2582 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
|
2583 tmp = XCDR (XCAR (val)); |
91909 | 2584 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
|
2585 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
|
2586 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2587 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
|
2588 XSETCDR (cache, XCDR (val)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2589 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2590 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2591 |
91909 | 2592 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2593 static Lisp_Object |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2594 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
|
2595 FRAME_PTR f; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2596 struct font_driver *driver; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2597 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2598 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
|
2599 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
|
2600 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2601 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
|
2602 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
|
2603 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
|
2604 /* 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
|
2605 val = XCDR (XCAR (val)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2606 return val; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2607 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2608 |
91909 | 2609 static int num_fonts; |
2610 | |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2611 static void |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2612 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
|
2613 FRAME_PTR f; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2614 Lisp_Object cache; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2615 struct font_driver *driver; |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2616 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2617 Lisp_Object tail, elt; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
2618 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2619 /* 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
|
2620 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
|
2621 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2622 elt = XCAR (tail); |
94968
e87ef440216b
(font_clear_cache): Check if the cached vector of entities is nil
Kenichi Handa <handa@m17n.org>
parents:
94964
diff
changeset
|
2623 if (CONSP (elt) && FONT_SPEC_P (XCAR (elt)) && VECTORP (XCDR (elt))) |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2624 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2625 Lisp_Object vec = XCDR (elt); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2626 int i; |
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 for (i = 0; i < ASIZE (vec); i++) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2629 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2630 Lisp_Object entity = AREF (vec, i); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2631 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2632 if (EQ (driver->type, AREF (entity, FONT_TYPE_INDEX))) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2633 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2634 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
|
2635 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2636 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
|
2637 { |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2638 Lisp_Object val = XCAR (objlist); |
94926 | 2639 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
|
2640 |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2641 if (! NILP (AREF (val, FONT_TYPE_INDEX))) |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2642 { |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2643 font_assert (font && driver == font->driver); |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2644 driver->close (f, font); |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2645 num_fonts--; |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2646 } |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2647 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2648 if (driver->free_entity) |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2649 driver->free_entity (entity); |
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 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2652 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2653 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2654 XSETCDR (cache, Qnil); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2655 } |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2656 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2657 |
90400 | 2658 static Lisp_Object scratch_font_spec, scratch_font_prefer; |
2659 | |
94926 | 2660 Lisp_Object |
2661 font_delete_unmatched (list, spec, size) | |
2662 Lisp_Object list, spec; | |
2663 int size; | |
2664 { | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2665 Lisp_Object entity, val; |
94926 | 2666 enum font_property_index prop; |
2667 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2668 for (val = Qnil; CONSP (list); list = XCDR (list)) |
94926 | 2669 { |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2670 entity = XCAR (list); |
94926 | 2671 for (prop = FONT_WEIGHT_INDEX; prop < FONT_SIZE_INDEX; prop++) |
2672 if (INTEGERP (AREF (spec, prop)) | |
2673 && ((XINT (AREF (spec, prop)) >> 8) | |
2674 != (XINT (AREF (entity, prop)) >> 8))) | |
2675 prop = FONT_SPEC_MAX; | |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2676 if (prop < FONT_SPEC_MAX |
94926 | 2677 && size |
2678 && XINT (AREF (entity, FONT_SIZE_INDEX)) > 0) | |
2679 { | |
2680 int diff = XINT (AREF (entity, FONT_SIZE_INDEX)) - size; | |
2681 | |
2682 if (diff != 0 | |
2683 && (diff < 0 ? -diff > FONT_PIXEL_SIZE_QUANTUM | |
2684 : diff > FONT_PIXEL_SIZE_QUANTUM)) | |
2685 prop = FONT_SPEC_MAX; | |
2686 } | |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2687 if (prop < FONT_SPEC_MAX |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2688 && INTEGERP (AREF (spec, FONT_DPI_INDEX)) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2689 && 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
|
2690 && XINT (AREF (entity, FONT_DPI_INDEX)) != 0 |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2691 && ! 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
|
2692 prop = FONT_SPEC_MAX; |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2693 if (prop < FONT_SPEC_MAX |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2694 && INTEGERP (AREF (spec, FONT_AVGWIDTH_INDEX)) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2695 && 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
|
2696 && XINT (AREF (entity, FONT_AVGWIDTH_INDEX)) != 0 |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2697 && ! EQ (AREF (spec, FONT_AVGWIDTH_INDEX), |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2698 AREF (entity, FONT_AVGWIDTH_INDEX))) |
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
2699 prop = FONT_SPEC_MAX; |
94926 | 2700 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
|
2701 val = Fcons (entity, val); |
94926 | 2702 } |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2703 return val; |
94926 | 2704 } |
2705 | |
2706 | |
2707 /* Return a vector of font-entities matching with SPEC on FRAME. */ | |
2708 | |
2709 Lisp_Object | |
90400 | 2710 font_list_entities (frame, spec) |
2711 Lisp_Object frame, spec; | |
2712 { | |
2713 FRAME_PTR f = XFRAME (frame); | |
2714 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
|
2715 Lisp_Object ftype, val; |
94926 | 2716 Lisp_Object *vec; |
2717 int size; | |
2718 int need_filtering = 0; | |
90400 | 2719 int i; |
2720 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2721 font_assert (FONT_SPEC_P (spec)); |
90400 | 2722 |
94926 | 2723 if (INTEGERP (AREF (spec, FONT_SIZE_INDEX))) |
2724 size = XINT (AREF (spec, FONT_SIZE_INDEX)); | |
2725 else if (FLOATP (AREF (spec, FONT_SIZE_INDEX))) | |
2726 size = font_pixel_size (f, spec); | |
2727 else | |
2728 size = 0; | |
2729 | |
90400 | 2730 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
|
2731 for (i = FONT_FOUNDRY_INDEX; i <= FONT_REGISTRY_INDEX; i++) |
94926 | 2732 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
|
2733 for (i = FONT_WEIGHT_INDEX; i < FONT_EXTRA_INDEX; i++) |
94926 | 2734 { |
2735 ASET (scratch_font_spec, i, Qnil); | |
2736 if (! NILP (AREF (spec, i))) | |
2737 need_filtering = 1; | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2738 if (i == FONT_DPI_INDEX) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2739 /* Skip FONT_SPACING_INDEX */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2740 i++; |
94926 | 2741 } |
95359
f6580a4c58da
(font_parse_family_registry): Use Ffont_put to validate
Kenichi Handa <handa@m17n.org>
parents:
95290
diff
changeset
|
2742 ASET (scratch_font_spec, FONT_SPACING_INDEX, AREF (spec, FONT_SPACING_INDEX)); |
94926 | 2743 ASET (scratch_font_spec, FONT_EXTRA_INDEX, AREF (spec, FONT_EXTRA_INDEX)); |
2744 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2745 vec = alloca (sizeof (Lisp_Object) * num_font_drivers); |
94926 | 2746 if (! vec) |
2747 return null_vector; | |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
2748 |
90400 | 2749 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
|
2750 if (driver_list->on |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
2751 && (NILP (ftype) || EQ (driver_list->driver->type, ftype))) |
90400 | 2752 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2753 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
|
2754 |
95437
6e6db01383e4
(font_list_entities): Fix the car part of data to be
Kenichi Handa <handa@m17n.org>
parents:
95421
diff
changeset
|
2755 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
|
2756 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
|
2757 if (CONSP (val)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2758 val = XCDR (val); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2759 else |
90400 | 2760 { |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2761 Lisp_Object copy; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2762 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2763 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
|
2764 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
|
2765 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
|
2766 XSETCDR (cache, Fcons (Fcons (copy, val), XCDR (cache))); |
90400 | 2767 } |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2768 if (! NILP (val) && need_filtering) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2769 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
|
2770 if (! NILP (val)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
2771 vec[i++] = val; |
90400 | 2772 } |
94926 | 2773 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2774 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
|
2775 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
|
2776 return (val); |
90400 | 2777 } |
2778 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2779 |
94926 | 2780 /* Return a font entity matching with SPEC on FRAME. ATTRS, if non |
2781 nil, is an array of face's attributes, which specifies preferred | |
2782 font-related attributes. */ | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2783 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2784 static Lisp_Object |
94926 | 2785 font_matching_entity (f, attrs, spec) |
2786 FRAME_PTR f; | |
2787 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
|
2788 { |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2789 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
|
2790 Lisp_Object ftype, size, entity; |
94926 | 2791 Lisp_Object frame; |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2792 Lisp_Object work = Fcopy_font_spec (spec); |
94926 | 2793 |
2794 XSETFRAME (frame, f); | |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2795 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
|
2796 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
|
2797 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2798 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
|
2799 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
|
2800 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
|
2801 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
|
2802 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
|
2803 |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2804 entity = Qnil; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2805 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
|
2806 if (driver_list->on |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2807 && (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
|
2808 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
2809 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
|
2810 Lisp_Object copy; |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2811 |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2812 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
|
2813 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
|
2814 if (CONSP (entity)) |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2815 entity = XCDR (entity); |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2816 else |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2817 { |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2818 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
|
2819 copy = Fcopy_font_spec (work); |
95104
ae4280e6a166
(font_list_entities): Fix handling of cache.
Kenichi Handa <handa@m17n.org>
parents:
95013
diff
changeset
|
2820 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
|
2821 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
|
2822 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2823 if (! NILP (entity)) |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2824 break; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2825 } |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
2826 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
|
2827 return entity; |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2828 } |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
2829 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2830 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2831 /* 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
|
2832 opened font object. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2833 |
90400 | 2834 static Lisp_Object |
2835 font_open_entity (f, entity, pixel_size) | |
2836 FRAME_PTR f; | |
2837 Lisp_Object entity; | |
2838 int pixel_size; | |
2839 { | |
2840 struct font_driver_list *driver_list; | |
91909 | 2841 Lisp_Object objlist, size, val, font_object; |
90400 | 2842 struct font *font; |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
2843 int min_width, height; |
94926 | 2844 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2845 font_assert (FONT_ENTITY_P (entity)); |
90400 | 2846 size = AREF (entity, FONT_SIZE_INDEX); |
2847 if (XINT (size) != 0) | |
2848 pixel_size = XINT (size); | |
2849 | |
2850 for (objlist = AREF (entity, FONT_OBJLIST_INDEX); CONSP (objlist); | |
2851 objlist = XCDR (objlist)) | |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2852 if (! NILP (AREF (XCAR (objlist), FONT_TYPE_INDEX)) |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2853 && XFONT_OBJECT (XCAR (objlist))->pixel_size == pixel_size) |
94926 | 2854 return XCAR (objlist); |
2855 | |
2856 val = AREF (entity, FONT_TYPE_INDEX); | |
2857 for (driver_list = f->font_driver_list; | |
2858 driver_list && ! EQ (driver_list->driver->type, val); | |
2859 driver_list = driver_list->next); | |
2860 if (! driver_list) | |
2861 return Qnil; | |
2862 | |
2863 font_object = driver_list->driver->open (f, entity, 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
|
2864 font_add_log ("open", entity, font_object); |
91909 | 2865 if (NILP (font_object)) |
94926 | 2866 return Qnil; |
2867 ASET (entity, FONT_OBJLIST_INDEX, | |
2868 Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX))); | |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2869 ASET (font_object, FONT_OBJLIST_INDEX, Qnil); |
94926 | 2870 num_fonts++; |
2871 | |
2872 font = XFONT_OBJECT (font_object); | |
2873 min_width = (font->min_width ? font->min_width | |
2874 : font->average_width ? font->average_width | |
2875 : font->space_width ? font->space_width | |
2876 : 1); | |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
2877 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
|
2878 #ifdef HAVE_WINDOW_SYSTEM |
94926 | 2879 FRAME_X_DISPLAY_INFO (f)->n_fonts++; |
2880 if (FRAME_X_DISPLAY_INFO (f)->n_fonts == 1) | |
91909 | 2881 { |
94926 | 2882 FRAME_SMALLEST_CHAR_WIDTH (f) = min_width; |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
2883 FRAME_SMALLEST_FONT_HEIGHT (f) = height; |
94926 | 2884 fonts_changed_p = 1; |
91909 | 2885 } |
94926 | 2886 else |
2887 { | |
2888 if (FRAME_SMALLEST_CHAR_WIDTH (f) > min_width) | |
2889 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
|
2890 if (FRAME_SMALLEST_FONT_HEIGHT (f) > height) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
2891 FRAME_SMALLEST_FONT_HEIGHT (f) = height, fonts_changed_p = 1; |
94926 | 2892 } |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
2893 #endif |
91909 | 2894 |
2895 return font_object; | |
90400 | 2896 } |
2897 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2898 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2899 /* 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
|
2900 |
90400 | 2901 void |
2902 font_close_object (f, font_object) | |
2903 FRAME_PTR f; | |
2904 Lisp_Object font_object; | |
2905 { | |
94926 | 2906 struct font *font = XFONT_OBJECT (font_object); |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2907 |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2908 if (NILP (AREF (font_object, FONT_TYPE_INDEX))) |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2909 /* Already closed. */ |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2910 return; |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2911 font_add_log ("close", font_object, Qnil); |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2912 font->driver->close (f, font); |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
2913 #ifdef HAVE_WINDOW_SYSTEM |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2914 font_assert (FRAME_X_DISPLAY_INFO (f)->n_fonts); |
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2915 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
|
2916 #endif |
96000
f2d08191aec7
(font_check_object): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
95984
diff
changeset
|
2917 num_fonts--; |
90400 | 2918 } |
2919 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2920 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
2921 /* 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
|
2922 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
|
2923 |
90400 | 2924 int |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2925 font_has_char (f, font, c) |
90400 | 2926 FRAME_PTR f; |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2927 Lisp_Object font; |
90400 | 2928 int c; |
2929 { | |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2930 struct font *fontp; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2931 |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2932 if (FONT_ENTITY_P (font)) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2933 { |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2934 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
|
2935 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
|
2936 |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2937 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
|
2938 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
|
2939 driver_list = driver_list->next); |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2940 if (! driver_list) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2941 return 0; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2942 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
|
2943 return -1; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2944 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
|
2945 } |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2946 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2947 font_assert (FONT_OBJECT_P (font)); |
94926 | 2948 fontp = XFONT_OBJECT (font); |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2949 if (fontp->driver->has_char) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2950 { |
94926 | 2951 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
|
2952 |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2953 if (result >= 0) |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2954 return result; |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2955 } |
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
2956 return (fontp->driver->encode_char (fontp, c) != FONT_INVALID_CODE); |
90400 | 2957 } |
2958 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2959 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2960 /* 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
|
2961 |
90400 | 2962 unsigned |
2963 font_encode_char (font_object, c) | |
2964 Lisp_Object font_object; | |
2965 int c; | |
2966 { | |
94926 | 2967 struct font *font; |
2968 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2969 font_assert (FONT_OBJECT_P (font_object)); |
94926 | 2970 font = XFONT_OBJECT (font_object); |
90400 | 2971 return font->driver->encode_char (font, c); |
2972 } | |
2973 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2974 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2975 /* 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
|
2976 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2977 Lisp_Object |
90400 | 2978 font_get_name (font_object) |
2979 Lisp_Object font_object; | |
2980 { | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
2981 font_assert (FONT_OBJECT_P (font_object)); |
94926 | 2982 return AREF (font_object, FONT_NAME_INDEX); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2983 } |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2984 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2985 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
2986 /* 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
|
2987 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2988 Lisp_Object |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2989 font_get_spec (font_object) |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2990 Lisp_Object font_object; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2991 { |
94926 | 2992 Lisp_Object spec = font_make_spec (); |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2993 int i; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2994 |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
2995 for (i = 0; i < FONT_SIZE_INDEX; i++) |
94926 | 2996 ASET (spec, i, AREF (font_object, i)); |
2997 ASET (spec, FONT_SIZE_INDEX, | |
2998 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
|
2999 return spec; |
90400 | 3000 } |
3001 | |
3002 Lisp_Object | |
94926 | 3003 font_spec_from_name (font_name) |
3004 Lisp_Object font_name; | |
3005 { | |
3006 Lisp_Object args[2]; | |
3007 | |
3008 args[0] = QCname; | |
3009 args[1] = font_name; | |
3010 return Ffont_spec (2, args); | |
3011 } | |
3012 | |
3013 | |
3014 void | |
3015 font_clear_prop (attrs, prop) | |
3016 Lisp_Object *attrs; | |
3017 enum font_property_index prop; | |
3018 { | |
3019 Lisp_Object font = attrs[LFACE_FONT_INDEX]; | |
3020 | |
3021 if (! FONTP (font)) | |
3022 return; | |
3023 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
|
3024 && 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
|
3025 && 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
|
3026 && prop != FONT_WIDTH_INDEX |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3027 && prop != FONT_SIZE_INDEX) |
94926 | 3028 return; |
3029 font = Fcopy_font_spec (font); | |
3030 ASET (font, prop, Qnil); | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3031 if (prop == FONT_FAMILY_INDEX || prop == FONT_FOUNDRY_INDEX) |
94926 | 3032 { |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3033 if (prop == FONT_FAMILY_INDEX) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3034 ASET (font, FONT_FOUNDRY_INDEX, Qnil); |
94926 | 3035 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
|
3036 ASET (font, FONT_REGISTRY_INDEX, Qnil); |
94926 | 3037 ASET (font, FONT_SIZE_INDEX, Qnil); |
3038 ASET (font, FONT_DPI_INDEX, Qnil); | |
3039 ASET (font, FONT_SPACING_INDEX, Qnil); | |
3040 ASET (font, FONT_AVGWIDTH_INDEX, Qnil); | |
3041 } | |
3042 else if (prop == FONT_SIZE_INDEX) | |
3043 { | |
3044 ASET (font, FONT_DPI_INDEX, Qnil); | |
3045 ASET (font, FONT_SPACING_INDEX, Qnil); | |
3046 ASET (font, FONT_AVGWIDTH_INDEX, Qnil); | |
3047 } | |
98717
507c5c477e60
(font_clear_prop): When clearing font width, clear the average width
Chong Yidong <cyd@stupidchicken.com>
parents:
98655
diff
changeset
|
3048 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
|
3049 ASET (font, FONT_AVGWIDTH_INDEX, Qnil); |
94926 | 3050 attrs[LFACE_FONT_INDEX] = font; |
3051 } | |
3052 | |
3053 void | |
3054 font_update_lface (f, attrs) | |
3055 FRAME_PTR f; | |
3056 Lisp_Object *attrs; | |
90400 | 3057 { |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
3058 Lisp_Object spec; |
94926 | 3059 |
3060 spec = attrs[LFACE_FONT_INDEX]; | |
3061 if (! FONT_SPEC_P (spec)) | |
3062 return; | |
3063 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3064 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
|
3065 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
|
3066 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
|
3067 attrs[LFACE_FAMILY_INDEX] = SYMBOL_NAME (AREF (spec, FONT_FAMILY_INDEX)); |
94926 | 3068 if (! NILP (AREF (spec, FONT_WEIGHT_INDEX))) |
3069 attrs[LFACE_WEIGHT_INDEX] = FONT_WEIGHT_FOR_FACE (spec); | |
3070 if (! NILP (AREF (spec, FONT_SLANT_INDEX))) | |
3071 attrs[LFACE_SLANT_INDEX] = FONT_SLANT_FOR_FACE (spec);; | |
3072 if (! NILP (AREF (spec, FONT_WIDTH_INDEX))) | |
3073 attrs[LFACE_SWIDTH_INDEX] = FONT_WIDTH_FOR_FACE (spec); | |
3074 if (! NILP (AREF (spec, FONT_SIZE_INDEX))) | |
3075 { | |
3076 int point; | |
3077 | |
3078 if (INTEGERP (AREF (spec, FONT_SIZE_INDEX))) | |
3079 { | |
3080 Lisp_Object val; | |
3081 int dpi = f->resy; | |
3082 | |
3083 val = Ffont_get (spec, QCdpi); | |
3084 if (! NILP (val)) | |
3085 dpi = XINT (val); | |
3086 point = PIXEL_TO_POINT (XINT (AREF (spec, FONT_SIZE_INDEX)) * 10, | |
3087 dpi); | |
3088 } | |
3089 else if (FLOATP (AREF (spec, FONT_SIZE_INDEX))) | |
3090 point = XFLOAT_DATA (AREF (spec, FONT_SIZE_INDEX)) * 10; | |
3091 attrs[LFACE_HEIGHT_INDEX] = make_number (point); | |
3092 } | |
90400 | 3093 } |
3094 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3095 |
94926 | 3096 /* Return a font-entity satisfying SPEC and best matching with face's |
3097 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
|
3098 character that the entity must support. */ |
90400 | 3099 |
3100 Lisp_Object | |
94926 | 3101 font_find_for_lface (f, attrs, spec, c) |
90400 | 3102 FRAME_PTR f; |
94926 | 3103 Lisp_Object *attrs; |
90400 | 3104 Lisp_Object spec; |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
3105 int c; |
90400 | 3106 { |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3107 Lisp_Object work; |
94926 | 3108 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
|
3109 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
|
3110 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
|
3111 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
|
3112 |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3113 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
|
3114 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
|
3115 { |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
3116 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
|
3117 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
|
3118 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
|
3119 } |
ff04c95494e4
(font_find_for_lface): If registry is NULL, try iso8859-1 and ascii-0.
Kenichi Handa <handa@m17n.org>
parents:
95886
diff
changeset
|
3120 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
|
3121 registry[1] = null_vector; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3122 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3123 if (c >= 0 && ! NILP (AREF (spec, FONT_REGISTRY_INDEX))) |
94926 | 3124 { |
3125 struct charset *encoding, *repertory; | |
3126 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3127 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
|
3128 &encoding, &repertory) < 0) |
94926 | 3129 return Qnil; |
3130 if (repertory) | |
3131 { | |
3132 if (ENCODE_CHAR (repertory, c) == CHARSET_INVALID_CODE (repertory)) | |
3133 return Qnil; | |
3134 /* Any font of this registry support C. So, let's | |
3135 suppress the further checking. */ | |
3136 c = -1; | |
3137 } | |
3138 else if (c > encoding->max_char) | |
3139 return Qnil; | |
3140 } | |
3141 | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3142 work = Fcopy_font_spec (spec); |
90507
4a6034a7c870
(font_find_for_lface): Code optimized.
Kenichi Handa <handa@m17n.org>
parents:
90503
diff
changeset
|
3143 XSETFRAME (frame, f); |
94926 | 3144 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
|
3145 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
|
3146 if (pixel_size == 0) |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3147 { |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3148 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
|
3149 |
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3150 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
|
3151 } |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3152 ASET (work, FONT_SIZE_INDEX, Qnil); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3153 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
|
3154 if (! NILP (foundry[0])) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3155 foundry[1] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3156 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
|
3157 { |
97822 | 3158 val = attrs[LFACE_FOUNDRY_INDEX]; |
3159 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
|
3160 foundry[1] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3161 foundry[2] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3162 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3163 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3164 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
|
3165 |
96200
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3166 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
|
3167 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
|
3168 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
|
3169 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
|
3170 { |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3171 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
|
3172 |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3173 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
|
3174 { |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3175 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
|
3176 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
|
3177 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
|
3178 } |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3179 else |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3180 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
|
3181 } |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3182 else |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3183 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
|
3184 |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3185 |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3186 val = AREF (work, FONT_FAMILY_INDEX); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3187 if (NILP (val) && STRINGP (attrs[LFACE_FAMILY_INDEX])) |
97822 | 3188 { |
3189 val = attrs[LFACE_FAMILY_INDEX]; | |
3190 val = font_intern_prop ((char *) SDATA (val), SBYTES (val), 1); | |
3191 } | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3192 if (NILP (val)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3193 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3194 family = alloca ((sizeof family[0]) * 2); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3195 family[0] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3196 family[1] = null_vector; /* terminator. */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3197 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3198 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3199 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3200 Lisp_Object alters |
98445
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3201 = 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
|
3202 #ifndef HAVE_NS |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3203 Qt |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3204 #else |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3205 Qnil |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3206 #endif |
5d2542d6df18
(font_matching_entity): Reflect ATTRS in font selection.
Kenichi Handa <handa@m17n.org>
parents:
98124
diff
changeset
|
3207 ); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3208 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3209 if (! NILP (alters)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3210 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3211 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
|
3212 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
|
3213 family[i] = XCAR (alters); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3214 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
|
3215 family[i++] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3216 family[i] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3217 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3218 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3219 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3220 family = alloca ((sizeof family[0]) * 3); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3221 i = 0; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3222 family[i++] = val; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3223 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
|
3224 family[i++] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3225 family[i] = null_vector; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3226 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3227 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3228 |
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
|
3229 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
|
3230 { |
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
|
3231 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
|
3232 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
|
3233 { |
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
|
3234 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
|
3235 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
|
3236 { |
95890
e6e6c351339d
(font_find_for_lface): Fix typo of the previous change.
Kenichi Handa <handa@m17n.org>
parents:
95888
diff
changeset
|
3237 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
|
3238 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
|
3239 { |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3240 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
|
3241 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
|
3242 if (ASIZE (entities) > 0) |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3243 goto found; |
5f7a1e1f15c4
(font_find_for_lface): Try the adstyle specified in the property of
Kenichi Handa <handa@m17n.org>
parents:
96136
diff
changeset
|
3244 } |
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
|
3245 } |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3246 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3247 } |
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
|
3248 return Qnil; |
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 found: |
94926 | 3250 if (ASIZE (entities) == 1) |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3251 { |
94926 | 3252 if (c < 0) |
3253 return AREF (entities, 0); | |
90490
8ef2cbaf626a
(font_parse_xlfd): Fix generating of CHARSET_REGISTRY field.
Kenichi Handa <handa@m17n.org>
parents:
90483
diff
changeset
|
3254 } |
90507
4a6034a7c870
(font_find_for_lface): Code optimized.
Kenichi Handa <handa@m17n.org>
parents:
90503
diff
changeset
|
3255 else |
90400 | 3256 { |
90507
4a6034a7c870
(font_find_for_lface): Code optimized.
Kenichi Handa <handa@m17n.org>
parents:
90503
diff
changeset
|
3257 /* Sort fonts by properties specified in LFACE. */ |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
3258 Lisp_Object prefer = scratch_font_prefer; |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
3259 |
94926 | 3260 for (i = 0; i < FONT_EXTRA_INDEX; i++) |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3261 ASET (prefer, i, AREF (work, i)); |
95013
125a7ecf00db
(font_find_for_lface): Reflect LFACE_FONT in the font
Kenichi Handa <handa@m17n.org>
parents:
94968
diff
changeset
|
3262 if (FONTP (attrs[LFACE_FONT_INDEX])) |
125a7ecf00db
(font_find_for_lface): Reflect LFACE_FONT in the font
Kenichi Handa <handa@m17n.org>
parents:
94968
diff
changeset
|
3263 { |
125a7ecf00db
(font_find_for_lface): Reflect LFACE_FONT in the font
Kenichi Handa <handa@m17n.org>
parents:
94968
diff
changeset
|
3264 Lisp_Object face_font = attrs[LFACE_FONT_INDEX]; |
125a7ecf00db
(font_find_for_lface): Reflect LFACE_FONT in the font
Kenichi Handa <handa@m17n.org>
parents:
94968
diff
changeset
|
3265 |
125a7ecf00db
(font_find_for_lface): Reflect LFACE_FONT in the font
Kenichi Handa <handa@m17n.org>
parents:
94968
diff
changeset
|
3266 for (i = 0; i < FONT_EXTRA_INDEX; i++) |
125a7ecf00db
(font_find_for_lface): Reflect LFACE_FONT in the font
Kenichi Handa <handa@m17n.org>
parents:
94968
diff
changeset
|
3267 if (NILP (AREF (prefer, i))) |
125a7ecf00db
(font_find_for_lface): Reflect LFACE_FONT in the font
Kenichi Handa <handa@m17n.org>
parents:
94968
diff
changeset
|
3268 ASET (prefer, i, AREF (face_font, i)); |
125a7ecf00db
(font_find_for_lface): Reflect LFACE_FONT in the font
Kenichi Handa <handa@m17n.org>
parents:
94968
diff
changeset
|
3269 } |
94926 | 3270 if (NILP (AREF (prefer, FONT_WEIGHT_INDEX))) |
3271 FONT_SET_STYLE (prefer, FONT_WEIGHT_INDEX, attrs[LFACE_WEIGHT_INDEX]); | |
3272 if (NILP (AREF (prefer, FONT_SLANT_INDEX))) | |
3273 FONT_SET_STYLE (prefer, FONT_SLANT_INDEX, attrs[LFACE_SLANT_INDEX]); | |
3274 if (NILP (AREF (prefer, FONT_WIDTH_INDEX))) | |
3275 FONT_SET_STYLE (prefer, FONT_WIDTH_INDEX, attrs[LFACE_SWIDTH_INDEX]); | |
95475
e1e8d6b9d465
(font_find_for_lface): Handle float font size.
Kenichi Handa <handa@m17n.org>
parents:
95437
diff
changeset
|
3276 ASET (prefer, FONT_SIZE_INDEX, make_number (pixel_size)); |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
3277 entities = font_sort_entites (entities, prefer, frame, c < 0); |
90400 | 3278 } |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
3279 if (c < 0) |
94926 | 3280 return entities; |
3281 | |
3282 for (i = 0; i < ASIZE (entities); i++) | |
3283 { | |
3284 int j; | |
3285 | |
3286 val = AREF (entities, i); | |
3287 if (i > 0) | |
3288 { | |
3289 for (j = FONT_FOUNDRY_INDEX; j <= FONT_REGISTRY_INDEX; j++) | |
3290 if (! EQ (AREF (val, j), props[j])) | |
3291 break; | |
3292 if (j > FONT_REGISTRY_INDEX) | |
3293 continue; | |
3294 } | |
3295 for (j = FONT_FOUNDRY_INDEX; j <= FONT_REGISTRY_INDEX; j++) | |
3296 props[j] = AREF (val, j); | |
3297 result = font_has_char (f, val, c); | |
3298 if (result > 0) | |
3299 return val; | |
3300 if (result == 0) | |
3301 return Qnil; | |
3302 val = font_open_for_lface (f, val, attrs, spec); | |
3303 if (NILP (val)) | |
3304 continue; | |
3305 result = font_has_char (f, val, c); | |
3306 font_close_object (f, val); | |
3307 if (result > 0) | |
3308 return AREF (entities, i); | |
3309 } | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
3310 return Qnil; |
90400 | 3311 } |
3312 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3313 |
90400 | 3314 Lisp_Object |
94926 | 3315 font_open_for_lface (f, entity, attrs, spec) |
90400 | 3316 FRAME_PTR f; |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3317 Lisp_Object entity; |
94926 | 3318 Lisp_Object *attrs; |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3319 Lisp_Object spec; |
90400 | 3320 { |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
3321 int size; |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
3322 |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3323 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
|
3324 && 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
|
3325 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
|
3326 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
|
3327 size = font_pixel_size (f, spec); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3328 else |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3329 { |
94926 | 3330 double pt = XINT (attrs[LFACE_HEIGHT_INDEX]); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3331 |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3332 pt /= 10; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3333 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
|
3334 #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
|
3335 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
|
3336 { |
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
|
3337 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
|
3338 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
|
3339 } |
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
|
3340 #endif |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
3341 } |
90400 | 3342 return font_open_entity (f, entity, size); |
3343 } | |
3344 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3345 |
94926 | 3346 /* Find a font satisfying SPEC and best matching with face's |
3347 attributes in ATTRS on FRAME, and return the opened | |
3348 font-object. */ | |
3349 | |
3350 Lisp_Object | |
3351 font_load_for_lface (f, attrs, spec) | |
90400 | 3352 FRAME_PTR f; |
94926 | 3353 Lisp_Object *attrs, spec; |
90400 | 3354 { |
94926 | 3355 Lisp_Object entity; |
3356 | |
3357 entity = font_find_for_lface (f, attrs, spec, -1); | |
3358 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
|
3359 { |
94926 | 3360 /* No font is listed for SPEC, but each font-backend may have |
3361 the different criteria about "font matching". So, try | |
3362 it. */ | |
3363 entity = font_matching_entity (f, attrs, spec); | |
3364 if (NILP (entity)) | |
3365 return Qnil; | |
91350
9673276f310c
(font_load_for_face): Handle the case that the font in
Kenichi Handa <handa@m17n.org>
parents:
91337
diff
changeset
|
3366 } |
94926 | 3367 return font_open_for_lface (f, entity, attrs, spec); |
90400 | 3368 } |
3369 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3370 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3371 /* 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
|
3372 |
90400 | 3373 void |
3374 font_prepare_for_face (f, face) | |
3375 FRAME_PTR f; | |
3376 struct face *face; | |
3377 { | |
94926 | 3378 if (face->font->driver->prepare_face) |
3379 face->font->driver->prepare_face (f, face); | |
90400 | 3380 } |
3381 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3382 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3383 /* 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
|
3384 |
90400 | 3385 void |
3386 font_done_for_face (f, face) | |
3387 FRAME_PTR f; | |
3388 struct face *face; | |
3389 { | |
94926 | 3390 if (face->font->driver->done_face) |
3391 face->font->driver->done_face (f, face); | |
90400 | 3392 face->extra = NULL; |
3393 } | |
3394 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3395 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3396 /* Open a font best matching with NAME on frame F. If no proper font |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3397 is found, return Qnil. */ |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3398 |
90400 | 3399 Lisp_Object |
3400 font_open_by_name (f, name) | |
3401 FRAME_PTR f; | |
3402 char *name; | |
3403 { | |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3404 Lisp_Object args[2]; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3405 Lisp_Object spec, attrs[LFACE_VECTOR_SIZE]; |
90476
017a6aec5d77
(font_parse_fcname): Fix parsing of point-size.
Kenichi Handa <handa@m17n.org>
parents:
90468
diff
changeset
|
3406 |
90468
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3407 args[0] = QCname; |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3408 args[1] = make_unibyte_string (name, strlen (name)); |
5424215feef6
(XLFD_SMALLNUM_MASK): Delete this macro.
Kenichi Handa <handa@m17n.org>
parents:
90451
diff
changeset
|
3409 spec = Ffont_spec (2, args); |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3410 /* 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
|
3411 a moderate font. */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3412 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
|
3413 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
|
3414 = 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
|
3415 #ifndef HAVE_NS |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3416 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
|
3417 #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
|
3418 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
|
3419 #endif |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3420 attrs[LFACE_FONT_INDEX] = Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3421 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3422 return font_load_for_lface (f, attrs, spec); |
90400 | 3423 } |
3424 | |
3425 | |
3426 /* Register font-driver DRIVER. This function is used in two ways. | |
3427 | |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3428 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
|
3429 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
|
3430 (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
|
3431 an available font-driver. |
90400 | 3432 |
3433 The second is with frame F NULL. In this case, DRIVER is globally | |
3434 registered in the variable `font_driver_list'. All font-driver | |
3435 implementations must call this function in its syms_of_XXXX | |
3436 (e.g. syms_of_xfont). */ | |
3437 | |
3438 void | |
3439 register_font_driver (driver, f) | |
3440 struct font_driver *driver; | |
3441 FRAME_PTR f; | |
3442 { | |
3443 struct font_driver_list *root = f ? f->font_driver_list : font_driver_list; | |
3444 struct font_driver_list *prev, *list; | |
3445 | |
3446 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
|
3447 error ("Unusable font driver for a frame: %s", |
90400 | 3448 SDATA (SYMBOL_NAME (driver->type))); |
3449 | |
3450 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
|
3451 if (EQ (list->driver->type, driver->type)) |
90400 | 3452 error ("Duplicated font driver: %s", SDATA (SYMBOL_NAME (driver->type))); |
3453 | |
3454 list = malloc (sizeof (struct font_driver_list)); | |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3455 list->on = 0; |
90400 | 3456 list->driver = driver; |
3457 list->next = NULL; | |
3458 if (prev) | |
3459 prev->next = list; | |
3460 else if (f) | |
3461 f->font_driver_list = list; | |
3462 else | |
3463 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
|
3464 if (! f) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
3465 num_font_drivers++; |
90400 | 3466 } |
3467 | |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3468 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3469 /* 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
|
3470 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
|
3471 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
|
3472 |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
3473 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
|
3474 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
|
3475 F. */ |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
3476 |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
3477 Lisp_Object |
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
3478 font_update_drivers (f, new_drivers) |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3479 FRAME_PTR f; |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3480 Lisp_Object new_drivers; |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3481 { |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3482 Lisp_Object active_drivers = Qnil; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3483 struct font_driver *driver; |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3484 struct font_driver_list *list; |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3485 |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3486 /* 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
|
3487 drivers. */ |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3488 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
|
3489 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3490 driver = list->driver; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3491 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
|
3492 != list->on) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3493 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3494 if (list->on) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3495 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3496 if (driver->end_for_frame) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3497 driver->end_for_frame (f); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3498 font_finish_cache (f, driver); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3499 list->on = 0; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3500 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3501 else |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3502 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3503 if (! driver->start_for_frame |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3504 || driver->start_for_frame (f) == 0) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3505 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3506 font_prepare_cache (f, driver); |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3507 list->on = 1; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3508 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3509 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3510 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3511 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3512 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3513 if (NILP (new_drivers)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3514 return Qnil; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3515 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3516 if (! EQ (new_drivers, Qt)) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3517 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3518 /* 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
|
3519 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
|
3520 Lisp_Object tail; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3521 int i; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3522 |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3523 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
|
3524 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
|
3525 { |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3526 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
|
3527 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
|
3528 break; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3529 if (list) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3530 list_table[i++] = list; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3531 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3532 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
|
3533 if (! list->on) |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3534 list_table[i] = list; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3535 list_table[i] = NULL; |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3536 |
95958
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3537 next = &f->font_driver_list; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3538 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
|
3539 { |
95958
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3540 *next = list_table[i]; |
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3541 next = &(*next)->next; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3542 } |
95958
fbdde312e09d
(font_update_drivers): Fix crash when no drivers match.
Andreas Schwab <schwab@suse.de>
parents:
95894
diff
changeset
|
3543 *next = NULL; |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3544 } |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3545 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3546 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
|
3547 if (list->on) |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3548 active_drivers = nconc2 (active_drivers, |
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
3549 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
|
3550 return active_drivers; |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3551 } |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3552 |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3553 int |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3554 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
|
3555 FRAME_PTR f; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3556 struct font_driver *driver; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3557 void *data; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3558 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3559 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
|
3560 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3561 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
|
3562 prev = list, list = list->next) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3563 if (list->driver == driver) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3564 break; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3565 if (! data) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3566 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3567 if (list) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3568 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3569 if (prev) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3570 prev->next = list->next; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3571 else |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3572 f->font_data_list = list->next; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3573 free (list); |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3574 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3575 return 0; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3576 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3577 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3578 if (! list) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3579 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3580 list = malloc (sizeof (struct font_data_list)); |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3581 if (! list) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3582 return -1; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3583 list->driver = driver; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3584 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
|
3585 f->font_data_list = list; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3586 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3587 list->data = data; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3588 return 0; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3589 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3590 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3591 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3592 void * |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3593 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
|
3594 FRAME_PTR f; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3595 struct font_driver *driver; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3596 { |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3597 struct font_data_list *list; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3598 |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3599 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
|
3600 if (list->driver == driver) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3601 break; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3602 if (! list) |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3603 return NULL; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3604 return list->data; |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3605 } |
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3606 |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
3607 |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3608 /* 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
|
3609 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
|
3610 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
|
3611 STRING. */ |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3612 |
90541 | 3613 Lisp_Object |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3614 font_at (c, pos, face, w, string) |
90541 | 3615 int c; |
3616 EMACS_INT pos; | |
3617 struct face *face; | |
3618 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
|
3619 Lisp_Object string; |
90541 | 3620 { |
3621 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
|
3622 int multibyte; |
94926 | 3623 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
|
3624 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3625 if (c < 0) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3626 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3627 if (NILP (string)) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3628 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3629 multibyte = ! NILP (current_buffer->enable_multibyte_characters); |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3630 if (multibyte) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3631 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3632 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
|
3633 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3634 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
|
3635 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3636 else |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3637 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
|
3638 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3639 else |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3640 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3641 unsigned char *str; |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3642 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3643 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
|
3644 if (multibyte) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3645 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3646 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
|
3647 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3648 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
|
3649 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
|
3650 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3651 else |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3652 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
|
3653 } |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3654 } |
90541 | 3655 |
3656 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
|
3657 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
|
3658 return Qnil; |
90541 | 3659 if (! face) |
3660 { | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3661 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
|
3662 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
|
3663 |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3664 if (STRINGP (string)) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3665 face_id = face_at_string_position (w, string, pos, 0, -1, -1, &endptr, |
90541 | 3666 DEFAULT_FACE_ID, 0); |
3667 else | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3668 face_id = face_at_buffer_position (w, pos, -1, -1, &endptr, |
90541 | 3669 pos + 100, 0); |
3670 face = FACE_FROM_ID (f, face_id); | |
3671 } | |
91236
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3672 if (multibyte) |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3673 { |
e3ba579aab1f
(font_at): Handle the case that the arg C is negative.
Kenichi Handa <handa@m17n.org>
parents:
91192
diff
changeset
|
3674 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
|
3675 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
|
3676 } |
94926 | 3677 if (! face->font) |
90541 | 3678 return Qnil; |
94926 | 3679 |
3680 XSETFONT (font_object, face->font); | |
3681 return font_object; | |
3682 } | |
3683 | |
3684 | |
97822 | 3685 #ifdef HAVE_WINDOW_SYSTEM |
3686 | |
3687 /* Check how many characters after POS (at most to *LIMIT) can be | |
3688 displayed by the same font on the window W. FACE, if non-NULL, is | |
3689 the face selected for the character at POS. If STRING is not nil, | |
3690 it is the string to check instead of the current buffer. In that | |
3691 case, FACE must be not NULL. | |
3692 | |
3693 The return value is the font-object for the character at POS. | |
3694 *LIMIT is set to the position where that font can't be used. | |
3695 | |
3696 It is assured that the current buffer (or STRING) is multibyte. */ | |
3697 | |
3698 Lisp_Object | |
3699 font_range (pos, limit, w, face, string) | |
3700 EMACS_INT pos, *limit; | |
3701 struct window *w; | |
94926 | 3702 struct face *face; |
3703 Lisp_Object string; | |
3704 { | |
97822 | 3705 EMACS_INT pos_byte, ignore, start, start_byte; |
94926 | 3706 int c; |
97822 | 3707 Lisp_Object font_object = Qnil; |
94926 | 3708 |
3709 if (NILP (string)) | |
3710 { | |
3711 pos_byte = CHAR_TO_BYTE (pos); | |
97822 | 3712 if (! face) |
3713 { | |
3714 int face_id; | |
3715 | |
3716 face_id = face_at_buffer_position (w, pos, 0, 0, &ignore, *limit, 0); | |
3717 face = FACE_FROM_ID (XFRAME (w->frame), face_id); | |
3718 } | |
94926 | 3719 } |
3720 else | |
3721 { | |
97822 | 3722 font_assert (face); |
94926 | 3723 pos_byte = string_char_to_byte (string, pos); |
3724 } | |
3725 | |
97822 | 3726 start = pos, start_byte = pos_byte; |
3727 while (pos < *limit) | |
94926 | 3728 { |
97822 | 3729 Lisp_Object category; |
94926 | 3730 |
3731 if (NILP (string)) | |
3732 FETCH_CHAR_ADVANCE_NO_CHECK (c, pos, pos_byte); | |
3733 else | |
3734 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, string, pos, pos_byte); | |
97822 | 3735 if (NILP (font_object)) |
94926 | 3736 { |
97822 | 3737 font_object = font_for_char (face, c, pos - 1, string); |
3738 if (NILP (font_object)) | |
3739 return Qnil; | |
94926 | 3740 continue; |
3741 } | |
97822 | 3742 |
3743 category = CHAR_TABLE_REF (Vunicode_category_table, c); | |
3744 if (! EQ (category, QCf) | |
3745 && font_encode_char (font_object, c) == FONT_INVALID_CODE) | |
94926 | 3746 { |
97822 | 3747 Lisp_Object f = font_for_char (face, c, pos - 1, string); |
3748 EMACS_INT i, i_byte; | |
3749 | |
3750 | |
3751 if (NILP (f)) | |
3752 { | |
3753 *limit = pos - 1; | |
3754 return font_object; | |
3755 } | |
3756 i = start, i_byte = start_byte; | |
3757 while (i < pos - 1) | |
3758 { | |
3759 | |
3760 if (NILP (string)) | |
3761 FETCH_CHAR_ADVANCE_NO_CHECK (c, i, i_byte); | |
3762 else | |
3763 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, string, i, i_byte); | |
3764 category = CHAR_TABLE_REF (Vunicode_category_table, c); | |
3765 if (! EQ (category, QCf) | |
3766 && font_encode_char (f, c) == FONT_INVALID_CODE) | |
3767 { | |
3768 *limit = pos - 1; | |
3769 return font_object; | |
3770 } | |
3771 } | |
3772 font_object = f; | |
94926 | 3773 } |
3774 } | |
97822 | 3775 return font_object; |
90541 | 3776 } |
97822 | 3777 #endif |
90541 | 3778 |
90400 | 3779 |
3780 /* Lisp API */ | |
3781 | |
94926 | 3782 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
|
3783 doc: /* Return t if OBJECT is a font-spec, font-entity, or font-object. |
94926 | 3784 Return nil otherwise. |
3785 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
|
3786 which kind of font it is. It must be one of `font-spec', `font-entity', |
94926 | 3787 `font-object'. */) |
3788 (object, extra_type) | |
3789 Lisp_Object object, extra_type; | |
90400 | 3790 { |
94926 | 3791 if (NILP (extra_type)) |
3792 return (FONTP (object) ? Qt : Qnil); | |
3793 if (EQ (extra_type, Qfont_spec)) | |
3794 return (FONT_SPEC_P (object) ? Qt : Qnil); | |
3795 if (EQ (extra_type, Qfont_entity)) | |
3796 return (FONT_ENTITY_P (object) ? Qt : Qnil); | |
3797 if (EQ (extra_type, Qfont_object)) | |
3798 return (FONT_OBJECT_P (object) ? Qt : Qnil); | |
3799 wrong_type_argument (intern ("font-extra-type"), extra_type); | |
90400 | 3800 } |
3801 | |
3802 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
|
3803 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
|
3804 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3805 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
|
3806 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
|
3807 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3808 `:family', `:weight', `:slant', `:width' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3809 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3810 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
|
3811 `set-face-attribute'. |
91081
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3812 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3813 `:foundry' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3814 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3815 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
|
3816 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3817 `:adstyle' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3818 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3819 VALUE must be a string or a symbol specifying the additional |
94926 | 3820 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
|
3821 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3822 `:registry' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3823 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3824 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
|
3825 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
|
3826 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3827 `:size' |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3828 |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3829 VALUE must be a non-negative integer or a floating point number |
94926 | 3830 specifying the font size. It specifies the font size in pixels |
91112
8042dbbb0419
(font_update_drivers): Call driver->start_for_frame and
Kenichi Handa <handa@m17n.org>
parents:
91081
diff
changeset
|
3831 (if 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
|
3832 |
c0401e586ca3
(Ffont_get): Return a symbol for :weight, :slant, and :width.
Kenichi Handa <handa@m17n.org>
parents:
96005
diff
changeset
|
3833 `:name' |
c0401e586ca3
(Ffont_get): Return a symbol for :weight, :slant, and :width.
Kenichi Handa <handa@m17n.org>
parents:
96005
diff
changeset
|
3834 |
96013
04be82e0cbd3
(Ffont_spec): Fix usage in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
96012
diff
changeset
|
3835 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
|
3836 usage: (font-spec ARGS ...) |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
3837 |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
3838 `:script' |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
3839 |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
3840 VALUE must be a symbol representing a script that the font must |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
3841 support. */) |
90400 | 3842 (nargs, args) |
3843 int nargs; | |
3844 Lisp_Object *args; | |
3845 { | |
94926 | 3846 Lisp_Object spec = font_make_spec (); |
90400 | 3847 int i; |
3848 | |
3849 for (i = 0; i < nargs; i += 2) | |
3850 { | |
3851 Lisp_Object key = args[i], val = args[i + 1]; | |
3852 | |
94926 | 3853 if (EQ (key, QCname)) |
3854 { | |
3855 CHECK_STRING (val); | |
3856 font_parse_name ((char *) SDATA (val), spec); | |
3857 font_put_extra (spec, key, val); | |
3858 } | |
90400 | 3859 else |
90451
6ffc9b378367
(enum xlfd_field_index): Rename XLFD_XXX_SIZE_INDEX to
Kenichi Handa <handa@m17n.org>
parents:
90448
diff
changeset
|
3860 { |
94926 | 3861 int idx = get_font_prop_index (key); |
3862 | |
3863 if (idx >= 0) | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
3864 { |
94926 | 3865 val = font_prop_validate (idx, Qnil, val); |
3866 if (idx < FONT_EXTRA_INDEX) | |
3867 ASET (spec, idx, val); | |
3868 else | |
3869 font_put_extra (spec, key, val); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
3870 } |
94926 | 3871 else |
3872 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
|
3873 } |
90563
7c29515f7c2a
(font_parse_fcname): Don't change :name property of FONT.
Kenichi Handa <handa@m17n.org>
parents:
90556
diff
changeset
|
3874 } |
90400 | 3875 return spec; |
3876 } | |
3877 | |
94926 | 3878 DEFUN ("copy-font-spec", Fcopy_font_spec, Scopy_font_spec, 1, 1, 0, |
3879 doc: /* Return a copy of FONT as a font-spec. */) | |
3880 (font) | |
3881 Lisp_Object font; | |
3882 { | |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
3883 Lisp_Object new_spec, tail, prev, extra; |
94926 | 3884 int i; |
3885 | |
3886 CHECK_FONT (font); | |
3887 new_spec = font_make_spec (); | |
3888 for (i = 1; i < FONT_EXTRA_INDEX; i++) | |
3889 ASET (new_spec, i, AREF (font, i)); | |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
3890 extra = Fcopy_sequence (AREF (font, FONT_EXTRA_INDEX)); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
3891 /* We must remove :font-entity property. */ |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
3892 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
|
3893 if (EQ (XCAR (XCAR (tail)), QCfont_entity)) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
3894 { |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
3895 if (NILP (prev)) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
3896 extra = XCDR (extra); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
3897 else |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
3898 XSETCDR (prev, XCDR (tail)); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
3899 break; |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
3900 } |
94926 | 3901 ASET (new_spec, FONT_EXTRA_INDEX, extra); |
3902 return new_spec; | |
3903 } | |
3904 | |
3905 DEFUN ("merge-font-spec", Fmerge_font_spec, Smerge_font_spec, 2, 2, 0, | |
3906 doc: /* Merge font-specs FROM and TO, and return a new font-spec. | |
3907 Every specified properties in FROM override the corresponding | |
3908 properties in TO. */) | |
3909 (from, to) | |
3910 Lisp_Object from, to; | |
3911 { | |
3912 Lisp_Object extra, tail; | |
3913 int i; | |
3914 | |
3915 CHECK_FONT (from); | |
3916 CHECK_FONT (to); | |
3917 to = Fcopy_font_spec (to); | |
3918 for (i = 0; i < FONT_EXTRA_INDEX; i++) | |
3919 ASET (to, i, AREF (from, i)); | |
3920 extra = AREF (to, FONT_EXTRA_INDEX); | |
3921 for (tail = AREF (from, FONT_EXTRA_INDEX); CONSP (tail); tail = XCDR (tail)) | |
3922 if (! EQ (XCAR (XCAR (tail)), Qfont_entity)) | |
3923 { | |
3924 Lisp_Object slot = assq_no_quit (XCAR (XCAR (tail)), extra); | |
3925 | |
3926 if (! NILP (slot)) | |
3927 XSETCDR (slot, XCDR (XCAR (tail))); | |
3928 else | |
3929 extra = Fcons (Fcons (XCAR (XCAR (tail)), XCDR (XCAR (tail))), extra); | |
3930 } | |
3931 ASET (to, FONT_EXTRA_INDEX, extra); | |
3932 return to; | |
3933 } | |
90400 | 3934 |
3935 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
|
3936 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
|
3937 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
|
3938 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
|
3939 :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
|
3940 :size, :name, :script |
3172ff476053
(font_match_p): Fix for the case that a vector of
Kenichi Handa <handa@m17n.org>
parents:
99072
diff
changeset
|
3941 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
|
3942 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
|
3943 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
|
3944 (font, key) |
2c767d9f0bb1
(font_prop_validate_symbol): The argument prop_index is
Kenichi Handa <handa@m17n.org>
parents:
90993
diff
changeset
|
3945 Lisp_Object font, key; |
90400 | 3946 { |
94926 | 3947 int idx; |
3948 | |
3949 CHECK_FONT (font); | |
3950 CHECK_SYMBOL (key); | |
3951 | |
3952 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
|
3953 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
|
3954 return font_style_symbolic (font, idx, 0); |
94926 | 3955 if (idx >= 0 && idx < FONT_EXTRA_INDEX) |
90400 | 3956 return AREF (font, idx); |
94926 | 3957 return Fcdr (Fassq (key, AREF (font, FONT_EXTRA_INDEX))); |
90400 | 3958 } |
3959 | |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
3960 #ifdef HAVE_WINDOW_SYSTEM |
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
3961 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3962 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
|
3963 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
|
3964 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
|
3965 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
|
3966 |
96012
c04088bb7b0d
(Ffont_face_attributes): Fix definition.
Andreas Schwab <schwab@suse.de>
parents:
96010
diff
changeset
|
3967 \(: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
|
3968 |
96014
f4a50aac009c
(Ffont_face_attributes): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
96013
diff
changeset
|
3969 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
|
3970 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
|
3971 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
|
3972 |
f4a50aac009c
(Ffont_face_attributes): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
96013
diff
changeset
|
3973 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
|
3974 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
|
3975 (font, frame) |
96012
c04088bb7b0d
(Ffont_face_attributes): Fix definition.
Andreas Schwab <schwab@suse.de>
parents:
96010
diff
changeset
|
3976 Lisp_Object font, frame; |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3977 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3978 struct frame *f; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3979 Lisp_Object plist[10]; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3980 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
|
3981 int n = 0; |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3982 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3983 if (NILP (frame)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3984 frame = selected_frame; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3985 CHECK_LIVE_FRAME (frame); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3986 f = XFRAME (frame); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3987 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3988 if (STRINGP (font)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3989 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3990 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
|
3991 Lisp_Object name = font; |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3992 if (fontset >= 0) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3993 font = fontset_ascii (fontset); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3994 font = font_spec_from_name (name); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3995 if (! FONTP (font)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3996 signal_error ("Invalid font name", name); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3997 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3998 else if (! FONTP (font)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
3999 signal_error ("Invalid font object", font); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4000 |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4001 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
|
4002 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4003 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4004 plist[n++] = QCfamily; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4005 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
|
4006 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4007 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4008 val = AREF (font, FONT_SIZE_INDEX); |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4009 if (INTEGERP (val)) |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4010 { |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4011 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
|
4012 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
|
4013 plist[n++] = QCheight; |
96227
f9eb9f0d6678
(Ffont_face_attributes): Multiply pixel size before point
Jason Rumney <jasonr@gnu.org>
parents:
96224
diff
changeset
|
4014 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
|
4015 } |
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4016 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
|
4017 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4018 plist[n++] = QCheight; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4019 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
|
4020 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4021 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4022 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
|
4023 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4024 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4025 plist[n++] = QCweight; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4026 plist[n++] = val; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4027 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4028 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4029 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
|
4030 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4031 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4032 plist[n++] = QCslant; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4033 plist[n++] = val; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4034 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4035 |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4036 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
|
4037 if (! NILP (val)) |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4038 { |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4039 plist[n++] = QCwidth; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4040 plist[n++] = val; |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4041 } |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4042 |
73e422173a87
(Ffont_face_attributes): Omit key-attribute pairs not defined by the
Chong Yidong <cyd@stupidchicken.com>
parents:
96077
diff
changeset
|
4043 return Flist (n, plist); |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4044 } |
90400 | 4045 |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4046 #endif |
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4047 |
90400 | 4048 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
|
4049 doc: /* Set one property of FONT-SPEC: give property PROP value VAL. */) |
90400 | 4050 (font_spec, prop, val) |
4051 Lisp_Object font_spec, prop, val; | |
4052 { | |
94926 | 4053 int idx; |
90400 | 4054 |
4055 CHECK_FONT_SPEC (font_spec); | |
94926 | 4056 idx = get_font_prop_index (prop); |
4057 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
|
4058 ASET (font_spec, idx, font_prop_validate (idx, Qnil, val)); |
90400 | 4059 else |
94926 | 4060 font_put_extra (font_spec, prop, font_prop_validate (0, prop, val)); |
90400 | 4061 return val; |
4062 } | |
4063 | |
4064 DEFUN ("list-fonts", Flist_fonts, Slist_fonts, 1, 4, 0, | |
4065 doc: /* List available fonts matching FONT-SPEC on the current frame. | |
4066 Optional 2nd argument FRAME specifies the target frame. | |
4067 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
|
4068 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
|
4069 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
|
4070 how close they are to PREFER. */) |
90400 | 4071 (font_spec, frame, num, prefer) |
4072 Lisp_Object font_spec, frame, num, prefer; | |
4073 { | |
4074 Lisp_Object vec, list, tail; | |
4075 int n = 0, i, len; | |
4076 | |
4077 if (NILP (frame)) | |
4078 frame = selected_frame; | |
4079 CHECK_LIVE_FRAME (frame); | |
94926 | 4080 CHECK_FONT_SPEC (font_spec); |
90400 | 4081 if (! NILP (num)) |
4082 { | |
4083 CHECK_NUMBER (num); | |
4084 n = XINT (num); | |
4085 if (n <= 0) | |
4086 return Qnil; | |
4087 } | |
4088 if (! NILP (prefer)) | |
94926 | 4089 CHECK_FONT_SPEC (prefer); |
90400 | 4090 |
4091 vec = font_list_entities (frame, font_spec); | |
4092 len = ASIZE (vec); | |
4093 if (len == 0) | |
4094 return Qnil; | |
4095 if (len == 1) | |
4096 return Fcons (AREF (vec, 0), Qnil); | |
4097 | |
4098 if (! NILP (prefer)) | |
96262
31a398897576
(font_parse_fcname): Remove unused variables.
Kenichi Handa <handa@m17n.org>
parents:
96227
diff
changeset
|
4099 vec = font_sort_entites (vec, prefer, frame, 0); |
90400 | 4100 |
4101 list = tail = Fcons (AREF (vec, 0), Qnil); | |
4102 if (n == 0 || n > len) | |
4103 n = len; | |
4104 for (i = 1; i < n; i++) | |
4105 { | |
4106 Lisp_Object val = Fcons (AREF (vec, i), Qnil); | |
4107 | |
4108 XSETCDR (tail, val); | |
4109 tail = val; | |
4110 } | |
4111 return list; | |
4112 } | |
4113 | |
94926 | 4114 DEFUN ("font-family-list", Ffont_family_list, Sfont_family_list, 0, 1, 0, |
90400 | 4115 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
|
4116 Optional argument FRAME, if non-nil, specifies the target frame. */) |
90400 | 4117 (frame) |
4118 Lisp_Object frame; | |
4119 { | |
4120 FRAME_PTR f; | |
4121 struct font_driver_list *driver_list; | |
4122 Lisp_Object list; | |
4123 | |
4124 if (NILP (frame)) | |
4125 frame = selected_frame; | |
4126 CHECK_LIVE_FRAME (frame); | |
4127 f = XFRAME (frame); | |
4128 list = Qnil; | |
4129 for (driver_list = f->font_driver_list; driver_list; | |
4130 driver_list = driver_list->next) | |
4131 if (driver_list->driver->list_family) | |
4132 { | |
4133 Lisp_Object val = driver_list->driver->list_family (frame); | |
4134 | |
4135 if (NILP (list)) | |
4136 list = val; | |
4137 else | |
4138 { | |
4139 Lisp_Object tail = list; | |
4140 | |
4141 for (; CONSP (val); val = XCDR (val)) | |
4142 if (NILP (Fmemq (XCAR (val), tail))) | |
4143 list = Fcons (XCAR (val), list); | |
4144 } | |
4145 } | |
4146 return list; | |
4147 } | |
4148 | |
4149 DEFUN ("find-font", Ffind_font, Sfind_font, 1, 2, 0, | |
4150 doc: /* Return a font-entity matching with FONT-SPEC on the current frame. | |
4151 Optional 2nd argument FRAME, if non-nil, specifies the target frame. */) | |
4152 (font_spec, frame) | |
4153 Lisp_Object font_spec, frame; | |
4154 { | |
4155 Lisp_Object val = Flist_fonts (font_spec, frame, make_number (1), Qnil); | |
4156 | |
4157 if (CONSP (val)) | |
4158 val = XCAR (val); | |
4159 return val; | |
4160 } | |
4161 | |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4162 DEFUN ("font-xlfd-name", Ffont_xlfd_name, Sfont_xlfd_name, 1, 2, 0, |
90400 | 4163 doc: /* Return XLFD name of FONT. |
4164 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
|
4165 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
|
4166 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
|
4167 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
|
4168 (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
|
4169 Lisp_Object font, fold_wildcards; |
90400 | 4170 { |
4171 char name[256]; | |
4172 int pixel_size = 0; | |
4173 | |
94926 | 4174 CHECK_FONT (font); |
4175 | |
4176 if (FONT_OBJECT_P (font)) | |
90400 | 4177 { |
94926 | 4178 Lisp_Object font_name = AREF (font, FONT_NAME_INDEX); |
4179 | |
4180 if (STRINGP (font_name) | |
4181 && 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
|
4182 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4183 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
|
4184 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
|
4185 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
|
4186 goto done; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4187 } |
94926 | 4188 pixel_size = XFONT_OBJECT (font)->pixel_size; |
90400 | 4189 } |
4190 if (font_unparse_xlfd (font, pixel_size, name, 256) < 0) | |
4191 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
|
4192 done: |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4193 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
|
4194 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4195 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
|
4196 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4197 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
|
4198 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4199 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
|
4200 p0 = p1; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4201 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4202 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4203 |
90400 | 4204 return build_string (name); |
4205 } | |
4206 | |
4207 DEFUN ("clear-font-cache", Fclear_font_cache, Sclear_font_cache, 0, 0, 0, | |
4208 doc: /* Clear font cache. */) | |
4209 () | |
4210 { | |
4211 Lisp_Object list, frame; | |
4212 | |
4213 FOR_EACH_FRAME (list, frame) | |
4214 { | |
4215 FRAME_PTR f = XFRAME (frame); | |
4216 struct font_driver_list *driver_list = f->font_driver_list; | |
4217 | |
4218 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
|
4219 if (driver_list->on) |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4220 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4221 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
|
4222 Lisp_Object val; |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4223 |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4224 val = XCDR (cache); |
91909 | 4225 while (! NILP (val) |
4226 && ! 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
|
4227 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
|
4228 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
|
4229 val = XCDR (XCAR (val)); |
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4230 if (XINT (XCAR (val)) == 0) |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4231 { |
91247
217eabc2db11
(font_prepare_cache, font_finish_cache, font_get_cache): New
Kenichi Handa <handa@m17n.org>
parents:
91240
diff
changeset
|
4232 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
|
4233 XSETCDR (cache, XCDR (val)); |
90549
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4234 } |
5dab62a4573c
(font_unparse_fcname): Fix typo (swidth->width).
Kenichi Handa <handa@m17n.org>
parents:
90541
diff
changeset
|
4235 } |
90400 | 4236 } |
4237 | |
4238 return Qnil; | |
4239 } | |
4240 | |
97822 | 4241 |
4242 void | |
4243 font_fill_lglyph_metrics (glyph, font_object) | |
4244 Lisp_Object glyph, font_object; | |
90400 | 4245 { |
97822 | 4246 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
|
4247 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
|
4248 /* 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
|
4249 EMACS_INT ecode = font->driver->encode_char (font, LGLYPH_CHAR (glyph)); |
97822 | 4250 struct font_metrics metrics; |
4251 | |
97853
fa1023e4960c
(font_fill_lglyph_metrics): Use EMACS_INT in LGLYPH_SET_CODE to avoid
Eli Zaretskii <eliz@gnu.org>
parents:
97822
diff
changeset
|
4252 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
|
4253 code = ecode; |
97822 | 4254 font->driver->text_extents (font, &code, 1, &metrics); |
4255 LGLYPH_SET_LBEARING (glyph, metrics.lbearing); | |
4256 LGLYPH_SET_RBEARING (glyph, metrics.rbearing); | |
4257 LGLYPH_SET_WIDTH (glyph, metrics.width); | |
4258 LGLYPH_SET_ASCENT (glyph, metrics.ascent); | |
4259 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
|
4260 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4261 |
97822 | 4262 |
4263 DEFUN ("font-shape-gstring", Ffont_shape_gstring, Sfont_shape_gstring, 1, 1, 0, | |
4264 doc: /* Shape the glyph-string GSTRING. | |
4265 Shaping means substituting glyphs and/or adjusting positions of glyphs | |
4266 to get the correct visual image of character sequences set in the | |
4267 header of the glyph-string. | |
4268 | |
4269 If the shaping was successful, the value is GSTRING itself or a newly | |
4270 created glyph-string. Otherwise, the value is nil. */) | |
4271 (gstring) | |
4272 Lisp_Object gstring; | |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4273 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4274 struct font *font; |
97822 | 4275 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
|
4276 int i, j, from, to; |
97822 | 4277 |
4278 if (! composition_gstring_p (gstring)) | |
4279 signal_error ("Invalid glyph-string: ", gstring); | |
4280 if (! NILP (LGSTRING_ID (gstring))) | |
4281 return gstring; | |
4282 font_object = LGSTRING_FONT (gstring); | |
4283 CHECK_FONT_OBJECT (font_object); | |
94926 | 4284 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
|
4285 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
|
4286 return Qnil; |
275e5e980fc4
If the font driver doesn't have `shape' function, return Qnil.
Kenichi Handa <handa@m17n.org>
parents:
92113
diff
changeset
|
4287 |
91273
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4288 /* 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
|
4289 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
|
4290 { |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4291 n = font->driver->shape (gstring); |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4292 if (INTEGERP (n)) |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4293 break; |
97822 | 4294 gstring = larger_vector (gstring, |
4295 ASIZE (gstring) + LGSTRING_GLYPH_LEN (gstring), | |
4296 Qnil); | |
91273
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4297 } |
97822 | 4298 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
|
4299 return Qnil; |
97822 | 4300 |
4301 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
|
4302 from = LGLYPH_FROM (glyph); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4303 to = LGLYPH_TO (glyph); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4304 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
|
4305 { |
97822 | 4306 Lisp_Object this = LGSTRING_GLYPH (gstring, i); |
4307 | |
4308 if (NILP (this)) | |
4309 break; | |
4310 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
|
4311 { |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4312 if (j < i - 1) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4313 for (; j < i; j++) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4314 { |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4315 glyph = LGSTRING_GLYPH (gstring, j); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4316 LGLYPH_SET_FROM (glyph, from); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4317 LGLYPH_SET_TO (glyph, to); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4318 } |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4319 from = LGLYPH_FROM (this); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4320 to = LGLYPH_TO (this); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4321 j = i; |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4322 } |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4323 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4324 { |
98124
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4325 if (from > LGLYPH_FROM (this)) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4326 from = LGLYPH_FROM (this); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4327 if (to < LGLYPH_TO (this)) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4328 to = LGLYPH_TO (this); |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4329 } |
90541 | 4330 } |
98124
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4331 if (j < i - 1) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4332 for (; j < i; j++) |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4333 { |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4334 glyph = LGSTRING_GLYPH (gstring, j); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4335 LGLYPH_SET_FROM (glyph, from); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4336 LGLYPH_SET_TO (glyph, to); |
629cccd78d85
(Ffont_shape_gstring): Make glyphs of non-nil adjustment
Kenichi Handa <handa@m17n.org>
parents:
97853
diff
changeset
|
4337 } |
97822 | 4338 return composition_gstring_put_cache (gstring, XINT (n)); |
90400 | 4339 } |
4340 | |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4341 #if 0 |
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4342 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4343 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
|
4344 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
|
4345 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
|
4346 (SCRIPT LANGSYS GSUB GPOS) |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4347 where |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4348 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
|
4349 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
|
4350 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
|
4351 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4352 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
|
4353 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4354 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
|
4355 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
|
4356 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
|
4357 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
|
4358 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
|
4359 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4360 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
|
4361 the glyph-string GSTRING-IN. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4362 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4363 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
|
4364 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
|
4365 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
|
4366 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4367 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
|
4368 the value is 0. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4369 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4370 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
|
4371 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
|
4372 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4373 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
|
4374 glyph-string. */) |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4375 (otf_features, gstring_in, from, to, gstring_out, index) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4376 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
|
4377 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4378 Lisp_Object font_object = LGSTRING_FONT (gstring_in); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4379 Lisp_Object val; |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4380 struct font *font; |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4381 int len, num; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4382 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4383 check_otf_features (otf_features); |
94926 | 4384 CHECK_FONT_OBJECT (font_object); |
4385 font = XFONT_OBJECT (font_object); | |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4386 if (! font->driver->otf_drive) |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4387 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
|
4388 SDATA (SYMBOL_NAME (font->driver->type))); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4389 CHECK_CONS (otf_features); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4390 CHECK_SYMBOL (XCAR (otf_features)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4391 val = XCDR (otf_features); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4392 CHECK_SYMBOL (XCAR (val)); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4393 val = XCDR (otf_features); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4394 if (! NILP (val)) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4395 CHECK_CONS (val); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4396 len = check_gstring (gstring_in); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4397 CHECK_VECTOR (gstring_out); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4398 CHECK_NATNUM (from); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4399 CHECK_NATNUM (to); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4400 CHECK_NATNUM (index); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4401 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4402 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
|
4403 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
|
4404 if (XINT (index) >= ASIZE (gstring_out)) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4405 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
|
4406 num = font->driver->otf_drive (font, otf_features, |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4407 gstring_in, XINT (from), XINT (to), |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4408 gstring_out, XINT (index), 0); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4409 if (num < 0) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4410 return Qnil; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4411 return make_number (num); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4412 } |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4413 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4414 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
|
4415 3, 3, 0, |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4416 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
|
4417 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
|
4418 in this format: |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4419 (SCRIPT LANGSYS FEATURE ...) |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4420 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
|
4421 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4422 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
|
4423 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
|
4424 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
|
4425 corresponding character. */) |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4426 (font_object, character, otf_features) |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4427 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
|
4428 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4429 struct font *font; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4430 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
|
4431 Lisp_Object alternates; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4432 int i, num; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4433 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4434 CHECK_FONT_GET_OBJECT (font_object, font); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4435 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
|
4436 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
|
4437 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
|
4438 CHECK_CHARACTER (character); |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4439 CHECK_CONS (otf_features); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4440 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4441 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
|
4442 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
|
4443 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
|
4444 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
|
4445 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
|
4446 gstring_out, 0, 1)) < 0) |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4447 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
|
4448 make_number (ASIZE (gstring_out) * 2)); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4449 alternates = Qnil; |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4450 for (i = 0; i < num; i++) |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4451 { |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4452 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
|
4453 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
|
4454 unsigned code = LGLYPH_CODE (g); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4455 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4456 alternates = Fcons (Fcons (make_number (code), |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4457 c > 0 ? make_number (c) : Qnil), |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4458 alternates); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4459 } |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4460 return Fnreverse (alternates); |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4461 } |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4462 #endif /* 0 */ |
90400 | 4463 |
4464 #ifdef FONT_DEBUG | |
4465 | |
4466 DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0, | |
4467 doc: /* Open FONT-ENTITY. */) | |
4468 (font_entity, size, frame) | |
4469 Lisp_Object font_entity; | |
4470 Lisp_Object size; | |
4471 Lisp_Object frame; | |
4472 { | |
4473 int isize; | |
4474 | |
4475 CHECK_FONT_ENTITY (font_entity); | |
4476 if (NILP (frame)) | |
4477 frame = selected_frame; | |
4478 CHECK_LIVE_FRAME (frame); | |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4479 |
94926 | 4480 if (NILP (size)) |
4481 isize = XINT (AREF (font_entity, FONT_SIZE_INDEX)); | |
4482 else | |
4483 { | |
4484 CHECK_NUMBER_OR_FLOAT (size); | |
4485 if (FLOATP (size)) | |
4486 isize = POINT_TO_PIXEL (- isize, XFRAME (frame)->resy); | |
4487 else | |
4488 isize = XINT (size); | |
4489 if (isize == 0) | |
4490 isize = 120; | |
4491 } | |
90400 | 4492 return font_open_entity (XFRAME (frame), font_entity, isize); |
4493 } | |
4494 | |
4495 DEFUN ("close-font", Fclose_font, Sclose_font, 1, 2, 0, | |
4496 doc: /* Close FONT-OBJECT. */) | |
4497 (font_object, frame) | |
4498 Lisp_Object font_object, frame; | |
4499 { | |
4500 CHECK_FONT_OBJECT (font_object); | |
4501 if (NILP (frame)) | |
4502 frame = selected_frame; | |
4503 CHECK_LIVE_FRAME (frame); | |
4504 font_close_object (XFRAME (frame), font_object); | |
4505 return Qnil; | |
4506 } | |
4507 | |
4508 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
|
4509 doc: /* Return information about FONT-OBJECT. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4510 The value is a vector: |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4511 [ 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
|
4512 CAPABILITY ] |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4513 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4514 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
|
4515 provide a name). |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4516 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4517 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
|
4518 doesn't provide a file name). |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4519 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4520 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
|
4521 |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
4522 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
|
4523 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4524 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
|
4525 pixels. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4526 |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4527 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
|
4528 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
|
4529 remaining elements describe the details of the font capability. |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4530 |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4531 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
|
4532 \(opentype GSUB GPOS) |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4533 where GSUB shows which "GSUB" features the font supports, and GPOS |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4534 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
|
4535 lists of the format: |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4536 \((SCRIPT (LANGSYS FEATURE ...) ...) ...) |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4537 |
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4538 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
|
4539 one. |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4540 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4541 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
|
4542 |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4543 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
|
4544 representing the default langsys. |
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
4545 |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4546 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
|
4547 |
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4548 If the font is not OpenType font, CAPABILITY is nil. */) |
90400 | 4549 (font_object) |
4550 Lisp_Object font_object; | |
4551 { | |
4552 struct font *font; | |
4553 Lisp_Object val; | |
4554 | |
4555 CHECK_FONT_GET_OBJECT (font_object, font); | |
4556 | |
4557 val = Fmake_vector (make_number (9), Qnil); | |
94926 | 4558 ASET (val, 0, AREF (font_object, FONT_NAME_INDEX)); |
4559 ASET (val, 1, AREF (font_object, FONT_FILE_INDEX)); | |
90400 | 4560 ASET (val, 2, make_number (font->pixel_size)); |
94926 | 4561 ASET (val, 3, make_number (font->max_width)); |
90400 | 4562 ASET (val, 4, make_number (font->ascent)); |
4563 ASET (val, 5, make_number (font->descent)); | |
94926 | 4564 ASET (val, 6, make_number (font->space_width)); |
4565 ASET (val, 7, make_number (font->average_width)); | |
90400 | 4566 if (font->driver->otf_capability) |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4567 ASET (val, 8, Fcons (Qopentype, font->driver->otf_capability (font))); |
90400 | 4568 return val; |
4569 } | |
4570 | |
4571 DEFUN ("get-font-glyphs", Fget_font_glyphs, Sget_font_glyphs, 2, 2, 0, | |
4572 doc: /* Return a vector of glyphs of FONT-OBJECT for drawing STRING. | |
4573 Each element is a vector [GLYPH-CODE LBEARING RBEARING WIDTH ASCENT DESCENT]. */) | |
4574 (font_object, string) | |
4575 Lisp_Object font_object, string; | |
4576 { | |
4577 struct font *font; | |
4578 int i, len; | |
4579 Lisp_Object vec; | |
4580 | |
4581 CHECK_FONT_GET_OBJECT (font_object, font); | |
4582 CHECK_STRING (string); | |
4583 len = SCHARS (string); | |
4584 vec = Fmake_vector (make_number (len), Qnil); | |
4585 for (i = 0; i < len; i++) | |
4586 { | |
4587 Lisp_Object ch = Faref (string, make_number (i)); | |
4588 Lisp_Object val; | |
4589 int c = XINT (ch); | |
4590 unsigned code; | |
91871
436548f01688
(Ffont_fill_gstring, Fget_font_glyphs): Fix compilation warnings.
Eli Zaretskii <eliz@gnu.org>
parents:
91553
diff
changeset
|
4591 EMACS_INT cod; |
90400 | 4592 struct font_metrics metrics; |
4593 | |
91871
436548f01688
(Ffont_fill_gstring, Fget_font_glyphs): Fix compilation warnings.
Eli Zaretskii <eliz@gnu.org>
parents:
91553
diff
changeset
|
4594 cod = code = font->driver->encode_char (font, c); |
90400 | 4595 if (code == FONT_INVALID_CODE) |
4596 continue; | |
4597 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
|
4598 if (cod <= MOST_POSITIVE_FIXNUM) |
90400 | 4599 ASET (val, 0, make_number (code)); |
4600 else | |
4601 ASET (val, 0, Fcons (make_number (code >> 16), | |
4602 make_number (code & 0xFFFF))); | |
92233
3642a8778bbf
(Ffont_spec, Ffont_at): Fix typos in docstrings.
Juanma Barranquero <lekktu@gmail.com>
parents:
92183
diff
changeset
|
4603 font->driver->text_extents (font, &code, 1, &metrics); |
90400 | 4604 ASET (val, 1, make_number (metrics.lbearing)); |
4605 ASET (val, 2, make_number (metrics.rbearing)); | |
4606 ASET (val, 3, make_number (metrics.width)); | |
4607 ASET (val, 4, make_number (metrics.ascent)); | |
4608 ASET (val, 5, make_number (metrics.descent)); | |
4609 ASET (vec, i, val); | |
4610 } | |
4611 return vec; | |
4612 } | |
4613 | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4614 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
|
4615 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
|
4616 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
|
4617 (spec, font) |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4618 Lisp_Object spec, font; |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4619 { |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4620 CHECK_FONT_SPEC (spec); |
94926 | 4621 CHECK_FONT (font); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4622 |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4623 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
|
4624 } |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4625 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4626 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
|
4627 doc: /* Return a font-object for displaying a character at POSITION. |
90541 | 4628 Optional second arg WINDOW, if non-nil, is a window displaying |
4629 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
|
4630 (position, window, string) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4631 Lisp_Object position, window, string; |
90541 | 4632 { |
4633 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
|
4634 EMACS_INT pos; |
90541 | 4635 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4636 if (NILP (string)) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4637 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4638 CHECK_NUMBER_COERCE_MARKER (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4639 pos = XINT (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4640 if (pos < BEGV || pos >= ZV) |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4641 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
|
4642 } |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4643 else |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4644 { |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4645 CHECK_NUMBER (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4646 CHECK_STRING (string); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4647 pos = XINT (position); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4648 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
|
4649 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
|
4650 } |
90541 | 4651 if (NILP (window)) |
4652 window = selected_window; | |
4653 CHECK_LIVE_WINDOW (window); | |
91273
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4654 w = XWINDOW (window); |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4655 |
f19e3a3100e2
(Ffont_fill_gstring): Stop filling when a character not
Kenichi Handa <handa@m17n.org>
parents:
91267
diff
changeset
|
4656 return font_at (-1, pos, NULL, w, string); |
90541 | 4657 } |
4658 | |
90400 | 4659 #if 0 |
4660 DEFUN ("draw-string", Fdraw_string, Sdraw_string, 2, 2, 0, | |
4661 doc: /* Draw STRING by FONT-OBJECT on the top left corner of the current frame. | |
4662 The value is a number of glyphs drawn. | |
4663 Type C-l to recover what previously shown. */) | |
4664 (font_object, string) | |
4665 Lisp_Object font_object, string; | |
4666 { | |
4667 Lisp_Object frame = selected_frame; | |
4668 FRAME_PTR f = XFRAME (frame); | |
4669 struct font *font; | |
4670 struct face *face; | |
4671 int i, len, width; | |
4672 unsigned *code; | |
4673 | |
4674 CHECK_FONT_GET_OBJECT (font_object, font); | |
4675 CHECK_STRING (string); | |
4676 len = SCHARS (string); | |
4677 code = alloca (sizeof (unsigned) * len); | |
4678 for (i = 0; i < len; i++) | |
4679 { | |
4680 Lisp_Object ch = Faref (string, make_number (i)); | |
4681 Lisp_Object val; | |
4682 int c = XINT (ch); | |
4683 | |
4684 code[i] = font->driver->encode_char (font, c); | |
4685 if (code[i] == FONT_INVALID_CODE) | |
4686 break; | |
4687 } | |
4688 face = FACE_FROM_ID (f, DEFAULT_FACE_ID); | |
4689 face->fontp = font; | |
4690 if (font->driver->prepare_face) | |
4691 font->driver->prepare_face (f, face); | |
4692 width = font->driver->text_extents (font, code, i, NULL); | |
4693 len = font->driver->draw_text (f, face, 0, font->ascent, code, i, width); | |
4694 if (font->driver->done_face) | |
4695 font->driver->done_face (f, face); | |
4696 face->fontp = NULL; | |
4697 return make_number (len); | |
4698 } | |
4699 #endif | |
4700 | |
4701 #endif /* FONT_DEBUG */ | |
4702 | |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
4703 #ifdef HAVE_WINDOW_SYSTEM |
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
4704 |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4705 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
|
4706 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
|
4707 If FRAME is omitted or nil, use the selected frame. |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4708 The returned value is a vector of OPENED-NAME, FULL-NAME, CHARSET, SIZE, |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4709 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
|
4710 where |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4711 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
|
4712 FULL-NAME is the full name of the font, |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4713 SIZE is the maximum bound width of the font, |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4714 HEIGHT is the height of the font, |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4715 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
|
4716 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
|
4717 how to compose characters. |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4718 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
|
4719 (name, frame) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4720 Lisp_Object name, frame; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4721 { |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4722 FRAME_PTR f; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4723 struct font *font; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4724 Lisp_Object info; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4725 Lisp_Object font_object; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4726 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4727 (*check_window_system_func) (); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4728 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4729 if (! FONTP (name)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4730 CHECK_STRING (name); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4731 if (NILP (frame)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4732 frame = selected_frame; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4733 CHECK_LIVE_FRAME (frame); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4734 f = XFRAME (frame); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4735 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4736 if (STRINGP (name)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4737 { |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4738 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
|
4739 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4740 if (fontset >= 0) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4741 name = fontset_ascii (fontset); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4742 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
|
4743 } |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4744 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
|
4745 font_object = name; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4746 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
|
4747 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
|
4748 else |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4749 { |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4750 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
|
4751 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
|
4752 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4753 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
|
4754 } |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4755 if (NILP (font_object)) |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4756 return Qnil; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4757 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
|
4758 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4759 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
|
4760 XVECTOR (info)->contents[0] = AREF (font_object, FONT_NAME_INDEX); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4761 XVECTOR (info)->contents[1] = AREF (font_object, FONT_NAME_INDEX); |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4762 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
|
4763 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
|
4764 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
|
4765 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
|
4766 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
|
4767 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4768 #if 0 |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4769 /* 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
|
4770 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
|
4771 by `reference-count'. */ |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4772 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
|
4773 #endif |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4774 return info; |
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4775 } |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
4776 #endif |
95403
26df7325a6ff
(font_style_to_value, font_score): Delete casting of the
Kenichi Handa <handa@m17n.org>
parents:
95359
diff
changeset
|
4777 |
90400 | 4778 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4779 #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
|
4780 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
|
4781 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4782 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
|
4783 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
|
4784 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
|
4785 int nelement; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4786 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4787 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
|
4788 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
|
4789 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4790 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
|
4791 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
|
4792 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4793 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
|
4794 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
|
4795 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
|
4796 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
|
4797 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
|
4798 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
|
4799 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4800 return table; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4801 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4802 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4803 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
|
4804 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
|
4805 |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4806 /* 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
|
4807 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
|
4808 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
|
4809 static Lisp_Object Vfont_log_deferred; |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4810 |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4811 /* 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
|
4812 `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
|
4813 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
|
4814 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
|
4815 void |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4816 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
|
4817 char *action; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4818 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
|
4819 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4820 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
|
4821 int i; |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4822 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4823 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
|
4824 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4825 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
|
4826 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
|
4827 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4828 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
|
4829 return; |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4830 if (STRINGP (AREF (Vfont_log_deferred, 0))) |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4831 { |
97822 | 4832 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
|
4833 |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4834 ASET (Vfont_log_deferred, 0, Qnil); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4835 font_add_log (str, AREF (Vfont_log_deferred, 1), |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4836 AREF (Vfont_log_deferred, 2)); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4837 } |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4838 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4839 if (FONTP (arg)) |
97538
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
4840 { |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
4841 Lisp_Object tail, elt; |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
4842 Lisp_Object equalstr = build_string ("="); |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
4843 |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
4844 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
|
4845 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
|
4846 tail = XCDR (tail)) |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
4847 { |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
4848 elt = XCAR (tail); |
99072
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
4849 if (EQ (XCAR (elt), QCscript) |
741755a52dcf
(font_add_log): Check the values of extra properties.
Kenichi Handa <handa@m17n.org>
parents:
98717
diff
changeset
|
4850 && SYMBOLP (XCDR (elt))) |
97538
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
4851 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
|
4852 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
|
4853 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
|
4854 && SYMBOLP (XCDR (elt))) |
97538
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
4855 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
|
4856 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
|
4857 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
|
4858 && 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
|
4859 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
|
4860 concat2 (equalstr, |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
4861 SYMBOL_NAME (XCAR (XCDR (elt))))); |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
4862 } |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
4863 arg = val; |
1a792d38ec5a
(font_add_log): Add the font properties :script, :lang,
Kenichi Handa <handa@m17n.org>
parents:
97043
diff
changeset
|
4864 } |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4865 if (FONTP (result)) |
96077
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4866 { |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4867 val = Ffont_xlfd_name (result, Qt); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4868 if (! FONT_SPEC_P (result)) |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4869 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
|
4870 build_string (":"), val); |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4871 result = val; |
86e3f462b0c2
(font_parse_xlfd): Fix previous change.
Kenichi Handa <handa@m17n.org>
parents:
96073
diff
changeset
|
4872 } |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4873 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
|
4874 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4875 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
|
4876 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
|
4877 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4878 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
|
4879 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
|
4880 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
|
4881 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
|
4882 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4883 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4884 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
|
4885 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4886 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
|
4887 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
|
4888 { |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4889 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
|
4890 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
|
4891 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
|
4892 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
|
4893 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4894 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4895 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
|
4896 } |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
4897 |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4898 /* 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
|
4899 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
|
4900 as font_add_log. */ |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4901 |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4902 void |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4903 font_deferred_log (action, arg, result) |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4904 char *action; |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4905 Lisp_Object arg, result; |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4906 { |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4907 ASET (Vfont_log_deferred, 0, build_string (action)); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4908 ASET (Vfont_log_deferred, 1, arg); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4909 ASET (Vfont_log_deferred, 2, result); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4910 } |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4911 |
90400 | 4912 extern void syms_of_ftfont P_ (()); |
4913 extern void syms_of_xfont P_ (()); | |
4914 extern void syms_of_xftfont P_ (()); | |
4915 extern void syms_of_ftxfont P_ (()); | |
4916 extern void syms_of_bdffont P_ (()); | |
4917 extern void syms_of_w32font P_ (()); | |
4918 extern void syms_of_atmfont P_ (()); | |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
4919 extern void syms_of_nsfont P_ (()); |
90400 | 4920 |
4921 void | |
4922 syms_of_font () | |
4923 { | |
95867
2a64ffbf0ec3
(font_score): Delete arg alternate_families. Check only
Kenichi Handa <handa@m17n.org>
parents:
95824
diff
changeset
|
4924 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
|
4925 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
|
4926 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
|
4927 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
|
4928 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
|
4929 /* Note that the other elements in sort_shift_bits are not used. */ |
90400 | 4930 |
91135
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4931 staticpro (&font_charset_alist); |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4932 font_charset_alist = Qnil; |
49dbc35e3f99
* font.c [HAVE_M17N_FLT]: Include <m17n-flt.h>.
Kenichi Handa <handa@m17n.org>
parents:
91125
diff
changeset
|
4933 |
94926 | 4934 DEFSYM (Qfont_spec, "font-spec"); |
4935 DEFSYM (Qfont_entity, "font-entity"); | |
4936 DEFSYM (Qfont_object, "font-object"); | |
4937 | |
90677
424dec0c7b5d
(Qopentype): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90640
diff
changeset
|
4938 DEFSYM (Qopentype, "opentype"); |
90400 | 4939 |
95699 | 4940 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
|
4941 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
|
4942 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
|
4943 DEFSYM (Qunicode_bmp, "unicode-bmp"); |
90622
bb9362e3a03b
(Qunicode_sip): New variable.
Kenichi Handa <handa@m17n.org>
parents:
90590
diff
changeset
|
4944 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
|
4945 |
97822 | 4946 DEFSYM (QCf, "Cf"); |
4947 | |
90400 | 4948 DEFSYM (QCotf, ":otf"); |
94926 | 4949 DEFSYM (QClang, ":lang"); |
90400 | 4950 DEFSYM (QCscript, ":script"); |
91125
6c9a19ff6c55
(Qfontp): Remove unused symbol.
Jason Rumney <jasonr@gnu.org>
parents:
91112
diff
changeset
|
4951 DEFSYM (QCantialias, ":antialias"); |
90400 | 4952 |
4953 DEFSYM (QCfoundry, ":foundry"); | |
4954 DEFSYM (QCadstyle, ":adstyle"); | |
4955 DEFSYM (QCregistry, ":registry"); | |
90481
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
4956 DEFSYM (QCspacing, ":spacing"); |
93690200f520
(POINT_TO_PIXEL): Don't divice POINT by 10.
Kenichi Handa <handa@m17n.org>
parents:
90476
diff
changeset
|
4957 DEFSYM (QCdpi, ":dpi"); |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4958 DEFSYM (QCscalable, ":scalable"); |
94926 | 4959 DEFSYM (QCavgwidth, ":avgwidth"); |
4960 DEFSYM (QCfont_entity, ":font-entity"); | |
4961 DEFSYM (QCfc_unknown_spec, ":fc-unknown-spec"); | |
90400 | 4962 |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4963 DEFSYM (Qc, "c"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4964 DEFSYM (Qm, "m"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4965 DEFSYM (Qp, "p"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4966 DEFSYM (Qd, "d"); |
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
4967 |
90400 | 4968 staticpro (&null_vector); |
4969 null_vector = Fmake_vector (make_number (0), Qnil); | |
4970 | |
4971 staticpro (&scratch_font_spec); | |
4972 scratch_font_spec = Ffont_spec (0, NULL); | |
4973 staticpro (&scratch_font_prefer); | |
4974 scratch_font_prefer = Ffont_spec (0, NULL); | |
4975 | |
97558
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4976 staticpro (&Vfont_log_deferred); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4977 Vfont_log_deferred = Fmake_vector (make_number (3), Qnil); |
ec399baa25dd
(Vfont_log_deferred): New variable.
Kenichi Handa <handa@m17n.org>
parents:
97538
diff
changeset
|
4978 |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4979 #if 0 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4980 #ifdef HAVE_LIBOTF |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4981 staticpro (&otf_list); |
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4982 otf_list = Qnil; |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4983 #endif /* HAVE_LIBOTF */ |
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4984 #endif /* 0 */ |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
4985 |
90400 | 4986 defsubr (&Sfontp); |
4987 defsubr (&Sfont_spec); | |
4988 defsubr (&Sfont_get); | |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4989 #ifdef HAVE_WINDOW_SYSTEM |
95972
e427600f176b
(font_parse_fcname): Only only one decimal point.
Chong Yidong <cyd@stupidchicken.com>
parents:
95958
diff
changeset
|
4990 defsubr (&Sfont_face_attributes); |
96073
4af4f5a1eb34
(Ffont_face_attributes): Only define if
Andreas Schwab <schwab@suse.de>
parents:
96049
diff
changeset
|
4991 #endif |
90400 | 4992 defsubr (&Sfont_put); |
4993 defsubr (&Slist_fonts); | |
94926 | 4994 defsubr (&Sfont_family_list); |
90400 | 4995 defsubr (&Sfind_font); |
4996 defsubr (&Sfont_xlfd_name); | |
4997 defsubr (&Sclear_font_cache); | |
97822 | 4998 defsubr (&Sfont_shape_gstring); |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
4999 #if 0 |
90817
d2c230a67741
(struct otf_list): Delete it.
Kenichi Handa <handa@m17n.org>
parents:
90811
diff
changeset
|
5000 defsubr (&Sfont_drive_otf); |
90556
e56a86aa94cc
(font_otf_capability): Fix handling of the default
Kenichi Handa <handa@m17n.org>
parents:
90549
diff
changeset
|
5001 defsubr (&Sfont_otf_alternates); |
95290
e3e5f8759ca5
(LGSTRING_HEADER_SIZE, LGSTRING_GLYPH_SIZE)
Kenichi Handa <handa@m17n.org>
parents:
95225
diff
changeset
|
5002 #endif /* 0 */ |
90400 | 5003 |
5004 #ifdef FONT_DEBUG | |
5005 defsubr (&Sopen_font); | |
5006 defsubr (&Sclose_font); | |
5007 defsubr (&Squery_font); | |
5008 defsubr (&Sget_font_glyphs); | |
90503
8e3ffc0a529f
(QCscalable, Qc, Qm, Qp, Qd): New variables.
Kenichi Handa <handa@m17n.org>
parents:
90490
diff
changeset
|
5009 defsubr (&Sfont_match_p); |
90541 | 5010 defsubr (&Sfont_at); |
90400 | 5011 #if 0 |
5012 defsubr (&Sdraw_string); | |
5013 #endif | |
5014 #endif /* FONT_DEBUG */ | |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
5015 #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
|
5016 defsubr (&Sfont_info); |
95421
3350c9ac1f37
(Ffont_info): Define only if HAVE_WINDOW_SYSTEM is
Kenichi Handa <handa@m17n.org>
parents:
95403
diff
changeset
|
5017 #endif |
90400 | 5018 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5019 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
|
5020 doc: /* |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5021 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
|
5022 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
|
5023 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
|
5024 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
|
5025 |
95142
f64ddc606a66
(syms-of-font) <font-encoding-alist>:
Juanma Barranquero <lekktu@gmail.com>
parents:
95126
diff
changeset
|
5026 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
|
5027 \(REGEXP . ENCODING). |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5028 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5029 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
|
5030 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
|
5031 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
|
5032 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
|
5033 |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5034 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
|
5035 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
|
5036 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
|
5037 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
|
5038 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
|
5039 Vfont_encoding_alist = Qnil; |
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5040 |
95176
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5041 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
|
5042 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
|
5043 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
|
5044 [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
|
5045 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
|
5046 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
|
5047 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5048 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
|
5049 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
|
5050 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
|
5051 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
|
5052 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5053 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
|
5054 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
|
5055 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
|
5056 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
|
5057 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5058 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
|
5059 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
|
5060 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
|
5061 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
|
5062 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
|
5063 |
686d116f748d
Checking of FONT_DEBUG is moved to font.h. All calls of
Kenichi Handa <handa@m17n.org>
parents:
95142
diff
changeset
|
5064 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
|
5065 *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
|
5066 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
|
5067 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
|
5068 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
|
5069 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
|
5070 |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5071 #ifdef HAVE_WINDOW_SYSTEM |
90400 | 5072 #ifdef HAVE_FREETYPE |
94926 | 5073 syms_of_ftfont (); |
90400 | 5074 #ifdef HAVE_X_WINDOWS |
94926 | 5075 syms_of_xfont (); |
5076 syms_of_ftxfont (); | |
90400 | 5077 #ifdef HAVE_XFT |
94926 | 5078 syms_of_xftfont (); |
90400 | 5079 #endif /* HAVE_XFT */ |
5080 #endif /* HAVE_X_WINDOWS */ | |
5081 #else /* not HAVE_FREETYPE */ | |
5082 #ifdef HAVE_X_WINDOWS | |
94926 | 5083 syms_of_xfont (); |
90400 | 5084 #endif /* HAVE_X_WINDOWS */ |
5085 #endif /* not HAVE_FREETYPE */ | |
5086 #ifdef HAVE_BDFFONT | |
94926 | 5087 syms_of_bdffont (); |
90400 | 5088 #endif /* HAVE_BDFFONT */ |
5089 #ifdef WINDOWSNT | |
94926 | 5090 syms_of_w32font (); |
90400 | 5091 #endif /* WINDOWSNT */ |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
5092 #ifdef HAVE_NS |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
5093 syms_of_nsfont (); |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
96573
diff
changeset
|
5094 #endif /* HAVE_NS */ |
95126
b7cee987e982
(Vfont_encoding_alist, find_font_encoding): Moved from
Kenichi Handa <handa@m17n.org>
parents:
95104
diff
changeset
|
5095 #endif /* HAVE_WINDOW_SYSTEM */ |
90400 | 5096 } |
90427 | 5097 |
5098 /* arch-tag: 74c9475d-5976-4c93-a327-942ae3072846 | |
5099 (do not change this comment) */ |