Mercurial > hg > xemacs-beta
annotate src/font-mgr.c @ 5908:6174848f3e6c
Use parse_integer() in read_atom(); support bases with ratios like integers
src/ChangeLog addition:
2015-05-08 Aidan Kehoe <kehoea@parhasard.net>
* data.c (init_errors_once_early):
Move the Qunsupported_type here from numbers.c, so it's available
when the majority of our types are not supported.
* general-slots.h: Add it here, too.
* number.c: Remove the definition of Qunsupported_type from here.
* lread.c (read_atom):
Check if the first character could reflect a rational, if so, call
parse_integer(), don't check the syntax of the other
characters. This allows us to accept the non-ASCII digit
characters too.
If that worked partially, but not completely, and the next char is
a slash, try to parse as a ratio.
If that fails, try isfloat_string(), but only if the first
character could plausibly be part of a float.
Otherwise, treat as a symbol.
* lread.c (read_rational):
Rename from read_integer. Handle ratios with the same radix
specification as was used for integers.
* lread.c (read1):
Rename read_integer in this function. Support the Common Lisp
#NNNrMMM syntax for parsing a number MMM of arbitrary radix NNN.
man/ChangeLog addition:
2015-05-08 Aidan Kehoe <kehoea@parhasard.net>
* lispref/numbers.texi (Numbers):
Describe the newly-supported arbitrary-base syntax for rationals
(integers and ratios). Describe that ratios can take the same base
specification as integers, something also new.
tests/ChangeLog addition:
2015-05-08 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-reader-tests.el:
Check the arbitrary-base integer reader syntax support, just
added. Check the reader base support for ratios, just added.
Check the non-ASCII-digit support in the reader, just added.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 09 May 2015 00:40:57 +0100 |
parents | 5f02d29a2a65 |
children |
rev | line source |
---|---|
3354 | 1 /* Lisp font handling implementation for X with Xft. |
2 | |
3 Copyright (C) 2003 Eric Knauel and Matthias Neubauer | |
4 Copyright (C) 2005 Eric Knauel | |
5763
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
5 Copyright (C) 2004-2009, 2013 Free Software Foundation, Inc. |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
6 Copyright (C) 2010 Ben Wing. |
3354 | 7 |
8 Authors: Eric Knauel <knauel@informatik.uni-tuebingen.de> | |
9 Matthias Neubauer <neubauer@informatik.uni-freiburg.de> | |
10 Stephen J. Turnbull <stephen@xemacs.org> | |
11 Created: 27 Oct 2003 | |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
12 Updated: 18 November 2009 by Stephen J. Turnbull |
3354 | 13 |
14 This file is part of XEmacs. | |
15 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5189
diff
changeset
|
16 XEmacs is free software: you can redistribute it and/or modify it |
3354 | 17 under the terms of the GNU General Public License as published by the |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5189
diff
changeset
|
18 Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5189
diff
changeset
|
19 option) any later version. |
3354 | 20 |
21 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
22 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
23 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
24 for more details. | |
25 | |
26 You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5189
diff
changeset
|
27 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
3354 | 28 |
29 /* Synched up with: Not in GNU Emacs. */ | |
30 | |
31 /* This module provides the Lisp interface to fonts in X11, including Xft, | |
32 but (at least at first) not GTK+ or Qt. | |
33 | |
34 Sealevel code should be in ../lwlib/lwlib-fonts.c or | |
35 ../lwlib/lwlib-colors.c. | |
36 */ | |
37 | |
38 #include <config.h> | |
39 #include "lisp.h" | |
40 #include "device.h" | |
41 #include "device-impl.h" | |
42 #include "console-x-impl.h" | |
5176
8b2f75cecb89
rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents:
4982
diff
changeset
|
43 #include "fontcolor-x.h" |
8b2f75cecb89
rename objects* (.c, .h and .el files) to fontcolor*
Ben Wing <ben@xemacs.org>
parents:
4982
diff
changeset
|
44 #include "fontcolor-x-impl.h" |
3354 | 45 #include "hash.h" |
46 #include "font-mgr.h" | |
47 | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4953
diff
changeset
|
48 #include "sysfile.h" |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4953
diff
changeset
|
49 |
3354 | 50 /* #### TO DO #### |
51 . The "x-xft-*" and "x_xft_*" nomenclature is mostly redundant, especially | |
52 if we separate X fonts from Xft fonts, and use fontconfig more generally. | |
53 . We should support the most recent Xft first, old Xft libraries later. | |
54 . We may (think about it) wish to use fontconfig generally, even if we're | |
55 not using Xft. Either way, names that are really from fontconfig should | |
56 use the Fc* namespace. | |
57 . Mule-ize this file. | |
58 . Separate X Font Struct ops from Xft Font ops; give precedence to Xft but | |
59 allow fallback to X. | |
60 . Push decisions about font choice, defaults, fallbacks to Lisp; if we | |
61 really need efficiency, can reimplement in C later. | |
62 . Implement symbols interned in this file in the Q* namespace. | |
63 . Implement FcMatrix (Lisp vector). | |
64 . Implement FcCharSets (Lisp chartable? For implementation hints, see | |
65 FcCharSetFirstPage and FcCharSetNextPage). | |
66 . Implement FcConfigs. | |
67 DONE | |
68 . Fontconfig fontnames are encoded in UTF-8. | |
69 */ | |
70 | |
3360 | 71 Lisp_Object Qfont_mgr; |
3354 | 72 Lisp_Object Qfc_patternp; |
73 /* Lisp_Object Qfc_result_match; */ /* FcResultMatch */ | |
74 Lisp_Object Qfc_result_type_mismatch; /* FcResultTypeMismatch */ | |
75 Lisp_Object Qfc_result_no_match; /* FcResultNoMatch */ | |
76 Lisp_Object Qfc_result_no_id; /* FcResultNoId */ | |
77 Lisp_Object Qfc_internal_error; | |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
78 Lisp_Object Qfc_match_pattern; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
79 Lisp_Object Qfc_match_font; |
3354 | 80 Lisp_Object Vxlfd_font_name_regexp; /* #### Really needed? */ |
3935 | 81 Fixnum xft_version; |
82 Fixnum fc_version; | |
3354 | 83 Fixnum debug_xft; /* Set to 1 enables lots of obnoxious messages. |
84 Setting it to 2 or 3 enables even more. */ | |
3931 | 85 #ifdef FONTCONFIG_EXPOSE_CONFIG |
86 Lisp_Object Qfc_configp; | |
87 static Lisp_Object Vfc_config_weak_list; | |
88 #endif | |
3354 | 89 |
90 /**************************************************************** | |
91 * FcPattern objects * | |
92 ****************************************************************/ | |
93 | |
94 static void | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
95 finalize_fc_pattern (Lisp_Object obj) |
3354 | 96 { |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
97 struct fc_pattern *p = XFC_PATTERN (obj); |
3354 | 98 if (p->fcpatPtr) |
99 { | |
100 FcPatternDestroy (p->fcpatPtr); | |
101 p->fcpatPtr = 0; | |
102 } | |
103 } | |
104 | |
3906 | 105 /* #### We really need an equal method and a hash method (required if you |
106 have an equal method). For the equal method, we can probably use one | |
107 or both of | |
108 | |
109 -- Function: FcBool FcPatternEqual (const FcPattern *pa, const | |
110 FcPattern *pb); | |
111 Returns whether PA and PB are exactly alike. | |
112 | |
113 -- Function: FcBool FcPatternEqualSubset (const FcPattern *pa, const | |
114 FcPattern *pb, const FcObjectSet *os) | |
115 Returns whether PA and PB have exactly the same values for all of | |
116 the objects in OS. | |
117 | |
118 For the hash, we'll have to extract some subset of attributes. | |
119 | |
120 #### Crap. It's altogether unobvious what we need. x_color_instance | |
121 does have a hash method, but fonts are apparently special. I get the | |
122 feeling that for this to work properly we're going to need to switch | |
123 to fontconfig-based font specifications (although we can allow the | |
124 platform syntaxes, the underlying specification object will need to | |
125 conform to the fontconfig API, or more precisely the font-mgr API). | |
126 | |
127 I think the whole `font-truename' interface needs to be dropped. */ | |
128 | |
3354 | 129 static const struct memory_description fcpattern_description [] = { |
130 /* #### nothing here, is this right?? */ | |
131 { XD_END } | |
132 }; | |
133 | |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4758
diff
changeset
|
134 DEFINE_NODUMP_LISP_OBJECT ("fc-pattern", fc_pattern, |
5142
f965e31a35f0
reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents:
5127
diff
changeset
|
135 0, external_object_printer, finalize_fc_pattern, |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4758
diff
changeset
|
136 0, 0, fcpattern_description, |
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4758
diff
changeset
|
137 struct fc_pattern); |
3354 | 138 |
139 /* | |
140 * Helper Functions | |
141 */ | |
142 static Lisp_Object make_xlfd_font_regexp (void); | |
143 static void string_list_to_fcobjectset (Lisp_Object list, FcObjectSet *os); | |
144 | |
145 /* | |
5763
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
146 Extract the C representation of the Lisp string STR and convert it |
3354 | 147 to the encoding used by the Fontconfig API for property and font |
5763
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
148 names. These functions assume that STR is a Lisp string. |
3354 | 149 */ |
150 #define extract_fcapi_string(str) \ | |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4953
diff
changeset
|
151 (LISP_STRING_TO_EXTERNAL ((str), Qfc_font_name_encoding)) |
3354 | 152 |
3906 | 153 #define build_fcapi_string(str) \ |
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
154 (build_extstring ((Extbyte *) (str), Qfc_font_name_encoding)) |
3906 | 155 |
3360 | 156 /* #### This homebrew lashup should be replaced with FcConstants. |
157 | |
5763
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
158 #### This isn't true any more (fontconfig v2.10.95), if it ever was. |
3360 | 159 fontconfig assumes that objects (property names) are statically allocated, |
3354 | 160 and you will get bizarre results if you pass Lisp string data or strings |
161 allocated on the stack as objects. fontconfig _does_ copy values, so we | |
162 (I hope) don't have to worry about that member. | |
163 | |
164 Probably these functions don't get called so often that the memory leak | |
165 due to strdup'ing every time we add a property would matter, but XEmacs | |
166 _is_ a long-running process. So we hash them. | |
167 | |
168 I suspect that using symbol names or even keywords does not provide | |
169 assurance that the string won't move in memory. So we hash them | |
3360 | 170 ourselves; hash.c hashtables do not interpret the value pointers. |
171 | |
172 This array should be FcChar8**, but GCC 4.x bitches about signedness. */ | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
173 static const Extbyte *fc_standard_properties[] = |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
174 { |
3360 | 175 /* treated specially, ordered first */ |
176 "family", "size", | |
177 /* remaining are alphabetized by group */ | |
178 /* standard properties in fontconfig and Xft v.2 */ | |
179 "antialias", "aspect", "autohint", "charset", "dpi", "file", | |
3354 | 180 "foundry", "ftface", "globaladvance", "hinting", "index", "lang", |
181 "minspace", "outline", "pixelsize", "rasterizer", "rgba", "scalable", | |
3360 | 182 "scale", "slant", "spacing", "style", "verticallayout", "weight", |
183 /* common in modern fonts */ | |
184 "fontformat", "fontversion", | |
3354 | 185 /* obsolete after Xft v. 1 */ |
186 "charwidth", "charheight", "core", "encoding", "render" | |
187 }; | |
188 | |
189 static struct hash_table *fc_property_name_hash_table; | |
190 | |
191 /* #### Maybe fc_intern should be exposed to LISP? The idea is that | |
192 fc-pattern-add could warn or error if the property isn't interned. */ | |
193 | |
3469 | 194 static const Extbyte * |
3354 | 195 fc_intern (Lisp_Object property) |
196 { | |
197 const void *dummy; | |
3469 | 198 const Extbyte *prop = extract_fcapi_string (property); |
3354 | 199 const void *val = gethash (prop, fc_property_name_hash_table, &dummy); |
200 | |
201 /* extract_fcapi_string returns something alloca'd | |
202 so we can just drop the old value of prop on the floor */ | |
203 if (val) | |
3469 | 204 prop = (const Extbyte *) val; |
3354 | 205 else |
206 { | |
3469 | 207 prop = (const Extbyte *) FcStrCopy ((FcChar8 *) prop); |
3354 | 208 puthash (prop, NULL, fc_property_name_hash_table); |
209 } | |
210 return prop; | |
211 } | |
212 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
213 DEFUN ("fc-pattern-p", Ffc_pattern_p, 1, 1, 0, /* |
3354 | 214 Returns t if OBJECT is of type fc-pattern, nil otherwise. |
215 */ | |
216 (object)) | |
217 { | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
218 return FC_PATTERNP (object) ? Qt : Qnil; |
3354 | 219 } |
220 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
221 DEFUN ("fc-pattern-create", Ffc_pattern_create, 0, 0, 0, /* |
3354 | 222 Return a new, empty fc-pattern object. |
223 */ | |
224 ()) | |
225 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
226 fc_pattern *fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); |
3354 | 227 |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4758
diff
changeset
|
228 fcpat->fcpatPtr = FcPatternCreate (); |
5763
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
229 assert (fcpat->fcpatPtr); |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
230 return wrap_fc_pattern (fcpat); |
3354 | 231 } |
232 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
233 DEFUN ("fc-name-parse", Ffc_name_parse, 1, 1, 0, /* |
5763
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
234 Parse an Fc font name and return its representation as a Fc pattern object. |
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
235 Signal `invalid-argument' if the name is unparseable. |
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
236 |
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
237 Note: The name returned by xft-font-truename has been observed to be |
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
238 unparseable \(in the case of the xft-font-default-font-name). The cause |
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
239 is unknown so you can't assume getting a name from a font instance then |
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
240 instantiating the font again will round-trip. See `fc-name-parse-harder'. |
3354 | 241 */ |
242 (name)) | |
243 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
244 fc_pattern *fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); |
3354 | 245 |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4758
diff
changeset
|
246 CHECK_STRING (name); |
3469 | 247 fcpat->fcpatPtr = FcNameParse ((FcChar8 *) extract_fcapi_string (name)); |
5763
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
248 if (!fcpat->fcpatPtr) |
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
249 /* #### Is this the best API? Could return a symbol or similar. */ |
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
250 invalid_argument ("unparseable Fc font name", name); |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
251 return wrap_fc_pattern (fcpat); |
3354 | 252 } |
253 | |
254 /* #### Ga-a-ack! Xft's similar function is actually a different API. | |
255 We provide both. */ | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
256 DEFUN ("fc-name-unparse", Ffc_name_unparse, 1, 1, 0, /* |
3354 | 257 Unparse an fc pattern object to a string. |
5818
15b0715c204d
Avoid passing patterns to with charset property to FcNameUnparse.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5763
diff
changeset
|
258 To work around a bug in fontconfig (at least 2.11.1), the 'charset' property |
15b0715c204d
Avoid passing patterns to with charset property to FcNameUnparse.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5763
diff
changeset
|
259 is removed before passing to FcNameUnparse. To extract the 'charset' property, |
15b0715c204d
Avoid passing patterns to with charset property to FcNameUnparse.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5763
diff
changeset
|
260 use `\(fc-pattern-get PATTERN "charset")'. |
3354 | 261 */ |
262 (pattern)) | |
263 { | |
4799
ca99a807b025
Free, rather than discard, the return value of FcNameUnparse. See message
Jerry James <james@xemacs.org>
parents:
4758
diff
changeset
|
264 FcChar8 *name; |
ca99a807b025
Free, rather than discard, the return value of FcNameUnparse. See message
Jerry James <james@xemacs.org>
parents:
4758
diff
changeset
|
265 Lisp_Object result; |
5818
15b0715c204d
Avoid passing patterns to with charset property to FcNameUnparse.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5763
diff
changeset
|
266 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
267 CHECK_FC_PATTERN (pattern); |
5818
15b0715c204d
Avoid passing patterns to with charset property to FcNameUnparse.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5763
diff
changeset
|
268 /* #### Could use multiple values here to extract and return charset? */ |
5824
6928877dbc26
Fix breakage caused by previous commit.
Mike Sperber <sperber@deinprogramm.de>
parents:
5818
diff
changeset
|
269 { |
6928877dbc26
Fix breakage caused by previous commit.
Mike Sperber <sperber@deinprogramm.de>
parents:
5818
diff
changeset
|
270 FcPattern* temp = FcPatternDuplicate (XFC_PATTERN_PTR (pattern)); |
6928877dbc26
Fix breakage caused by previous commit.
Mike Sperber <sperber@deinprogramm.de>
parents:
5818
diff
changeset
|
271 FcPatternDel (temp, FC_CHARSET); |
5830
5f02d29a2a65
Get the previous patch wrt. FcNameUnparse right.
Mike Sperber <sperber@deinprogramm.de>
parents:
5824
diff
changeset
|
272 name = FcNameUnparse (temp); |
5824
6928877dbc26
Fix breakage caused by previous commit.
Mike Sperber <sperber@deinprogramm.de>
parents:
5818
diff
changeset
|
273 FcPatternDestroy (temp); |
6928877dbc26
Fix breakage caused by previous commit.
Mike Sperber <sperber@deinprogramm.de>
parents:
5818
diff
changeset
|
274 } |
4799
ca99a807b025
Free, rather than discard, the return value of FcNameUnparse. See message
Jerry James <james@xemacs.org>
parents:
4758
diff
changeset
|
275 result = build_fcapi_string (name); |
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
4953
diff
changeset
|
276 xfree (name); |
4799
ca99a807b025
Free, rather than discard, the return value of FcNameUnparse. See message
Jerry James <james@xemacs.org>
parents:
4758
diff
changeset
|
277 return result; |
3354 | 278 } |
279 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
280 DEFUN ("fc-pattern-duplicate", Ffc_pattern_duplicate, 1, 1, 0, /* |
3354 | 281 Make a copy of the fc pattern object PATTERN and return it. |
282 */ | |
283 (pattern)) | |
284 { | |
285 struct fc_pattern *copy = NULL; | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
286 CHECK_FC_PATTERN (pattern); |
3354 | 287 |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
288 copy = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); |
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
289 copy->fcpatPtr = FcPatternDuplicate (XFC_PATTERN_PTR (pattern)); |
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
290 return wrap_fc_pattern (copy); |
3354 | 291 } |
292 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
293 DEFUN ("fc-pattern-add", Ffc_pattern_add, 3, 3, 0, /* |
3354 | 294 Add attributes to the pattern object PATTERN. PROPERTY is a string naming |
295 the attribute to add, VALUE the value for this attribute. | |
296 | |
297 VALUE may be a string, integer, float, or symbol, in which case the value | |
298 will be added as an FcChar8[], int, double, or FcBool respectively. | |
299 */ | |
300 (pattern, property, value)) | |
301 { | |
302 Bool res = 0; | |
3469 | 303 const Extbyte *obj; |
3354 | 304 FcPattern *fcpat; |
305 | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
306 CHECK_FC_PATTERN (pattern); |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4758
diff
changeset
|
307 CHECK_STRING (property); |
3354 | 308 |
309 obj = fc_intern (property); | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
310 fcpat = XFC_PATTERN_PTR (pattern); |
3354 | 311 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
312 if (STRINGP (value)) |
3354 | 313 { |
314 FcChar8 *str = (FcChar8 *) extract_fcapi_string (value); | |
315 res = FcPatternAddString (fcpat, obj, str); | |
316 } | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5438
diff
changeset
|
317 else if (FIXNUMP (value)) |
3354 | 318 { |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5438
diff
changeset
|
319 res = FcPatternAddInteger (fcpat, obj, XFIXNUM (value)); |
3354 | 320 } |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
321 else if (FLOATP (value)) |
3354 | 322 { |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
323 res = FcPatternAddDouble (fcpat, obj, (double) XFLOAT_DATA (value)); |
3354 | 324 } |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
325 else if (SYMBOLP (value)) |
3354 | 326 { |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
327 res = FcPatternAddBool (fcpat, obj, !NILP (value)); |
3354 | 328 } |
329 /* else ... maybe we should wta here? */ | |
330 | |
331 return res ? Qt : Qnil; | |
332 } | |
333 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
334 DEFUN ("fc-pattern-del", Ffc_pattern_del, 2, 2, 0, /* |
3354 | 335 Remove attribute PROPERTY from fc pattern object OBJECT. |
336 */ | |
337 (pattern, property)) | |
338 { | |
339 Bool res; | |
340 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
341 CHECK_FC_PATTERN (pattern); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
342 CHECK_STRING (property); |
3354 | 343 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
344 res = FcPatternDel (XFC_PATTERN_PTR (pattern), extract_fcapi_string (property)); |
3354 | 345 return res ? Qt : Qnil; |
346 } | |
347 | |
348 /* Generic interface to FcPatternGet() | |
349 * Don't support the losing symbol-for-property interface. | |
5818
15b0715c204d
Avoid passing patterns to with charset property to FcNameUnparse.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5763
diff
changeset
|
350 * To support that interface properly, we should have `fc-register-property' |
15b0715c204d
Avoid passing patterns to with charset property to FcNameUnparse.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5763
diff
changeset
|
351 * so that only registered symbols could be used. Then it would serve to |
15b0715c204d
Avoid passing patterns to with charset property to FcNameUnparse.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5763
diff
changeset
|
352 * provide the same kind of check that the C-level FC_* macros do. |
3354 | 353 */ |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
354 DEFUN ("fc-pattern-get", Ffc_pattern_get, 2, 4, 0, /* |
3354 | 355 From PATTERN, extract PROPERTY for the ID'th member, of type TYPE. |
356 | |
357 PATTERN is an Xft (fontconfig) pattern object. | |
358 PROPERTY is a string naming an fontconfig font property. | |
359 Optional ID is a nonnegative integer indexing the list of values for PROPERTY | |
360 stored in PATTERN, defaulting to 0 (the first value). | |
361 Optional TYPE is a symbol, one of 'string, 'boolean, 'integer, 'float, | |
362 'double, 'matrix, 'charset, or 'void, corresponding to the FcValue types. | |
363 ('float is an alias for 'double). | |
364 | |
365 The Lisp types returned will conform to TYPE: | |
366 string string | |
367 boolean `t' or `nil' | |
368 integer integer | |
369 double (float) float | |
370 matrix not implemented | |
371 charset not implemented | |
372 void not implemented | |
373 | |
374 Symbols with names of the form "fc-result-DESCRIPTION" are returned when | |
375 the desired value is not available. These are | |
376 | |
377 fc-result-type-mismatch the value found has an unexpected type | |
378 fc-result-no-match there is no such attribute | |
379 fc-result-no-id there is no value for the requested ID | |
380 | |
381 The types of the following standard properties are predefined by fontconfig. | |
382 The symbol 'fc-result-type-mismatch will be returned if the object exists but | |
383 TYPE does not match the predefined type. It is best not to specify a type | |
384 for predefined properties, as a mistake here ensures error returns on the | |
385 correct type. | |
386 | |
387 Each standard property has a convenience accessor defined in fontconfig.el, | |
388 named in the form "fc-pattern-get-PROPERTY". The convenience functions are | |
389 preferred to `fc-pattern-get' since a typo in the string naming a property | |
390 will result in a silent null return, while a typo in a function name will | |
391 usually result in a compiler or runtime \"not fboundp\" error. You may use | |
392 `defsubst' to define convenience functions for non-standard properties. | |
393 | |
394 family String Font family name | |
395 style String Font style. Overrides weight and slant | |
396 slant Int Italic, oblique or roman | |
397 weight Int Light, medium, demibold, bold or black | |
398 size Double Point size | |
399 aspect Double Stretches glyphs horizontally before hinting | |
400 pixelsize Double Pixel size | |
401 spacing Int Proportional, monospace or charcell | |
402 foundry String Font foundry name | |
403 antialias Bool Whether glyphs can be antialiased | |
404 hinting Bool Whether the rasterizer should use hinting | |
405 verticallayout Bool Use vertical layout | |
406 autohint Bool Use autohinter instead of normal hinter | |
407 globaladvance Bool Use font global advance data | |
408 file String The filename holding the font | |
409 index Int The index of the font within the file | |
410 ftface FT_Face Use the specified FreeType face object | |
411 rasterizer String Which rasterizer is in use | |
412 outline Bool Whether the glyphs are outlines | |
413 scalable Bool Whether glyphs can be scaled | |
414 scale Double Scale factor for point->pixel conversions | |
415 dpi Double Target dots per inch | |
416 rgba Int unknown, rgb, bgr, vrgb, vbgr, none - subpixel geometry | |
417 minspace Bool Eliminate leading from line spacing | |
418 charset CharSet Unicode chars encoded by the font | |
419 lang String List of RFC-3066-style languages this font supports | |
420 | |
421 The FT_Face, Matrix, CharSet types are unimplemented, so the corresponding | |
422 properties are not accessible from Lisp at this time. If the value of a | |
423 property returned has type FT_Face, FcCharSet, or FcMatrix, | |
424 `fc-result-type-mismatch' is returned. | |
425 | |
426 The following properties which were standard in Xft v.1 are obsolete in | |
427 Xft v.2: encoding, charwidth, charheight, core, and render. */ | |
428 (pattern, property, id, type)) | |
429 { | |
3469 | 430 Extbyte *fc_property; |
3354 | 431 FcResult fc_result; |
432 FcValue fc_value; | |
5307
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
433 int int_id = 0; |
3354 | 434 |
435 /* | |
436 process arguments | |
437 */ | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
438 CHECK_FC_PATTERN (pattern); |
3354 | 439 |
440 #if 0 | |
441 /* Don't support the losing symbol-for-property interface. */ | |
442 property = SYMBOLP (property) ? symbol_name (XSYMBOL (property)) : property; | |
443 #endif | |
444 if (STRINGP (property)) | |
445 { | |
3469 | 446 fc_property = extract_fcapi_string (property); |
3354 | 447 } |
448 else | |
449 { | |
450 /* if we allow symbols, this would need to be | |
451 list3 (Qlambda, list1 (Qobject), | |
452 list3 (Qor, list2 (Qstringp, Qobject), | |
453 list2 (Qsymbolp, Qobject))) | |
454 or something like that? */ | |
455 dead_wrong_type_argument (Qstringp, property); | |
456 } | |
457 | |
5307
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
458 if (!NILP (id)) |
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
459 { |
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
460 #ifdef HAVE_BIGNUM |
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
461 check_integer_range (id, Qzero, make_integer (INT_MAX)); |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5438
diff
changeset
|
462 int_id = BIGNUMP (id) ? bignum_to_int (XBIGNUM_DATA (id)) : XFIXNUM (id); |
5307
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
463 #else |
5736
3192994c49ca
Convert C (un)signed long long values to bignums properly.
Jerry James <james@xemacs.org>
parents:
5581
diff
changeset
|
464 check_integer_range (id, Qzero, make_fixnum (MOST_POSITIVE_FIXNUM)); |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5438
diff
changeset
|
465 int_id = XFIXNUM (id); |
5307
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
466 #endif |
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
467 } |
3354 | 468 if (!NILP (type)) CHECK_SYMBOL (type); |
469 | |
470 /* get property */ | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
471 fc_result = FcPatternGet (XFC_PATTERN_PTR (pattern), |
5307
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
472 fc_property, int_id, &fc_value); |
3354 | 473 |
474 switch (fc_result) | |
475 { | |
476 case FcResultMatch: | |
477 /* wrap it and return */ | |
478 switch (fc_value.type) | |
479 { | |
480 case FcTypeInteger: | |
481 return ((!NILP (type) && !EQ (type, Qinteger)) | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5438
diff
changeset
|
482 ? Qfc_result_type_mismatch : make_fixnum (fc_value.u.i)); |
3354 | 483 case FcTypeDouble: |
484 return ((!NILP (type) && !EQ (type, intern ("double")) | |
485 && !EQ (type, Qfloat)) | |
486 ? Qfc_result_type_mismatch : make_float (fc_value.u.d)); | |
487 case FcTypeString: | |
488 return ((!NILP (type) && !EQ (type, Qstring)) | |
489 ? Qfc_result_type_mismatch | |
3906 | 490 : build_fcapi_string (fc_value.u.s)); |
3354 | 491 case FcTypeBool: |
492 return ((!NILP (type) && !EQ (type, Qboolean)) | |
493 ? Qfc_result_type_mismatch : fc_value.u.b ? Qt : Qnil); | |
494 case FcTypeMatrix: | |
495 return Qfc_result_type_mismatch; | |
496 /* #### unimplemented | |
497 return ((!NILP (type) && !EQ (type, intern ("matrix"))) | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5438
diff
changeset
|
498 ? Qfc_result_type_mismatch : make_fixnum (fc_value.u.m)); |
3354 | 499 */ |
500 case FcTypeCharSet: | |
501 return Qfc_result_type_mismatch; | |
502 /* #### unimplemented | |
503 return ((!NILP (type) && !EQ (type, intern ("charset"))) | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5438
diff
changeset
|
504 ? Qfc_result_type_mismatch : make_fixnum (fc_value.u.c)); |
3354 | 505 */ |
506 } | |
507 case FcResultTypeMismatch: | |
508 return Qfc_result_type_mismatch; | |
509 case FcResultNoMatch: | |
510 return Qfc_result_no_match; | |
511 case FcResultNoId: | |
512 return Qfc_result_no_id; | |
513 default: | |
514 return Qfc_internal_error; | |
515 } | |
516 } | |
517 | |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
518 /* FcConfig handling functions. */ |
3354 | 519 |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
520 /* We obviously need to be careful about garbage collecting the current |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
521 FcConfig. I infer from the documentation of FcConfigDestroy that that |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
522 is the only reference maintained by fontconfig. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
523 So we keep track of our own references on a weak list, and only cons a |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
524 new object if we don't already have a reference to it there. */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
525 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
526 enum DestroyFontsetP { DestroyNo = 0, DestroyYes = 1 }; |
3354 | 527 |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
528 static Lisp_Object |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
529 fc_config_create_using (FcConfig * (*create_function) (void)) |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
530 { |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
531 FcConfig *fc = (*create_function) (); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
532 Lisp_Object configs = XWEAK_LIST_LIST (Vfc_config_weak_list); |
3354 | 533 |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
534 /* Linear search: fc_configs are not going to multiply like conses. */ |
3360 | 535 { |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
536 LIST_LOOP_2 (cfg, configs) |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
537 if (fc == XFC_CONFIG_PTR (cfg)) |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
538 return cfg; |
3360 | 539 } |
540 | |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
541 { |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
542 fc_config *fccfg = XFC_CONFIG (ALLOC_NORMAL_LISP_OBJECT (fc_config)); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
543 fccfg->fccfgPtr = fc; |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
544 configs = Fcons (wrap_fc_config (fccfg), configs); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
545 XWEAK_LIST_LIST (Vfc_config_weak_list) = configs; |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
546 return wrap_fc_config (fccfg); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
547 } |
3354 | 548 } |
549 | |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
550 static Lisp_Object |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
551 fc_strlist_to_lisp_using (FcStrList * (*getter) (FcConfig *), |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
552 Lisp_Object config) |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
553 { |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
554 FcChar8 *thing; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
555 Lisp_Object value = Qnil; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
556 FcStrList *thing_list; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
557 |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
558 CHECK_FC_CONFIG (config); |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
559 thing_list = (*getter) (XFC_CONFIG_PTR (config)); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
560 /* Yes, we need to do this check -- sheesh, Keith! */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
561 if (!thing_list) |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
562 return Qnil; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
563 while ((thing = FcStrListNext (thing_list))) |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
564 value = Fcons (build_fcapi_string (thing), value); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
565 FcStrListDone (thing_list); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
566 return value; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
567 } |
3931 | 568 |
3354 | 569 static Lisp_Object |
3931 | 570 fontset_to_list (FcFontSet *fontset, enum DestroyFontsetP destroyp) |
3354 | 571 { |
572 int idx; | |
573 Lisp_Object fontlist = Qnil; | |
574 fc_pattern *fcpat; | |
575 | |
576 /* #### improve this error message */ | |
577 if (!fontset) | |
4860 | 578 invalid_state ("failed to create FcFontSet", Qunbound); |
3354 | 579 for (idx = 0; idx < fontset->nfont; ++idx) |
580 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
581 fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); |
3354 | 582 fcpat->fcpatPtr = FcPatternDuplicate (fontset->fonts[idx]); |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
583 fontlist = Fcons (wrap_fc_pattern (fcpat), fontlist); |
3354 | 584 } |
3931 | 585 if (destroyp) |
586 FcFontSetDestroy (fontset); | |
3354 | 587 return fontlist; |
588 } | |
589 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
590 DEFUN ("fc-config-p", Ffc_config_p, 1, 1, 0, /* |
3931 | 591 Returns t if OBJECT is of type fc-config, nil otherwise. |
592 */ | |
593 (object)) | |
594 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
595 return FC_CONFIGP (object) ? Qt : Qnil; |
3931 | 596 } |
597 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
598 DEFUN ("fc-config-create", Ffc_config_create, 0, 0, 0, /* |
3931 | 599 -- Function: FcConfig *FcConfigCreate (void) |
600 Creates an empty configuration. */ | |
601 ()) | |
602 { | |
603 return fc_config_create_using (&FcConfigCreate); | |
604 } | |
605 | |
606 #if 0 | |
607 /* I'm sorry, but we just don't do this in Lisp, OK? | |
608 Don't even think about implementing this. */ | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
609 DEFUN ("fc-config-destroy", Ffc_config_destroy, 1, 1, 0, /* |
3931 | 610 -- Function: void FcConfigDestroy (FcConfig *config) |
611 Destroys a configuration and any data associated with it. Note | |
612 that calling this function with the return value from | |
613 FcConfigGetCurrent will place the library in an indeterminate | |
614 state. */ | |
615 (config)) | |
616 { | |
617 signal_error (Qunimplemented, "No user-servicable parts!", | |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
618 intern ("fc-config-destroy")); |
3931 | 619 } |
620 #endif | |
621 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
622 DEFUN ("fc-config-up-to-date", Ffc_config_up_to_date, 1, 1, 0, /* |
3931 | 623 -- Function: FcBool FcConfigUptoDate (FcConfig *config) |
624 Checks all of the files related to 'config' and returns whether the | |
625 in-memory version is in sync with the disk version. */ | |
626 (config)) | |
627 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
628 CHECK_FC_CONFIG (config); |
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
629 return FcConfigUptoDate (XFC_CONFIG_PTR (config)) == FcFalse ? Qnil : Qt; |
3931 | 630 } |
631 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
632 DEFUN ("fc-config-build-fonts", Ffc_config_build_fonts, 1, 1, 0, /* |
3931 | 633 -- Function: FcBool FcConfigBuildFonts (FcConfig *config) |
634 Builds the set of available fonts for the given configuration. | |
635 Note that any changes to the configuration after this call have | |
636 indeterminate effects. Returns FcFalse if this operation runs out | |
637 of memory. | |
638 XEmacs: signal out-of-memory, or return nil on success. */ | |
639 (config)) | |
640 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
641 CHECK_FC_CONFIG (config); |
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
642 if (FcConfigBuildFonts (XFC_CONFIG_PTR (config)) == FcFalse) |
3931 | 643 out_of_memory ("FcConfigBuildFonts failed", config); |
644 return Qnil; | |
645 } | |
646 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
647 DEFUN ("fc-config-get-config-dirs", Ffc_config_get_config_dirs, 1, 1, 0, /* |
3931 | 648 -- Function: FcStrList *FcConfigGetConfigDirs (FcConfig *config) |
649 Returns the list of font directories specified in the | |
650 configuration files for 'config'. Does not include any | |
651 subdirectories. */ | |
652 (config)) | |
653 { | |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
654 return fc_strlist_to_lisp_using (&FcConfigGetConfigDirs, config); |
3931 | 655 } |
656 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
657 DEFUN ("fc-config-get-font-dirs", Ffc_config_get_font_dirs, 1, 1, 0, /* |
3931 | 658 -- Function: FcStrList *FcConfigGetFontDirs (FcConfig *config) |
659 Returns the list of font directories in 'config'. This includes the | |
660 configured font directories along with any directories below those | |
661 in the filesystem. */ | |
662 (config)) | |
663 { | |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
664 return fc_strlist_to_lisp_using (&FcConfigGetFontDirs, config); |
3931 | 665 } |
666 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
667 DEFUN ("fc-config-get-config-files", Ffc_config_get_config_files, 1, 1, 0, /* |
3931 | 668 -- Function: FcStrList *FcConfigGetConfigFiles (FcConfig *config) |
669 Returns the list of known configuration files used to generate | |
670 'config'. Note that this will not include any configuration done | |
671 with FcConfigParse. */ | |
672 (config)) | |
673 { | |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
674 return fc_strlist_to_lisp_using (&FcConfigGetConfigFiles, config); |
3931 | 675 } |
676 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
677 DEFUN ("fc-config-get-cache", Ffc_config_get_cache, 1, 1, 0, /* |
3931 | 678 -- Function: char *FcConfigGetCache (FcConfig *config) |
679 Returns the name of the file used to store per-user font | |
680 information. */ | |
681 (config)) | |
682 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
683 CHECK_FC_CONFIG (config); |
3931 | 684 /* Surely FcConfigGetCache just casts an FcChar8* to char*. */ |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
685 return build_fcapi_string ((FcChar8 *) FcConfigGetCache (XFC_CONFIG_PTR (config))); |
3931 | 686 } |
687 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
688 DEFUN ("fc-config-get-fonts", Ffc_config_get_fonts, 2, 2, 0, /* |
3931 | 689 -- Function: FcFontSet *FcConfigGetFonts (FcConfig *config, FcSetName set) |
690 Returns one of the two sets of fonts from the configuration as | |
691 specified by 'set'. | |
692 `FcSetName' | |
693 Specifies one of the two sets of fonts available in a | |
694 configuration; FcSetSystem for those fonts specified in the | |
695 configuration and FcSetApplication which holds fonts provided by | |
696 the application. */ | |
697 (config, set)) | |
698 { | |
699 FcSetName name = FcSetSystem; | |
700 FcFontSet *fs = NULL; | |
701 | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
702 CHECK_FC_CONFIG (config); |
3931 | 703 CHECK_SYMBOL (set); |
704 | |
705 if (EQ (set, intern ("fc-set-system"))) | |
706 name = FcSetSystem; | |
707 else if (EQ (set, intern ("fc-set-application"))) | |
708 name = FcSetApplication; | |
709 else | |
710 wtaerror ("must be in (fc-set-system fc-set-application)", set); | |
711 | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
712 fs = FcConfigGetFonts (XFC_CONFIG_PTR (config), name); |
3931 | 713 return fs ? fontset_to_list (fs, DestroyNo) : Qnil; |
714 } | |
715 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
716 DEFUN ("fc-config-set-current", Ffc_config_set_current, 1, 1, 0, /* |
3931 | 717 -- Function: FcBool FcConfigSetCurrent (FcConfig *config) |
718 Sets the current default configuration to 'config'. Implicitly | |
719 calls FcConfigBuildFonts if necessary, returning FcFalse if that | |
720 call fails. | |
721 XEmacs: signals out-of-memory if FcConfigBuildFonts fails, or args-out-of-range | |
722 if the resulting FcConfig has no fonts (which would crash XEmacs if installed). | |
723 */ | |
724 (config)) | |
725 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
726 CHECK_FC_CONFIG (config); |
3931 | 727 /* *sigh* "Success" DOES NOT mean you have any fonts available. It is |
728 easy to crash fontconfig, and XEmacs with it. Without the following | |
729 check, this will do it: | |
730 (progn | |
731 (fc-config-set-current (fc-config-create)) | |
732 (set-face-font 'default "serif-12")) | |
733 */ | |
734 | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
735 if (FcConfigBuildFonts (XFC_CONFIG_PTR (config)) == FcFalse) |
3931 | 736 out_of_memory ("FcConfigBuildFonts failed", config); |
737 /* #### We'd like to avoid this consing, and FcConfigGetFonts sometimes | |
738 returns NULL, but it doesn't always. This will do for now .... */ | |
739 if (NILP (Ffc_config_get_fonts (config, intern ("fc-set-system"))) | |
740 && NILP (Ffc_config_get_fonts (config, intern ("fc-set-application")))) | |
741 signal_error (intern ("args-out-of-range"), "no fonts found", config); | |
742 /* Should never happen, but I don't trust Keith anymore .... */ | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
743 if (FcConfigSetCurrent (XFC_CONFIG_PTR (config)) == FcFalse) |
3931 | 744 out_of_memory ("FcConfigBuildFonts failed in set", config); |
745 return Qnil; | |
746 } | |
747 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
748 DEFUN ("fc-config-get-blanks", Ffc_config_get_blanks, 1, 1, 0, /* |
3931 | 749 -- Function: FcBlanks *FcConfigGetBlanks (FcConfig *config) |
750 Returns the FcBlanks object associated with the given | |
751 configuration, if no blanks were present in the configuration, | |
752 this function will return 0. | |
753 XEmacs: should convert to a chartable. | |
754 #### Unimplemented. */ | |
755 (config)) | |
756 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
757 CHECK_FC_CONFIG (config); |
3931 | 758 signal_error (Qunimplemented, "no method to convert FcBlanks object", |
759 intern ("fc-config-get-blanks")); | |
760 } | |
761 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
762 DEFUN ("fc-config-get-rescan-interval", Ffc_config_get_rescan_interval, 1, 1, 0, /* |
4328
dfd878799ef0
Autoconfiscate the recent fontconfig spelling change.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3935
diff
changeset
|
763 -- Function: int FcConfigGetRescanInterval (FcConfig *config) |
3931 | 764 Returns the interval between automatic checks of the configuration |
765 (in seconds) specified in 'config'. The configuration is checked | |
766 during a call to FcFontList when this interval has passed since | |
767 the last check. */ | |
768 (config)) | |
769 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
770 CHECK_FC_CONFIG (config); |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5438
diff
changeset
|
771 return make_fixnum (FcConfigGetRescanInterval (XFC_CONFIG_PTR (config))); |
3931 | 772 } |
773 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
774 DEFUN ("fc-config-set-rescan-interval", Ffc_config_set_rescan_interval, 2, 2, 0, /* |
4328
dfd878799ef0
Autoconfiscate the recent fontconfig spelling change.
Aidan Kehoe <kehoea@parhasard.net>
parents:
3935
diff
changeset
|
775 -- Function: FcBool FcConfigSetRescanInterval (FcConfig *config, int |
3931 | 776 rescanInterval) |
777 Sets the rescan interval; returns FcFalse if an error occurred. | |
778 XEmacs: signal such error, or return nil on success. */ | |
779 (config, rescan_interval)) | |
780 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
781 CHECK_FC_CONFIG (config); |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5438
diff
changeset
|
782 CHECK_FIXNUM (rescan_interval); |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
783 if (FcConfigSetRescanInterval (XFC_CONFIG_PTR (config), |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5438
diff
changeset
|
784 XFIXNUM (rescan_interval)) == FcFalse) |
3931 | 785 signal_error (Qio_error, "FcConfigSetRescanInverval barfed", |
786 intern ("fc-config-set-rescan-interval")); | |
787 return Qnil; | |
788 } | |
789 | |
790 /* #### This might usefully be made interactive. */ | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
791 DEFUN ("fc-config-app-font-add-file", Ffc_config_app_font_add_file, 2, 2, 0, /* |
3931 | 792 -- Function: FcBool FcConfigAppFontAddFile (FcConfig *config, const |
793 char *file) | |
794 Adds an application-specific font to the configuration. */ | |
795 (config, file)) | |
796 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
797 CHECK_FC_CONFIG (config); |
3931 | 798 CHECK_STRING (file); |
799 if (FcConfigAppFontAddFile | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
800 (XFC_CONFIG_PTR (config), |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
801 /* #### FIXME! is Qfile_name right? */ |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4953
diff
changeset
|
802 (FcChar8 *) LISP_STRING_TO_EXTERNAL (file, Qfile_name)) == FcFalse) |
3931 | 803 return Qnil; |
804 else | |
805 return Qt; | |
806 } | |
807 | |
808 /* #### This might usefully be made interactive. */ | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
809 DEFUN ("fc-config-app-font-add-dir", Ffc_config_app_font_add_dir, 2, 2, 0, /* |
3931 | 810 -- Function: FcBool FcConfigAppFontAddDir (FcConfig *config, const |
811 char *dir) | |
812 Scans the specified directory for fonts, adding each one found to | |
813 the application-specific set of fonts. */ | |
814 (config, dir)) | |
815 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
816 CHECK_FC_CONFIG (config); |
3931 | 817 CHECK_STRING (dir); |
818 if (FcConfigAppFontAddDir | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
819 (XFC_CONFIG_PTR (config), |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
820 /* #### FIXME! is Qfile_name right? */ |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4953
diff
changeset
|
821 (FcChar8 *) LISP_STRING_TO_EXTERNAL (dir, Qfile_name)) == FcFalse) |
3931 | 822 return Qnil; |
823 else | |
824 return Qt; | |
825 } | |
826 | |
827 /* #### This might usefully be made interactive. */ | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
828 DEFUN ("fc-config-app-font-clear", Ffc_config_app_font_clear, 1, 1, 0, /* |
3931 | 829 -- Function: void FcConfigAppFontClear (FcConfig *config) |
830 Clears the set of application-specific fonts. */ | |
831 (config)) | |
832 { | |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
833 CHECK_FC_CONFIG (config); |
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
834 FcConfigAppFontClear (XFC_CONFIG_PTR (config)); |
3931 | 835 return Qnil; |
836 } | |
837 | |
838 /* These functions provide some control over how the default | |
839 configuration of the library is initialized. (This configuration is | |
840 normally implicitly initialized.) */ | |
841 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
842 DEFUN ("fc-config-filename", Ffc_config_filename, 1, 1, 0, /* |
3931 | 843 -- Function: char *FcConfigFilename (const char *name) |
844 Given the specified external entity name, return the associated | |
845 filename. This provides applications a way to convert various | |
846 configuration file references into filename form. | |
847 | |
848 A null or empty 'name' indicates that the default configuration | |
849 file should be used; which file this references can be overridden | |
850 with the FC_CONFIG_FILE environment variable. Next, if the name | |
851 starts with '~', it refers to a file in the current users home | |
852 directory. Otherwise if the name doesn't start with '/', it | |
853 refers to a file in the default configuration directory; the | |
854 built-in default directory can be overridden with the | |
855 FC_CONFIG_DIR environment variable. */ | |
856 (name)) | |
857 { | |
4932 | 858 const Ascbyte *fcname = ""; |
3931 | 859 |
860 if (!NILP (name)) | |
861 { | |
862 CHECK_STRING (name); | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4809
diff
changeset
|
863 /* #### FIXME! is Qfile_name right? */ |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4953
diff
changeset
|
864 LISP_PATHNAME_CONVERT_OUT (name, fcname); |
3931 | 865 } |
866 return (build_fcapi_string (FcConfigFilename ((FcChar8 *) fcname))); | |
867 } | |
868 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
869 DEFUN ("fc-init-load-config", Ffc_init_load_config, 0, 0, 0, /* |
3931 | 870 -- Function: FcConfig *FcInitLoadConfig (void) |
871 Loads the default configuration file and returns the resulting | |
872 configuration. Does not load any font information. */ | |
873 ()) | |
874 { | |
875 return fc_config_create_using (&FcInitLoadConfig); | |
876 } | |
877 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
878 DEFUN ("fc-init-load-config-and-fonts", Ffc_init_load_config_and_fonts, 0, 0, 0, /* |
3931 | 879 -- Function: FcConfig *FcInitLoadConfigAndFonts (void) |
880 Loads the default configuration file and builds information about | |
881 the available fonts. Returns the resulting configuration. */ | |
882 ()) | |
883 { | |
884 return fc_config_create_using (&FcInitLoadConfigAndFonts); | |
885 } | |
886 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
887 DEFUN ("fc-config-get-current", Ffc_config_get_current, 0, 0, 0, /* |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
888 -- Function: FcConfig *FcConfigGetCurrent (void) |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
889 Returns the current default configuration. */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
890 ()) |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
891 { |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
892 return fc_config_create_using (&FcConfigGetCurrent); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
893 } |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
894 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
895 /* Pattern manipulation functions. */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
896 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
897 DEFUN ("fc-default-substitute", Ffc_default_substitute, 1, 1, 0, /* |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
898 Adds defaults for certain attributes if not specified in PATTERN. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
899 FcPattern PATTERN is modified in-place, and nil is returned. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
900 * Patterns without a specified style or weight are set to Medium |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
901 * Patterns without a specified style or slant are set to Roman |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
902 * Patterns without a specified pixel size are given one computed from any |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
903 specified point size (default 12), dpi (default 75) and scale (default 1). */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
904 (pattern)) |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
905 { |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
906 CHECK_FC_PATTERN (pattern); |
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
907 FcDefaultSubstitute (XFC_PATTERN_PTR (pattern)); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
908 return Qnil; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
909 } |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
910 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
911 /* -- Function: FcBool FcConfigSubstituteWithPat (FcConfig *config, |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
912 FcPattern *p, FcPattern *p_pat FcMatchKind kind) |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
913 OMITTED: use optional arguments in `fc-config-substitute'. */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
914 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
915 DEFUN ("fc-config-substitute", Ffc_config_substitute, 1, 4, 0, /* |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
916 Modifies PATTERN according to KIND and TESTPAT using operations from CONFIG. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
917 PATTERN is modified in-place. Returns an undocumented Boolean value. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
918 If optional KIND is `fc-match-pattern', then those tagged as pattern operations |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
919 are applied, else if KIND is `fc-match-font', those tagged as font operations |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
920 are applied and TESTPAT is used for <test> elements with target=pattern. KIND |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
921 defaults to `fc-match-font'. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
922 If optional TESTPAT is nil, it is ignored. Otherwise it must be an FcPattern. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
923 Optional CONFIG must be an FcConfig, defaulting to the current one. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
924 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
925 Note that this function actually corresponds to FcConfigSubstituteWithPat, and |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
926 the argument order is changed to take advantage of Lisp optional arguments. */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
927 (pattern, kind, testpat, config)) |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
928 { |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
929 FcMatchKind knd; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
930 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
931 /* There ought to be a standard idiom for this.... */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
932 if (NILP (kind) |
4860 | 933 || EQ (kind, Qfc_match_font)) |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
934 knd = FcMatchFont; |
4860 | 935 else if (EQ (kind, Qfc_match_pattern)) |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
936 knd = FcMatchPattern; |
4860 | 937 else |
938 wtaerror ("need `fc-match-pattern' or `fc-match-font'", kind); | |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
939 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
940 /* Typecheck arguments */ |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
941 CHECK_FC_PATTERN (pattern); |
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
942 if (!NILP (testpat)) CHECK_FC_PATTERN (testpat); |
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
943 if (!NILP (config)) CHECK_FC_CONFIG (config); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
944 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
945 return (FcConfigSubstituteWithPat |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
946 (NILP (config) ? FcConfigGetCurrent () : XFC_CONFIG_PTR (config), |
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
947 XFC_PATTERN_PTR (pattern), |
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
948 NILP (testpat) ? NULL : XFC_PATTERN_PTR (testpat), |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
949 knd) == FcTrue) |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
950 ? Qt : Qnil; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
951 } |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
952 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
953 /* Pattern matching functions. */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
954 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
955 /* The following functions return fonts that match a certain pattern. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
956 `FcFontRenderPrepare' and `FcFontMatch' always return a single best |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
957 match. `FcFontList' returns the list of fonts that match a given |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
958 pattern on a certain set of properties. `FcFontSort' returns the |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
959 entire list of fonts, sorted in order of match quality, possibly |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
960 filtering out fonts that do not provide additional characters beyond |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
961 those provided by preferred fonts. */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
962 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
963 DEFUN ("fc-font-render-prepare", Ffc_font_render_prepare, 2, 3, 0, /* |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
964 Return a new pattern blending PATTERN and FONT. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
965 Optional CONFIG is an FcConfig, defaulting to the current one. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
966 The returned pattern consists of elements of FONT not appearing in PATTERN, |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
967 elements of PATTERN not appearing in FONT, and the best matching value from |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
968 PATTERN for elements appearing in both. The result is passed to |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
969 FcConfigSubstitute with 'kind' FcMatchFont and then returned. */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
970 (pattern, font, config)) |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
971 { |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
972 if (NILP (config)) { |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
973 config = Ffc_config_get_current (); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
974 } |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
975 CHECK_FC_PATTERN (pattern); |
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
976 CHECK_FC_PATTERN (font); |
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
977 CHECK_FC_CONFIG (config); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
978 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
979 /* I don't think this can fail? */ |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
980 return wrap_fc_pattern (FcFontRenderPrepare (XFC_CONFIG_PTR (config), |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
981 XFC_PATTERN_PTR (font), |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
982 XFC_PATTERN_PTR (pattern))); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
983 } |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
984 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
985 DEFUN ("fc-font-match", Ffc_font_match, 2, 3, 0, /* |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
986 Return the font on DEVICE that most closely matches PATTERN. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
987 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
988 DEVICE is an X11 device. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
989 PATTERN is a fontconfig pattern object. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
990 Optional CONFIG is an FcConfig, defaulting to the current one. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
991 Returns a fontconfig pattern object representing the closest match to the |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
992 given pattern, or an error code. Possible error codes are |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
993 `fc-result-no-match' and `fc-result-no-id'. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
994 PATTERN is massaged with FcConfigSubstitute and FcDefaultSubstitute before |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
995 being processed by FcFontMatch. */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
996 (device, pattern, config)) |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
997 { |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
998 FcResult res; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
999 struct fc_pattern *res_fcpat; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1000 FcPattern *p; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1001 FcConfig *fcc; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1002 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1003 CHECK_FC_PATTERN (pattern); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1004 if (NILP (device)) |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1005 return Qnil; |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1006 CHECK_X_DEVICE (device); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1007 if (!DEVICE_LIVE_P (XDEVICE (device))) |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1008 return Qnil; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1009 if (!NILP (config)) |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1010 CHECK_FC_CONFIG (config); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1011 |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1012 res_fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1013 p = XFC_PATTERN_PTR (pattern); |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1014 fcc = NILP (config) ? FcConfigGetCurrent () : XFC_CONFIG_PTR (config); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1015 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1016 FcConfigSubstitute (fcc, p, FcMatchPattern); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1017 FcDefaultSubstitute (p); |
4809
0d3ccd5a2509
Initialize the result variable passed to FcFontMatch. See xemacs-patches
Jerry James <james@xemacs.org>
parents:
4799
diff
changeset
|
1018 res = FcResultMatch; |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1019 res_fcpat->fcpatPtr = FcFontMatch (fcc, p, &res); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1020 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1021 if (res_fcpat->fcpatPtr == NULL) |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1022 switch (res) |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1023 { |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1024 case FcResultNoMatch: |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1025 return Qfc_result_no_match; |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1026 case FcResultNoId: |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1027 return Qfc_result_no_id; |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1028 default: |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1029 return Qfc_internal_error; |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1030 } |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1031 else |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1032 return wrap_fc_pattern (res_fcpat); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1033 } |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1034 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1035 /* #### fix this name to correspond to Ben's new nomenclature */ |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1036 DEFUN ("fc-list-fonts-pattern-objects", Ffc_list_fonts_pattern_objects, |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1037 3, 3, 0, /* |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1038 Return a list of fonts on DEVICE that match PATTERN for PROPERTIES. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1039 Each font is represented by a fontconfig pattern object. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1040 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1041 DEVICE is an X11 device. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1042 PATTERN is a fontconfig pattern to be matched. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1043 PROPERTIES is a list of property names (strings) that should match. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1044 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1045 #### DEVICE is unused, ignored, and may be removed if it's not needed to |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1046 match other font-listing APIs. */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1047 (UNUSED (device), pattern, properties)) |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1048 { |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1049 FcObjectSet *os; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1050 FcFontSet *fontset; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1051 |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1052 CHECK_FC_PATTERN (pattern); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1053 CHECK_LIST (properties); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1054 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1055 os = FcObjectSetCreate (); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1056 string_list_to_fcobjectset (properties, os); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1057 /* #### why don't we need to do the "usual substitutions"? */ |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1058 fontset = FcFontList (NULL, XFC_PATTERN_PTR (pattern), os); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1059 FcObjectSetDestroy (os); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1060 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1061 return fontset_to_list (fontset, DestroyYes); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1062 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1063 } |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1064 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1065 /* #### maybe this can/should be folded into fc-list-fonts-pattern-objects? */ |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1066 DEFUN ("fc-font-sort", Ffc_font_sort, 2, 4, 0, /* |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1067 Return a list of all fonts sorted by proximity to PATTERN. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1068 Each font is represented by a fontconfig pattern object. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1069 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1070 DEVICE is an X11 device. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1071 PATTERN is a fontconfig pattern to be matched. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1072 Optional argument TRIM, if non-nil, means to trim trailing fonts that do not |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1073 contribute new characters to the union repertoire. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1074 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1075 #### Optional argument NOSUB, if non-nil, suppresses some of the usual |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1076 property substitutions. DON'T USE THIS in production code, it is intended |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1077 for exploring behavior of fontconfig and will be removed when this code is |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1078 stable. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1079 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1080 #### DEVICE is unused, ignored, and may be removed if it's not needed to |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1081 match other font-listing APIs. */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1082 (UNUSED (device), pattern, trim, nosub)) |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1083 { |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1084 CHECK_FC_PATTERN (pattern); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1085 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1086 { |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1087 FcConfig *fcc = FcConfigGetCurrent(); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1088 FcFontSet *fontset; |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1089 FcPattern *p = XFC_PATTERN_PTR (pattern); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1090 FcResult fcresult; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1091 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1092 if (NILP (nosub)) /* #### temporary debug hack */ |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1093 FcDefaultSubstitute (p); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1094 FcConfigSubstitute (fcc, p, FcMatchPattern); |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1095 fontset = FcFontSort (fcc, p, !NILP (trim), NULL, &fcresult); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1096 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1097 return fontset_to_list (fontset, DestroyYes); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1098 } |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1099 } |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1100 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1101 #ifdef FONTCONFIG_EXPOSE_CONFIG |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1102 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1103 /* Configuration routines --- for debugging |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1104 Don't depend on these routines being available in the future! |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1105 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1106 3.2.10 Initialization |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1107 --------------------- |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1108 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1109 An FcConfig object holds the internal representation of a configuration. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1110 There is a default configuration which applications may use by passing |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1111 0 to any function using the data within an FcConfig. |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1112 */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1113 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1114 static void |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1115 finalize_fc_config (Lisp_Object obj) |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1116 { |
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1117 struct fc_config *p = XFC_CONFIG (obj); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1118 if (p->fccfgPtr && p->fccfgPtr != FcConfigGetCurrent()) |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1119 { |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1120 /* If we get here, all of *our* references are garbage (see comment on |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1121 fc_config_create_using() for why), and the only reference that |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1122 fontconfig keeps is the current FcConfig. */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1123 FcConfigDestroy (p->fccfgPtr); |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1124 } |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1125 p->fccfgPtr = 0; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1126 } |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1127 |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1128 static const struct memory_description fcconfig_description [] = { |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1129 /* #### nothing here, is this right?? */ |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1130 { XD_END } |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1131 }; |
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1132 |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4758
diff
changeset
|
1133 DEFINE_NODUMP_LISP_OBJECT ("fc-config", fc_config, |
5142
f965e31a35f0
reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents:
5127
diff
changeset
|
1134 0, external_object_printer, finalize_fc_config, |
f965e31a35f0
reduce lcrecord headers to 2 words, rename printing_unreadable_object
Ben Wing <ben@xemacs.org>
parents:
5127
diff
changeset
|
1135 0, 0, fcconfig_description, |
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4758
diff
changeset
|
1136 struct fc_config); |
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1137 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1138 DEFUN ("fc-init", Ffc_init, 0, 0, 0, /* |
3931 | 1139 -- Function: FcBool FcInit (void) |
1140 Loads the default configuration file and the fonts referenced | |
1141 therein and sets the default configuration to that result. | |
1142 Returns whether this process succeeded or not. If the default | |
1143 configuration has already been loaded, this routine does nothing | |
1144 and returns FcTrue. */ | |
1145 ()) | |
1146 { | |
1147 return (FcInit () == FcTrue) ? Qt : Qnil; | |
1148 } | |
1149 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1150 DEFUN ("fc-get-version", Ffc_get_version, 0, 0, 0, /* |
3931 | 1151 -- Function: int FcGetVersion (void) |
1152 Returns the version number of the library. | |
3935 | 1153 XEmacs: No, this should NOT return a pretty string. |
3931 | 1154 (let ((i (fc-get-version))) |
1155 (format "%d.%d.%d" (/ i 10000) (mod (/ i 100) 100) (mod i 100))) | |
3935 | 1156 gives the usual x.y.z format. This is the version of the .so. It can be |
1157 checked against `fc-version', which is the version of fontconfig.h. | |
1158 It's probably not a disaster if `(> (fc-get-version) fc-version)'. */ | |
3931 | 1159 ()) |
1160 { | |
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5438
diff
changeset
|
1161 return make_fixnum (FcGetVersion ()); |
3931 | 1162 } |
1163 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1164 DEFUN ("fc-init-reinitialize", Ffc_init_reinitialize, 0, 0, 0, /* |
3931 | 1165 -- Function: FcBool FcInitReinitialize (void) |
1166 Forces the default configuration file to be reloaded and resets | |
1167 the default configuration. */ | |
1168 ()) | |
1169 { | |
1170 return (FcInitReinitialize () == FcTrue) ? Qt : Qnil; | |
1171 } | |
1172 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1173 DEFUN ("fc-init-bring-up-to-date", Ffc_init_bring_up_to_date, 0, 0, 0, /* |
3931 | 1174 -- Function: FcBool FcInitBringUptoDate (void) |
1175 Checks the rescan interval in the default configuration, checking | |
1176 the configuration if the interval has passed and reloading the | |
1177 configuration when any changes are detected. */ | |
1178 ()) | |
1179 { | |
1180 return (FcInitBringUptoDate () == FcTrue) ? Qt : Qnil; | |
1181 } | |
1182 | |
1183 #endif /* FONTCONFIG_EXPOSE_CONFIG */ | |
1184 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1185 DEFUN ("xlfd-font-name-p", Fxlfd_font_name_p, 1, 1, 0, /* |
3354 | 1186 Check whether the string FONTNAME is a XLFD font name. */ |
1187 (fontname)) | |
1188 { | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1189 CHECK_STRING (fontname); |
3354 | 1190 /* #### should bind `case-fold-search' here? */ |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1191 return Fstring_match (Vxlfd_font_name_regexp, fontname, Qnil, Qnil); |
3354 | 1192 } |
1193 | |
1194 /* FcPatternPrint: there is no point in having wrappers fc-pattern-print, | |
1195 Ffc_pattern_print since this function prints to stdout. */ | |
1196 | |
1197 /* Initialization of font-mgr */ | |
1198 | |
1199 #define XE_XLFD_SEPARATOR "-" | |
1200 /* XLFD specifies ISO 8859-1 encoding, but we can't handle non-ASCII | |
1201 in Mule when this function is called. So use HPC. */ | |
1202 #if 0 | |
1203 #define XE_XLFD_PREFIX "\\(\\+[\040-\176\240-\377]*\\)?-" | |
1204 #define XE_XLFD_OPT_TEXT "\\([\040-\044\046-\176\240-\377]*\\)" | |
1205 #define XE_XLFD_TEXT "\\([\040-\044\046-\176\240-\377]+\\)" | |
1206 #else | |
1207 #define XE_XLFD_PREFIX "\\(\\+[\040-\176]*\\)?-" | |
1208 #define XE_XLFD_OPT_TEXT "\\([^-]*\\)" | |
1209 #define XE_XLFD_TEXT "\\([^-]+\\)" | |
1210 #endif | |
1211 | |
1212 #define XE_XLFD_SLANT "\\([0-9ior?*][iot]?\\)" | |
1213 #define XE_XLFD_SPACING "\\([cmp?*]\\)" | |
1214 /* Hyphen as minus conflicts with use as separator. */ | |
1215 #define XE_XLFD_OPT_NEGATE "~?" | |
1216 #define XE_XLFD_NUMBER "\\([0-9?*]+\\)" | |
1217 #define XE_XLFD_PSIZE "\\([0-9?*]+\\|\\[[ 0-9+~.e?*]+\\]\\)" | |
1218 | |
1219 /* Call this only from the init code | |
1220 #### This is really horrible, let's get rid of it, please. */ | |
1221 static Lisp_Object | |
1222 make_xlfd_font_regexp (void) | |
1223 { | |
1224 struct gcpro gcpro1; | |
1225 unsigned i; | |
1226 Lisp_Object reg = Qnil; | |
1227 const Extbyte *re[] = /* #### This could just be catenated by | |
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
1228 cpp and passed to build_extstring. */ |
3354 | 1229 { |
1230 /* Regular expression matching XLFDs as defined by XLFD v. 1.5. | |
1231 Matches must be case-insensitive. | |
1232 PSIZE is a pixel or point size, which may be a "matrix". The | |
1233 syntax of a matrix is not checked, just some lexical properties. | |
1234 AFAICT none of the TEXT fields except adstyle is optional. | |
1235 | |
1236 NB. It should not be a problem if this matches "too much", since | |
1237 an "old" server will simply not be able to find a matching font. */ | |
1238 "\\`", | |
1239 XE_XLFD_PREFIX, /* prefix */ | |
1240 XE_XLFD_TEXT, /* foundry */ | |
1241 XE_XLFD_SEPARATOR, | |
1242 XE_XLFD_TEXT, /* family */ | |
1243 XE_XLFD_SEPARATOR, | |
1244 XE_XLFD_TEXT, /* weight */ | |
1245 XE_XLFD_SEPARATOR, | |
1246 XE_XLFD_SLANT, /* slant */ | |
1247 XE_XLFD_SEPARATOR, | |
1248 XE_XLFD_TEXT, /* swidth */ | |
1249 XE_XLFD_SEPARATOR, | |
1250 XE_XLFD_OPT_TEXT, /* adstyle */ | |
1251 XE_XLFD_SEPARATOR, | |
1252 XE_XLFD_PSIZE, /* pixelsize */ | |
1253 XE_XLFD_SEPARATOR, | |
1254 XE_XLFD_PSIZE, /* pointsize */ | |
1255 XE_XLFD_SEPARATOR, | |
1256 XE_XLFD_NUMBER, /* resx */ | |
1257 XE_XLFD_SEPARATOR, | |
1258 XE_XLFD_NUMBER, /* resy */ | |
1259 XE_XLFD_SEPARATOR, | |
1260 XE_XLFD_SPACING, /* spacing */ | |
1261 XE_XLFD_SEPARATOR, | |
1262 XE_XLFD_OPT_NEGATE, /* avgwidth */ | |
1263 XE_XLFD_NUMBER, | |
1264 XE_XLFD_SEPARATOR, | |
1265 XE_XLFD_TEXT, /* registry */ | |
1266 XE_XLFD_SEPARATOR, | |
1267 XE_XLFD_TEXT, /* encoding */ | |
1268 "\\'" | |
1269 }; | |
1270 | |
1271 GCPRO1 (reg); | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1272 for (i = 0; i < sizeof (re)/sizeof (Extbyte *); i++) |
3354 | 1273 { |
1274 /* #### Currently this is Host Portable Coding, not ISO 8859-1. */ | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1275 reg = concat2 (reg, build_extstring (re[i], Qx_font_name_encoding)); |
3354 | 1276 } |
1277 | |
1278 RETURN_UNGCPRO (reg); | |
1279 } | |
1280 #undef XE_XLFD_SEPARATOR | |
1281 #undef XE_XLFD_PREFIX | |
1282 #undef XE_XLFD_OPT_TEXT | |
1283 #undef XE_XLFD_TEXT | |
1284 #undef XE_XLFD_OPT_SLANT | |
1285 #undef XE_XLFD_OPT_SPACING | |
1286 #undef XE_XLFD_OPT_NEGATE | |
1287 #undef XE_XLFD_NUMBER | |
1288 #undef XE_XLFD_PSIZE | |
1289 | |
1290 #define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \ | |
1291 ? ((unsigned long) (x)) : ((unsigned long) (y))) | |
1292 | |
1293 static void | |
1294 string_list_to_fcobjectset (Lisp_Object list, FcObjectSet *os) | |
1295 { | |
1296 EXTERNAL_LIST_LOOP_2 (elt, list) | |
1297 { | |
3469 | 1298 const Extbyte *s; |
3354 | 1299 |
1300 CHECK_STRING (elt); | |
1301 s = fc_intern (elt); | |
1302 FcObjectSetAdd (os, s); | |
1303 } | |
1304 } | |
1305 | |
1306 void | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1307 syms_of_font_mgr (void) |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1308 { |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1309 INIT_LISP_OBJECT (fc_pattern); |
3354 | 1310 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1311 DEFSYMBOL_MULTIWORD_PREDICATE (Qfc_patternp); |
3354 | 1312 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1313 DEFSYMBOL (Qfc_result_type_mismatch); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1314 DEFSYMBOL (Qfc_result_no_match); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1315 DEFSYMBOL (Qfc_result_no_id); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1316 DEFSYMBOL (Qfc_internal_error); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1317 DEFSYMBOL (Qfc_match_pattern); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1318 DEFSYMBOL (Qfc_match_font); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1319 DEFSYMBOL (Qfont_mgr); |
3354 | 1320 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1321 DEFSUBR (Ffc_pattern_p); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1322 DEFSUBR (Ffc_pattern_create); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1323 DEFSUBR (Ffc_name_parse); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1324 DEFSUBR (Ffc_name_unparse); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1325 DEFSUBR (Ffc_pattern_duplicate); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1326 DEFSUBR (Ffc_pattern_add); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1327 DEFSUBR (Ffc_pattern_del); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1328 DEFSUBR (Ffc_pattern_get); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1329 DEFSUBR (Ffc_list_fonts_pattern_objects); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1330 DEFSUBR (Ffc_font_sort); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1331 DEFSUBR (Ffc_font_match); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1332 DEFSUBR (Ffc_default_substitute); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1333 DEFSUBR (Ffc_config_substitute); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1334 DEFSUBR (Ffc_font_render_prepare); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1335 DEFSUBR (Fxlfd_font_name_p); |
3931 | 1336 |
1337 #ifdef FONTCONFIG_EXPOSE_CONFIG | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1338 INIT_LISP_OBJECT (fc_config); |
3931 | 1339 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1340 DEFSYMBOL_MULTIWORD_PREDICATE (Qfc_configp); |
3931 | 1341 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1342 DEFSUBR (Ffc_config_p); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1343 DEFSUBR (Ffc_config_create); |
3931 | 1344 #if 0 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1345 DEFSUBR (Ffc_config_destroy); |
3931 | 1346 #endif |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1347 DEFSUBR (Ffc_config_set_current); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1348 DEFSUBR (Ffc_config_get_current); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1349 DEFSUBR (Ffc_config_up_to_date); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1350 DEFSUBR (Ffc_config_build_fonts); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1351 DEFSUBR (Ffc_config_get_config_dirs); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1352 DEFSUBR (Ffc_config_get_font_dirs); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1353 DEFSUBR (Ffc_config_get_config_files); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1354 DEFSUBR (Ffc_config_get_cache); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1355 DEFSUBR (Ffc_config_get_fonts); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1356 DEFSUBR (Ffc_config_get_blanks); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1357 DEFSUBR (Ffc_config_get_rescan_interval); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1358 DEFSUBR (Ffc_config_set_rescan_interval); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1359 DEFSUBR (Ffc_config_app_font_add_file); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1360 DEFSUBR (Ffc_config_app_font_add_dir); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1361 DEFSUBR (Ffc_config_app_font_clear); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1362 DEFSUBR (Ffc_config_filename); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1363 DEFSUBR (Ffc_init_load_config); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1364 DEFSUBR (Ffc_init_load_config_and_fonts); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1365 DEFSUBR (Ffc_init); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1366 DEFSUBR (Ffc_get_version); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1367 DEFSUBR (Ffc_init_reinitialize); |
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1368 DEFSUBR (Ffc_init_bring_up_to_date); |
3931 | 1369 #endif /* FONTCONFIG_EXPOSE_CONFIG */ |
3354 | 1370 } |
1371 | |
1372 void | |
1373 vars_of_font_mgr (void) | |
1374 { | |
3935 | 1375 /* #### The next two DEFVARs belong somewhere else. */ |
3354 | 1376 |
1377 /* #### I know, but the right fix is use the generic debug facility. */ | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1378 DEFVAR_INT ("debug-xft", &debug_xft /* |
3354 | 1379 Level of debugging messages to issue to stderr for Xft. |
1380 A nonnegative integer. Set to 0 to suppress all warnings. | |
1381 Default is 1 to ensure a minimum of debugging output at initialization. | |
1382 Higher levels give even more information. | |
1383 */ ); | |
4757
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4328
diff
changeset
|
1384 debug_xft = 0; |
3354 | 1385 |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1386 DEFVAR_CONST_INT ("xft-version", &xft_version /* |
3354 | 1387 The major version number of the Xft library being used. |
1388 */ ); | |
3935 | 1389 xft_version = XFT_VERSION; |
1390 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1391 DEFVAR_CONST_INT ("fc-version", &fc_version /* |
3935 | 1392 The version number of fontconfig.h. It can be checked against |
1393 `(fc-get-version)', which is the version of the .so. | |
1394 It's probably not a disaster if `(> (fc-get-version) fc-version)'. | |
1395 */ ); | |
1396 fc_version = FC_VERSION; | |
3354 | 1397 |
3360 | 1398 Fprovide (intern ("font-mgr")); |
3354 | 1399 } |
1400 | |
1401 void | |
1402 complex_vars_of_font_mgr (void) | |
1403 { | |
3931 | 1404 #ifdef FONTCONFIG_EXPOSE_CONFIG |
1405 Vfc_config_weak_list = make_weak_list (WEAK_LIST_SIMPLE); | |
1406 staticpro (&Vfc_config_weak_list); | |
1407 #endif | |
1408 | |
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1409 DEFVAR_LISP ("xft-xlfd-font-regexp", &Vxlfd_font_name_regexp /* |
5763
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
1410 The regular expression used to match XLFD font names. |
23dc211f4d2f
Make fc-name-parse signal on invalid-argument.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
5736
diff
changeset
|
1411 */ ); |
3354 | 1412 Vxlfd_font_name_regexp = make_xlfd_font_regexp(); |
1413 } | |
1414 | |
1415 void | |
1416 reinit_vars_of_font_mgr (void) | |
1417 { | |
1418 int i, size = (int) countof (fc_standard_properties); | |
1419 | |
1420 FcInit (); | |
1421 | |
1422 fc_property_name_hash_table = make_string_hash_table (size); | |
1423 for (i = 0; i < size; ++i) | |
1424 puthash (fc_standard_properties[i], NULL, fc_property_name_hash_table); | |
1425 } | |
1426 |