Mercurial > hg > xemacs-beta
annotate src/font-mgr.c @ 5533:11da5b828d10
shell-command and shell-command-on-region API compliant with FSF 23.3.1
| author | Mats Lidell <mats.lidell@cag.se> |
|---|---|
| date | Sun, 31 Jul 2011 01:29:09 +0200 |
| parents | 8d29f1c4bb98 |
| children | 56144c8593a8 |
| 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 | |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
5 Copyright (C) 2004-2009 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 /* | |
| 146 extract the C representation of the Lisp string STR and convert it | |
| 147 to the encoding used by the Fontconfig API for property and font | |
| 148 names. I suppose that Qnative is the right encoding, the manual | |
| 149 doesn't say much about this topic. This functions assumes that STR | |
| 150 is a Lisp string. | |
| 151 */ | |
| 152 #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
|
153 (LISP_STRING_TO_EXTERNAL ((str), Qfc_font_name_encoding)) |
| 3354 | 154 |
| 3906 | 155 #define build_fcapi_string(str) \ |
|
4953
304aebb79cd3
function renamings to track names of char typedefs
Ben Wing <ben@xemacs.org>
parents:
4932
diff
changeset
|
156 (build_extstring ((Extbyte *) (str), Qfc_font_name_encoding)) |
| 3906 | 157 |
| 3360 | 158 /* #### This homebrew lashup should be replaced with FcConstants. |
| 159 | |
| 160 fontconfig assumes that objects (property names) are statically allocated, | |
| 3354 | 161 and you will get bizarre results if you pass Lisp string data or strings |
| 162 allocated on the stack as objects. fontconfig _does_ copy values, so we | |
| 163 (I hope) don't have to worry about that member. | |
| 164 | |
| 165 Probably these functions don't get called so often that the memory leak | |
| 166 due to strdup'ing every time we add a property would matter, but XEmacs | |
| 167 _is_ a long-running process. So we hash them. | |
| 168 | |
| 169 I suspect that using symbol names or even keywords does not provide | |
| 170 assurance that the string won't move in memory. So we hash them | |
| 3360 | 171 ourselves; hash.c hashtables do not interpret the value pointers. |
| 172 | |
| 173 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
|
174 static const Extbyte *fc_standard_properties[] = |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
175 { |
| 3360 | 176 /* treated specially, ordered first */ |
| 177 "family", "size", | |
| 178 /* remaining are alphabetized by group */ | |
| 179 /* standard properties in fontconfig and Xft v.2 */ | |
| 180 "antialias", "aspect", "autohint", "charset", "dpi", "file", | |
| 3354 | 181 "foundry", "ftface", "globaladvance", "hinting", "index", "lang", |
| 182 "minspace", "outline", "pixelsize", "rasterizer", "rgba", "scalable", | |
| 3360 | 183 "scale", "slant", "spacing", "style", "verticallayout", "weight", |
| 184 /* common in modern fonts */ | |
| 185 "fontformat", "fontversion", | |
| 3354 | 186 /* obsolete after Xft v. 1 */ |
| 187 "charwidth", "charheight", "core", "encoding", "render" | |
| 188 }; | |
| 189 | |
| 190 static struct hash_table *fc_property_name_hash_table; | |
| 191 | |
| 192 /* #### Maybe fc_intern should be exposed to LISP? The idea is that | |
| 193 fc-pattern-add could warn or error if the property isn't interned. */ | |
| 194 | |
| 3469 | 195 static const Extbyte * |
| 3354 | 196 fc_intern (Lisp_Object property) |
| 197 { | |
| 198 const void *dummy; | |
| 3469 | 199 const Extbyte *prop = extract_fcapi_string (property); |
| 3354 | 200 const void *val = gethash (prop, fc_property_name_hash_table, &dummy); |
| 201 | |
| 202 /* extract_fcapi_string returns something alloca'd | |
| 203 so we can just drop the old value of prop on the floor */ | |
| 204 if (val) | |
| 3469 | 205 prop = (const Extbyte *) val; |
| 3354 | 206 else |
| 207 { | |
| 3469 | 208 prop = (const Extbyte *) FcStrCopy ((FcChar8 *) prop); |
| 3354 | 209 puthash (prop, NULL, fc_property_name_hash_table); |
| 210 } | |
| 211 return prop; | |
| 212 } | |
| 213 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
214 DEFUN ("fc-pattern-p", Ffc_pattern_p, 1, 1, 0, /* |
| 3354 | 215 Returns t if OBJECT is of type fc-pattern, nil otherwise. |
| 216 */ | |
| 217 (object)) | |
| 218 { | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
219 return FC_PATTERNP (object) ? Qt : Qnil; |
| 3354 | 220 } |
| 221 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
222 DEFUN ("fc-pattern-create", Ffc_pattern_create, 0, 0, 0, /* |
| 3354 | 223 Return a new, empty fc-pattern object. |
| 224 */ | |
| 225 ()) | |
| 226 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
227 fc_pattern *fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); |
| 3354 | 228 |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4758
diff
changeset
|
229 fcpat->fcpatPtr = FcPatternCreate (); |
|
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, /* |
| 3354 | 234 Parse an Fc font name and return its representation as a fc pattern object. |
| 235 */ | |
| 236 (name)) | |
| 237 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
238 fc_pattern *fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); |
| 3354 | 239 |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4758
diff
changeset
|
240 CHECK_STRING (name); |
| 3354 | 241 |
| 3469 | 242 fcpat->fcpatPtr = FcNameParse ((FcChar8 *) extract_fcapi_string (name)); |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
243 return wrap_fc_pattern (fcpat); |
| 3354 | 244 } |
| 245 | |
| 246 /* #### Ga-a-ack! Xft's similar function is actually a different API. | |
| 247 We provide both. */ | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
248 DEFUN ("fc-name-unparse", Ffc_name_unparse, 1, 1, 0, /* |
| 3354 | 249 Unparse an fc pattern object to a string. |
| 250 */ | |
| 251 (pattern)) | |
| 252 { | |
|
4799
ca99a807b025
Free, rather than discard, the return value of FcNameUnparse. See message
Jerry James <james@xemacs.org>
parents:
4758
diff
changeset
|
253 FcChar8 *name; |
|
ca99a807b025
Free, rather than discard, the return value of FcNameUnparse. See message
Jerry James <james@xemacs.org>
parents:
4758
diff
changeset
|
254 Lisp_Object result; |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
255 CHECK_FC_PATTERN (pattern); |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
256 name = FcNameUnparse (XFC_PATTERN_PTR (pattern)); |
|
4799
ca99a807b025
Free, rather than discard, the return value of FcNameUnparse. See message
Jerry James <james@xemacs.org>
parents:
4758
diff
changeset
|
257 result = build_fcapi_string (name); |
|
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
4953
diff
changeset
|
258 xfree (name); |
|
4799
ca99a807b025
Free, rather than discard, the return value of FcNameUnparse. See message
Jerry James <james@xemacs.org>
parents:
4758
diff
changeset
|
259 return result; |
| 3354 | 260 } |
| 261 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
262 DEFUN ("fc-pattern-duplicate", Ffc_pattern_duplicate, 1, 1, 0, /* |
| 3354 | 263 Make a copy of the fc pattern object PATTERN and return it. |
| 264 */ | |
| 265 (pattern)) | |
| 266 { | |
| 267 struct fc_pattern *copy = NULL; | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
268 CHECK_FC_PATTERN (pattern); |
| 3354 | 269 |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
270 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
|
271 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
|
272 return wrap_fc_pattern (copy); |
| 3354 | 273 } |
| 274 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
275 DEFUN ("fc-pattern-add", Ffc_pattern_add, 3, 3, 0, /* |
| 3354 | 276 Add attributes to the pattern object PATTERN. PROPERTY is a string naming |
| 277 the attribute to add, VALUE the value for this attribute. | |
| 278 | |
| 279 VALUE may be a string, integer, float, or symbol, in which case the value | |
| 280 will be added as an FcChar8[], int, double, or FcBool respectively. | |
| 281 */ | |
| 282 (pattern, property, value)) | |
| 283 { | |
| 284 Bool res = 0; | |
| 3469 | 285 const Extbyte *obj; |
| 3354 | 286 FcPattern *fcpat; |
| 287 | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
288 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
|
289 CHECK_STRING (property); |
| 3354 | 290 |
| 291 obj = fc_intern (property); | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
292 fcpat = XFC_PATTERN_PTR (pattern); |
| 3354 | 293 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
294 if (STRINGP (value)) |
| 3354 | 295 { |
| 296 FcChar8 *str = (FcChar8 *) extract_fcapi_string (value); | |
| 297 res = FcPatternAddString (fcpat, obj, str); | |
| 298 } | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
299 else if (INTP (value)) |
| 3354 | 300 { |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
301 res = FcPatternAddInteger (fcpat, obj, XINT (value)); |
| 3354 | 302 } |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
303 else if (FLOATP (value)) |
| 3354 | 304 { |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
305 res = FcPatternAddDouble (fcpat, obj, (double) XFLOAT_DATA (value)); |
| 3354 | 306 } |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
307 else if (SYMBOLP (value)) |
| 3354 | 308 { |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
309 res = FcPatternAddBool (fcpat, obj, !NILP (value)); |
| 3354 | 310 } |
| 311 /* else ... maybe we should wta here? */ | |
| 312 | |
| 313 return res ? Qt : Qnil; | |
| 314 } | |
| 315 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
316 DEFUN ("fc-pattern-del", Ffc_pattern_del, 2, 2, 0, /* |
| 3354 | 317 Remove attribute PROPERTY from fc pattern object OBJECT. |
| 318 */ | |
| 319 (pattern, property)) | |
| 320 { | |
| 321 Bool res; | |
| 322 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
323 CHECK_FC_PATTERN (pattern); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
324 CHECK_STRING (property); |
| 3354 | 325 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
326 res = FcPatternDel (XFC_PATTERN_PTR (pattern), extract_fcapi_string (property)); |
| 3354 | 327 return res ? Qt : Qnil; |
| 328 } | |
| 329 | |
| 330 /* Generic interface to FcPatternGet() | |
| 331 * Don't support the losing symbol-for-property interface. | |
| 332 */ | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
333 DEFUN ("fc-pattern-get", Ffc_pattern_get, 2, 4, 0, /* |
| 3354 | 334 From PATTERN, extract PROPERTY for the ID'th member, of type TYPE. |
| 335 | |
| 336 PATTERN is an Xft (fontconfig) pattern object. | |
| 337 PROPERTY is a string naming an fontconfig font property. | |
| 338 Optional ID is a nonnegative integer indexing the list of values for PROPERTY | |
| 339 stored in PATTERN, defaulting to 0 (the first value). | |
| 340 Optional TYPE is a symbol, one of 'string, 'boolean, 'integer, 'float, | |
| 341 'double, 'matrix, 'charset, or 'void, corresponding to the FcValue types. | |
| 342 ('float is an alias for 'double). | |
| 343 | |
| 344 The Lisp types returned will conform to TYPE: | |
| 345 string string | |
| 346 boolean `t' or `nil' | |
| 347 integer integer | |
| 348 double (float) float | |
| 349 matrix not implemented | |
| 350 charset not implemented | |
| 351 void not implemented | |
| 352 | |
| 353 Symbols with names of the form "fc-result-DESCRIPTION" are returned when | |
| 354 the desired value is not available. These are | |
| 355 | |
| 356 fc-result-type-mismatch the value found has an unexpected type | |
| 357 fc-result-no-match there is no such attribute | |
| 358 fc-result-no-id there is no value for the requested ID | |
| 359 | |
| 360 The types of the following standard properties are predefined by fontconfig. | |
| 361 The symbol 'fc-result-type-mismatch will be returned if the object exists but | |
| 362 TYPE does not match the predefined type. It is best not to specify a type | |
| 363 for predefined properties, as a mistake here ensures error returns on the | |
| 364 correct type. | |
| 365 | |
| 366 Each standard property has a convenience accessor defined in fontconfig.el, | |
| 367 named in the form "fc-pattern-get-PROPERTY". The convenience functions are | |
| 368 preferred to `fc-pattern-get' since a typo in the string naming a property | |
| 369 will result in a silent null return, while a typo in a function name will | |
| 370 usually result in a compiler or runtime \"not fboundp\" error. You may use | |
| 371 `defsubst' to define convenience functions for non-standard properties. | |
| 372 | |
| 373 family String Font family name | |
| 374 style String Font style. Overrides weight and slant | |
| 375 slant Int Italic, oblique or roman | |
| 376 weight Int Light, medium, demibold, bold or black | |
| 377 size Double Point size | |
| 378 aspect Double Stretches glyphs horizontally before hinting | |
| 379 pixelsize Double Pixel size | |
| 380 spacing Int Proportional, monospace or charcell | |
| 381 foundry String Font foundry name | |
| 382 antialias Bool Whether glyphs can be antialiased | |
| 383 hinting Bool Whether the rasterizer should use hinting | |
| 384 verticallayout Bool Use vertical layout | |
| 385 autohint Bool Use autohinter instead of normal hinter | |
| 386 globaladvance Bool Use font global advance data | |
| 387 file String The filename holding the font | |
| 388 index Int The index of the font within the file | |
| 389 ftface FT_Face Use the specified FreeType face object | |
| 390 rasterizer String Which rasterizer is in use | |
| 391 outline Bool Whether the glyphs are outlines | |
| 392 scalable Bool Whether glyphs can be scaled | |
| 393 scale Double Scale factor for point->pixel conversions | |
| 394 dpi Double Target dots per inch | |
| 395 rgba Int unknown, rgb, bgr, vrgb, vbgr, none - subpixel geometry | |
| 396 minspace Bool Eliminate leading from line spacing | |
| 397 charset CharSet Unicode chars encoded by the font | |
| 398 lang String List of RFC-3066-style languages this font supports | |
| 399 | |
| 400 The FT_Face, Matrix, CharSet types are unimplemented, so the corresponding | |
| 401 properties are not accessible from Lisp at this time. If the value of a | |
| 402 property returned has type FT_Face, FcCharSet, or FcMatrix, | |
| 403 `fc-result-type-mismatch' is returned. | |
| 404 | |
| 405 The following properties which were standard in Xft v.1 are obsolete in | |
| 406 Xft v.2: encoding, charwidth, charheight, core, and render. */ | |
| 407 (pattern, property, id, type)) | |
| 408 { | |
| 3469 | 409 Extbyte *fc_property; |
| 3354 | 410 FcResult fc_result; |
| 411 FcValue fc_value; | |
|
5307
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
412 int int_id = 0; |
| 3354 | 413 |
| 414 /* | |
| 415 process arguments | |
| 416 */ | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
417 CHECK_FC_PATTERN (pattern); |
| 3354 | 418 |
| 419 #if 0 | |
| 420 /* Don't support the losing symbol-for-property interface. */ | |
| 421 property = SYMBOLP (property) ? symbol_name (XSYMBOL (property)) : property; | |
| 422 #endif | |
| 423 if (STRINGP (property)) | |
| 424 { | |
| 3469 | 425 fc_property = extract_fcapi_string (property); |
| 3354 | 426 } |
| 427 else | |
| 428 { | |
| 429 /* if we allow symbols, this would need to be | |
| 430 list3 (Qlambda, list1 (Qobject), | |
| 431 list3 (Qor, list2 (Qstringp, Qobject), | |
| 432 list2 (Qsymbolp, Qobject))) | |
| 433 or something like that? */ | |
| 434 dead_wrong_type_argument (Qstringp, property); | |
| 435 } | |
| 436 | |
|
5307
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
437 if (!NILP (id)) |
|
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
438 { |
|
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
439 #ifdef HAVE_BIGNUM |
|
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
440 check_integer_range (id, Qzero, make_integer (INT_MAX)); |
|
5308
17c381a2f377
Fix my last change when both --with-union-type and --with-xft, thanks Robert.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5307
diff
changeset
|
441 int_id = BIGNUMP (id) ? bignum_to_int (XBIGNUM_DATA (id)) : XINT (id); |
|
5307
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
442 #else |
|
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
443 check_integer_range (id, Qzero, make_integer (EMACS_INT_MAX)); |
|
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
444 int_id = XINT (id); |
|
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
445 #endif |
|
c096d8051f89
Have NATNUMP give t for positive bignums; check limits appropriately.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5189
diff
changeset
|
446 } |
| 3354 | 447 if (!NILP (type)) CHECK_SYMBOL (type); |
| 448 | |
| 449 /* get property */ | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
450 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
|
451 fc_property, int_id, &fc_value); |
| 3354 | 452 |
| 453 switch (fc_result) | |
| 454 { | |
| 455 case FcResultMatch: | |
| 456 /* wrap it and return */ | |
| 457 switch (fc_value.type) | |
| 458 { | |
| 459 case FcTypeInteger: | |
| 460 return ((!NILP (type) && !EQ (type, Qinteger)) | |
| 461 ? Qfc_result_type_mismatch : make_int (fc_value.u.i)); | |
| 462 case FcTypeDouble: | |
| 463 return ((!NILP (type) && !EQ (type, intern ("double")) | |
| 464 && !EQ (type, Qfloat)) | |
| 465 ? Qfc_result_type_mismatch : make_float (fc_value.u.d)); | |
| 466 case FcTypeString: | |
| 467 return ((!NILP (type) && !EQ (type, Qstring)) | |
| 468 ? Qfc_result_type_mismatch | |
| 3906 | 469 : build_fcapi_string (fc_value.u.s)); |
| 3354 | 470 case FcTypeBool: |
| 471 return ((!NILP (type) && !EQ (type, Qboolean)) | |
| 472 ? Qfc_result_type_mismatch : fc_value.u.b ? Qt : Qnil); | |
| 473 case FcTypeMatrix: | |
| 474 return Qfc_result_type_mismatch; | |
| 475 /* #### unimplemented | |
| 476 return ((!NILP (type) && !EQ (type, intern ("matrix"))) | |
| 477 ? Qfc_result_type_mismatch : make_int (fc_value.u.m)); | |
| 478 */ | |
| 479 case FcTypeCharSet: | |
| 480 return Qfc_result_type_mismatch; | |
| 481 /* #### unimplemented | |
| 482 return ((!NILP (type) && !EQ (type, intern ("charset"))) | |
| 483 ? Qfc_result_type_mismatch : make_int (fc_value.u.c)); | |
| 484 */ | |
| 485 } | |
| 486 case FcResultTypeMismatch: | |
| 487 return Qfc_result_type_mismatch; | |
| 488 case FcResultNoMatch: | |
| 489 return Qfc_result_no_match; | |
| 490 case FcResultNoId: | |
| 491 return Qfc_result_no_id; | |
| 492 default: | |
| 493 return Qfc_internal_error; | |
| 494 } | |
| 495 } | |
| 496 | |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
497 /* FcConfig handling functions. */ |
| 3354 | 498 |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
499 /* 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
|
500 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
|
501 is the only reference maintained by fontconfig. |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
502 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
|
503 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
|
504 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
505 enum DestroyFontsetP { DestroyNo = 0, DestroyYes = 1 }; |
| 3354 | 506 |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
507 static Lisp_Object |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
508 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
|
509 { |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
510 FcConfig *fc = (*create_function) (); |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
511 Lisp_Object configs = XWEAK_LIST_LIST (Vfc_config_weak_list); |
| 3354 | 512 |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
513 /* Linear search: fc_configs are not going to multiply like conses. */ |
| 3360 | 514 { |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
515 LIST_LOOP_2 (cfg, configs) |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
516 if (fc == XFC_CONFIG_PTR (cfg)) |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
517 return cfg; |
| 3360 | 518 } |
| 519 | |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
520 { |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
521 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
|
522 fccfg->fccfgPtr = fc; |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
523 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
|
524 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
|
525 return wrap_fc_config (fccfg); |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
526 } |
| 3354 | 527 } |
| 528 | |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
529 static Lisp_Object |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
530 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
|
531 Lisp_Object config) |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
532 { |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
533 FcChar8 *thing; |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
534 Lisp_Object value = Qnil; |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
535 FcStrList *thing_list; |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
536 |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
537 CHECK_FC_CONFIG (config); |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
538 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
|
539 /* 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
|
540 if (!thing_list) |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
541 return Qnil; |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
542 while ((thing = FcStrListNext (thing_list))) |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
543 value = Fcons (build_fcapi_string (thing), value); |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
544 FcStrListDone (thing_list); |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
545 return value; |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
546 } |
| 3931 | 547 |
| 3354 | 548 static Lisp_Object |
| 3931 | 549 fontset_to_list (FcFontSet *fontset, enum DestroyFontsetP destroyp) |
| 3354 | 550 { |
| 551 int idx; | |
| 552 Lisp_Object fontlist = Qnil; | |
| 553 fc_pattern *fcpat; | |
| 554 | |
| 555 /* #### improve this error message */ | |
| 556 if (!fontset) | |
| 4860 | 557 invalid_state ("failed to create FcFontSet", Qunbound); |
| 3354 | 558 for (idx = 0; idx < fontset->nfont; ++idx) |
| 559 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
560 fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); |
| 3354 | 561 fcpat->fcpatPtr = FcPatternDuplicate (fontset->fonts[idx]); |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
562 fontlist = Fcons (wrap_fc_pattern (fcpat), fontlist); |
| 3354 | 563 } |
| 3931 | 564 if (destroyp) |
| 565 FcFontSetDestroy (fontset); | |
| 3354 | 566 return fontlist; |
| 567 } | |
| 568 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
569 DEFUN ("fc-config-p", Ffc_config_p, 1, 1, 0, /* |
| 3931 | 570 Returns t if OBJECT is of type fc-config, nil otherwise. |
| 571 */ | |
| 572 (object)) | |
| 573 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
574 return FC_CONFIGP (object) ? Qt : Qnil; |
| 3931 | 575 } |
| 576 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
577 DEFUN ("fc-config-create", Ffc_config_create, 0, 0, 0, /* |
| 3931 | 578 -- Function: FcConfig *FcConfigCreate (void) |
| 579 Creates an empty configuration. */ | |
| 580 ()) | |
| 581 { | |
| 582 return fc_config_create_using (&FcConfigCreate); | |
| 583 } | |
| 584 | |
| 585 #if 0 | |
| 586 /* I'm sorry, but we just don't do this in Lisp, OK? | |
| 587 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
|
588 DEFUN ("fc-config-destroy", Ffc_config_destroy, 1, 1, 0, /* |
| 3931 | 589 -- Function: void FcConfigDestroy (FcConfig *config) |
| 590 Destroys a configuration and any data associated with it. Note | |
| 591 that calling this function with the return value from | |
| 592 FcConfigGetCurrent will place the library in an indeterminate | |
| 593 state. */ | |
| 594 (config)) | |
| 595 { | |
| 596 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
|
597 intern ("fc-config-destroy")); |
| 3931 | 598 } |
| 599 #endif | |
| 600 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
601 DEFUN ("fc-config-up-to-date", Ffc_config_up_to_date, 1, 1, 0, /* |
| 3931 | 602 -- Function: FcBool FcConfigUptoDate (FcConfig *config) |
| 603 Checks all of the files related to 'config' and returns whether the | |
| 604 in-memory version is in sync with the disk version. */ | |
| 605 (config)) | |
| 606 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
607 CHECK_FC_CONFIG (config); |
|
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
608 return FcConfigUptoDate (XFC_CONFIG_PTR (config)) == FcFalse ? Qnil : Qt; |
| 3931 | 609 } |
| 610 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
611 DEFUN ("fc-config-build-fonts", Ffc_config_build_fonts, 1, 1, 0, /* |
| 3931 | 612 -- Function: FcBool FcConfigBuildFonts (FcConfig *config) |
| 613 Builds the set of available fonts for the given configuration. | |
| 614 Note that any changes to the configuration after this call have | |
| 615 indeterminate effects. Returns FcFalse if this operation runs out | |
| 616 of memory. | |
| 617 XEmacs: signal out-of-memory, or return nil on success. */ | |
| 618 (config)) | |
| 619 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
620 CHECK_FC_CONFIG (config); |
|
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
621 if (FcConfigBuildFonts (XFC_CONFIG_PTR (config)) == FcFalse) |
| 3931 | 622 out_of_memory ("FcConfigBuildFonts failed", config); |
| 623 return Qnil; | |
| 624 } | |
| 625 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
626 DEFUN ("fc-config-get-config-dirs", Ffc_config_get_config_dirs, 1, 1, 0, /* |
| 3931 | 627 -- Function: FcStrList *FcConfigGetConfigDirs (FcConfig *config) |
| 628 Returns the list of font directories specified in the | |
| 629 configuration files for 'config'. Does not include any | |
| 630 subdirectories. */ | |
| 631 (config)) | |
| 632 { | |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
633 return fc_strlist_to_lisp_using (&FcConfigGetConfigDirs, config); |
| 3931 | 634 } |
| 635 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
636 DEFUN ("fc-config-get-font-dirs", Ffc_config_get_font_dirs, 1, 1, 0, /* |
| 3931 | 637 -- Function: FcStrList *FcConfigGetFontDirs (FcConfig *config) |
| 638 Returns the list of font directories in 'config'. This includes the | |
| 639 configured font directories along with any directories below those | |
| 640 in the filesystem. */ | |
| 641 (config)) | |
| 642 { | |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
643 return fc_strlist_to_lisp_using (&FcConfigGetFontDirs, config); |
| 3931 | 644 } |
| 645 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
646 DEFUN ("fc-config-get-config-files", Ffc_config_get_config_files, 1, 1, 0, /* |
| 3931 | 647 -- Function: FcStrList *FcConfigGetConfigFiles (FcConfig *config) |
| 648 Returns the list of known configuration files used to generate | |
| 649 'config'. Note that this will not include any configuration done | |
| 650 with FcConfigParse. */ | |
| 651 (config)) | |
| 652 { | |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
653 return fc_strlist_to_lisp_using (&FcConfigGetConfigFiles, config); |
| 3931 | 654 } |
| 655 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
656 DEFUN ("fc-config-get-cache", Ffc_config_get_cache, 1, 1, 0, /* |
| 3931 | 657 -- Function: char *FcConfigGetCache (FcConfig *config) |
| 658 Returns the name of the file used to store per-user font | |
| 659 information. */ | |
| 660 (config)) | |
| 661 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
662 CHECK_FC_CONFIG (config); |
| 3931 | 663 /* 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
|
664 return build_fcapi_string ((FcChar8 *) FcConfigGetCache (XFC_CONFIG_PTR (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-fonts", Ffc_config_get_fonts, 2, 2, 0, /* |
| 3931 | 668 -- Function: FcFontSet *FcConfigGetFonts (FcConfig *config, FcSetName set) |
| 669 Returns one of the two sets of fonts from the configuration as | |
| 670 specified by 'set'. | |
| 671 `FcSetName' | |
| 672 Specifies one of the two sets of fonts available in a | |
| 673 configuration; FcSetSystem for those fonts specified in the | |
| 674 configuration and FcSetApplication which holds fonts provided by | |
| 675 the application. */ | |
| 676 (config, set)) | |
| 677 { | |
| 678 FcSetName name = FcSetSystem; | |
| 679 FcFontSet *fs = NULL; | |
| 680 | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
681 CHECK_FC_CONFIG (config); |
| 3931 | 682 CHECK_SYMBOL (set); |
| 683 | |
| 684 if (EQ (set, intern ("fc-set-system"))) | |
| 685 name = FcSetSystem; | |
| 686 else if (EQ (set, intern ("fc-set-application"))) | |
| 687 name = FcSetApplication; | |
| 688 else | |
| 689 wtaerror ("must be in (fc-set-system fc-set-application)", set); | |
| 690 | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
691 fs = FcConfigGetFonts (XFC_CONFIG_PTR (config), name); |
| 3931 | 692 return fs ? fontset_to_list (fs, DestroyNo) : Qnil; |
| 693 } | |
| 694 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
695 DEFUN ("fc-config-set-current", Ffc_config_set_current, 1, 1, 0, /* |
| 3931 | 696 -- Function: FcBool FcConfigSetCurrent (FcConfig *config) |
| 697 Sets the current default configuration to 'config'. Implicitly | |
| 698 calls FcConfigBuildFonts if necessary, returning FcFalse if that | |
| 699 call fails. | |
| 700 XEmacs: signals out-of-memory if FcConfigBuildFonts fails, or args-out-of-range | |
| 701 if the resulting FcConfig has no fonts (which would crash XEmacs if installed). | |
| 702 */ | |
| 703 (config)) | |
| 704 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
705 CHECK_FC_CONFIG (config); |
| 3931 | 706 /* *sigh* "Success" DOES NOT mean you have any fonts available. It is |
| 707 easy to crash fontconfig, and XEmacs with it. Without the following | |
| 708 check, this will do it: | |
| 709 (progn | |
| 710 (fc-config-set-current (fc-config-create)) | |
| 711 (set-face-font 'default "serif-12")) | |
| 712 */ | |
| 713 | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
714 if (FcConfigBuildFonts (XFC_CONFIG_PTR (config)) == FcFalse) |
| 3931 | 715 out_of_memory ("FcConfigBuildFonts failed", config); |
| 716 /* #### We'd like to avoid this consing, and FcConfigGetFonts sometimes | |
| 717 returns NULL, but it doesn't always. This will do for now .... */ | |
| 718 if (NILP (Ffc_config_get_fonts (config, intern ("fc-set-system"))) | |
| 719 && NILP (Ffc_config_get_fonts (config, intern ("fc-set-application")))) | |
| 720 signal_error (intern ("args-out-of-range"), "no fonts found", config); | |
| 721 /* 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
|
722 if (FcConfigSetCurrent (XFC_CONFIG_PTR (config)) == FcFalse) |
| 3931 | 723 out_of_memory ("FcConfigBuildFonts failed in set", config); |
| 724 return Qnil; | |
| 725 } | |
| 726 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
727 DEFUN ("fc-config-get-blanks", Ffc_config_get_blanks, 1, 1, 0, /* |
| 3931 | 728 -- Function: FcBlanks *FcConfigGetBlanks (FcConfig *config) |
| 729 Returns the FcBlanks object associated with the given | |
| 730 configuration, if no blanks were present in the configuration, | |
| 731 this function will return 0. | |
| 732 XEmacs: should convert to a chartable. | |
| 733 #### Unimplemented. */ | |
| 734 (config)) | |
| 735 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
736 CHECK_FC_CONFIG (config); |
| 3931 | 737 signal_error (Qunimplemented, "no method to convert FcBlanks object", |
| 738 intern ("fc-config-get-blanks")); | |
| 739 } | |
| 740 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
741 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
|
742 -- Function: int FcConfigGetRescanInterval (FcConfig *config) |
| 3931 | 743 Returns the interval between automatic checks of the configuration |
| 744 (in seconds) specified in 'config'. The configuration is checked | |
| 745 during a call to FcFontList when this interval has passed since | |
| 746 the last check. */ | |
| 747 (config)) | |
| 748 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
749 CHECK_FC_CONFIG (config); |
|
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
750 return make_int (FcConfigGetRescanInterval (XFC_CONFIG_PTR (config))); |
| 3931 | 751 } |
| 752 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
753 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
|
754 -- Function: FcBool FcConfigSetRescanInterval (FcConfig *config, int |
| 3931 | 755 rescanInterval) |
| 756 Sets the rescan interval; returns FcFalse if an error occurred. | |
| 757 XEmacs: signal such error, or return nil on success. */ | |
| 758 (config, rescan_interval)) | |
| 759 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
760 CHECK_FC_CONFIG (config); |
| 3931 | 761 CHECK_INT (rescan_interval); |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
762 if (FcConfigSetRescanInterval (XFC_CONFIG_PTR (config), |
| 3931 | 763 XINT (rescan_interval)) == FcFalse) |
| 764 signal_error (Qio_error, "FcConfigSetRescanInverval barfed", | |
| 765 intern ("fc-config-set-rescan-interval")); | |
| 766 return Qnil; | |
| 767 } | |
| 768 | |
| 769 /* #### This might usefully be made interactive. */ | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
770 DEFUN ("fc-config-app-font-add-file", Ffc_config_app_font_add_file, 2, 2, 0, /* |
| 3931 | 771 -- Function: FcBool FcConfigAppFontAddFile (FcConfig *config, const |
| 772 char *file) | |
| 773 Adds an application-specific font to the configuration. */ | |
| 774 (config, file)) | |
| 775 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
776 CHECK_FC_CONFIG (config); |
| 3931 | 777 CHECK_STRING (file); |
| 778 if (FcConfigAppFontAddFile | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
779 (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
|
780 /* #### 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
|
781 (FcChar8 *) LISP_STRING_TO_EXTERNAL (file, Qfile_name)) == FcFalse) |
| 3931 | 782 return Qnil; |
| 783 else | |
| 784 return Qt; | |
| 785 } | |
| 786 | |
| 787 /* #### This might usefully be made interactive. */ | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
788 DEFUN ("fc-config-app-font-add-dir", Ffc_config_app_font_add_dir, 2, 2, 0, /* |
| 3931 | 789 -- Function: FcBool FcConfigAppFontAddDir (FcConfig *config, const |
| 790 char *dir) | |
| 791 Scans the specified directory for fonts, adding each one found to | |
| 792 the application-specific set of fonts. */ | |
| 793 (config, dir)) | |
| 794 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
795 CHECK_FC_CONFIG (config); |
| 3931 | 796 CHECK_STRING (dir); |
| 797 if (FcConfigAppFontAddDir | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
798 (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
|
799 /* #### 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
|
800 (FcChar8 *) LISP_STRING_TO_EXTERNAL (dir, Qfile_name)) == FcFalse) |
| 3931 | 801 return Qnil; |
| 802 else | |
| 803 return Qt; | |
| 804 } | |
| 805 | |
| 806 /* #### This might usefully be made interactive. */ | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
807 DEFUN ("fc-config-app-font-clear", Ffc_config_app_font_clear, 1, 1, 0, /* |
| 3931 | 808 -- Function: void FcConfigAppFontClear (FcConfig *config) |
| 809 Clears the set of application-specific fonts. */ | |
| 810 (config)) | |
| 811 { | |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
812 CHECK_FC_CONFIG (config); |
|
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
813 FcConfigAppFontClear (XFC_CONFIG_PTR (config)); |
| 3931 | 814 return Qnil; |
| 815 } | |
| 816 | |
| 817 /* These functions provide some control over how the default | |
| 818 configuration of the library is initialized. (This configuration is | |
| 819 normally implicitly initialized.) */ | |
| 820 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
821 DEFUN ("fc-config-filename", Ffc_config_filename, 1, 1, 0, /* |
| 3931 | 822 -- Function: char *FcConfigFilename (const char *name) |
| 823 Given the specified external entity name, return the associated | |
| 824 filename. This provides applications a way to convert various | |
| 825 configuration file references into filename form. | |
| 826 | |
| 827 A null or empty 'name' indicates that the default configuration | |
| 828 file should be used; which file this references can be overridden | |
| 829 with the FC_CONFIG_FILE environment variable. Next, if the name | |
| 830 starts with '~', it refers to a file in the current users home | |
| 831 directory. Otherwise if the name doesn't start with '/', it | |
| 832 refers to a file in the default configuration directory; the | |
| 833 built-in default directory can be overridden with the | |
| 834 FC_CONFIG_DIR environment variable. */ | |
| 835 (name)) | |
| 836 { | |
| 4932 | 837 const Ascbyte *fcname = ""; |
| 3931 | 838 |
| 839 if (!NILP (name)) | |
| 840 { | |
| 841 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
|
842 /* #### 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
|
843 LISP_PATHNAME_CONVERT_OUT (name, fcname); |
| 3931 | 844 } |
| 845 return (build_fcapi_string (FcConfigFilename ((FcChar8 *) fcname))); | |
| 846 } | |
| 847 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
848 DEFUN ("fc-init-load-config", Ffc_init_load_config, 0, 0, 0, /* |
| 3931 | 849 -- Function: FcConfig *FcInitLoadConfig (void) |
| 850 Loads the default configuration file and returns the resulting | |
| 851 configuration. Does not load any font information. */ | |
| 852 ()) | |
| 853 { | |
| 854 return fc_config_create_using (&FcInitLoadConfig); | |
| 855 } | |
| 856 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
857 DEFUN ("fc-init-load-config-and-fonts", Ffc_init_load_config_and_fonts, 0, 0, 0, /* |
| 3931 | 858 -- Function: FcConfig *FcInitLoadConfigAndFonts (void) |
| 859 Loads the default configuration file and builds information about | |
| 860 the available fonts. Returns the resulting configuration. */ | |
| 861 ()) | |
| 862 { | |
| 863 return fc_config_create_using (&FcInitLoadConfigAndFonts); | |
| 864 } | |
| 865 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
866 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
|
867 -- Function: FcConfig *FcConfigGetCurrent (void) |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
868 Returns the current default configuration. */ |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
869 ()) |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
870 { |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
871 return fc_config_create_using (&FcConfigGetCurrent); |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
872 } |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
873 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
874 /* Pattern manipulation functions. */ |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
875 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
876 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
|
877 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
|
878 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
|
879 * 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
|
880 * 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
|
881 * 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
|
882 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
|
883 (pattern)) |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
884 { |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
885 CHECK_FC_PATTERN (pattern); |
|
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
886 FcDefaultSubstitute (XFC_PATTERN_PTR (pattern)); |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
887 return Qnil; |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
888 } |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
889 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
890 /* -- Function: FcBool FcConfigSubstituteWithPat (FcConfig *config, |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
891 FcPattern *p, FcPattern *p_pat FcMatchKind kind) |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
892 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
|
893 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
894 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
|
895 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
|
896 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
|
897 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
|
898 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
|
899 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
|
900 defaults to `fc-match-font'. |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
901 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
|
902 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
|
903 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
904 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
|
905 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
|
906 (pattern, kind, testpat, config)) |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
907 { |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
908 FcMatchKind knd; |
|
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 /* 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
|
911 if (NILP (kind) |
| 4860 | 912 || EQ (kind, Qfc_match_font)) |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
913 knd = FcMatchFont; |
| 4860 | 914 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
|
915 knd = FcMatchPattern; |
| 4860 | 916 else |
| 917 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
|
918 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
919 /* Typecheck arguments */ |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
920 CHECK_FC_PATTERN (pattern); |
|
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
921 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
|
922 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
|
923 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
924 return (FcConfigSubstituteWithPat |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
925 (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
|
926 XFC_PATTERN_PTR (pattern), |
|
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
927 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
|
928 knd) == FcTrue) |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
929 ? Qt : Qnil; |
|
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 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
932 /* Pattern matching functions. */ |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
933 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
934 /* 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
|
935 `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
|
936 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
|
937 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
|
938 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
|
939 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
|
940 those provided by preferred fonts. */ |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
941 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
942 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
|
943 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
|
944 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
|
945 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
|
946 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
|
947 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
|
948 FcConfigSubstitute with 'kind' FcMatchFont and then returned. */ |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
949 (pattern, font, config)) |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
950 { |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
951 if (NILP (config)) { |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
952 config = Ffc_config_get_current (); |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
953 } |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
954 CHECK_FC_PATTERN (pattern); |
|
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
955 CHECK_FC_PATTERN (font); |
|
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
956 CHECK_FC_CONFIG (config); |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
957 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
958 /* 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
|
959 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
|
960 XFC_PATTERN_PTR (font), |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
961 XFC_PATTERN_PTR (pattern))); |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
962 } |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
963 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
964 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
|
965 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
|
966 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
967 DEVICE is an X11 device. |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
968 PATTERN is a fontconfig pattern object. |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
969 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
|
970 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
|
971 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
|
972 `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
|
973 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
|
974 being processed by FcFontMatch. */ |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
975 (device, pattern, config)) |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
976 { |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
977 FcResult res; |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
978 struct fc_pattern *res_fcpat; |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
979 FcPattern *p; |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
980 FcConfig *fcc; |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
981 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
982 CHECK_FC_PATTERN (pattern); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
983 if (NILP (device)) |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
984 return Qnil; |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
985 CHECK_X_DEVICE (device); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
986 if (!DEVICE_LIVE_P (XDEVICE (device))) |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
987 return Qnil; |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
988 if (!NILP (config)) |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
989 CHECK_FC_CONFIG (config); |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
990 |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
991 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
|
992 p = XFC_PATTERN_PTR (pattern); |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
993 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
|
994 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
995 FcConfigSubstitute (fcc, p, FcMatchPattern); |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
996 FcDefaultSubstitute (p); |
|
4809
0d3ccd5a2509
Initialize the result variable passed to FcFontMatch. See xemacs-patches
Jerry James <james@xemacs.org>
parents:
4799
diff
changeset
|
997 res = FcResultMatch; |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
998 res_fcpat->fcpatPtr = FcFontMatch (fcc, p, &res); |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
999 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1000 if (res_fcpat->fcpatPtr == NULL) |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1001 switch (res) |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1002 { |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1003 case FcResultNoMatch: |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1004 return Qfc_result_no_match; |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1005 case FcResultNoId: |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1006 return Qfc_result_no_id; |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1007 default: |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1008 return Qfc_internal_error; |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1009 } |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1010 else |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1011 return wrap_fc_pattern (res_fcpat); |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1012 } |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1013 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1014 /* #### 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
|
1015 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
|
1016 3, 3, 0, /* |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1017 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
|
1018 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
|
1019 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1020 DEVICE is an X11 device. |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1021 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
|
1022 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
|
1023 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1024 #### 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
|
1025 match other font-listing APIs. */ |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1026 (UNUSED (device), pattern, properties)) |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1027 { |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1028 FcObjectSet *os; |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1029 FcFontSet *fontset; |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1030 |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1031 CHECK_FC_PATTERN (pattern); |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1032 CHECK_LIST (properties); |
|
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 os = FcObjectSetCreate (); |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1035 string_list_to_fcobjectset (properties, os); |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1036 /* #### 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
|
1037 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
|
1038 FcObjectSetDestroy (os); |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1039 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1040 return fontset_to_list (fontset, DestroyYes); |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1041 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1042 } |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1043 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1044 /* #### 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
|
1045 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
|
1046 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
|
1047 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
|
1048 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1049 DEVICE is an X11 device. |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1050 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
|
1051 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
|
1052 contribute new characters to the union repertoire. |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1053 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1054 #### 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
|
1055 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
|
1056 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
|
1057 stable. |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1058 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1059 #### 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
|
1060 match other font-listing APIs. */ |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1061 (UNUSED (device), pattern, trim, nosub)) |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1062 { |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1063 CHECK_FC_PATTERN (pattern); |
|
4758
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 { |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1066 FcConfig *fcc = FcConfigGetCurrent(); |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1067 FcFontSet *fontset; |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1068 FcPattern *p = XFC_PATTERN_PTR (pattern); |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1069 FcResult fcresult; |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1070 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1071 if (NILP (nosub)) /* #### temporary debug hack */ |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1072 FcDefaultSubstitute (p); |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1073 FcConfigSubstitute (fcc, p, FcMatchPattern); |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1074 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
|
1075 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1076 return fontset_to_list (fontset, DestroyYes); |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1077 } |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1078 } |
|
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 #ifdef FONTCONFIG_EXPOSE_CONFIG |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1081 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1082 /* Configuration routines --- for debugging |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1083 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
|
1084 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1085 3.2.10 Initialization |
|
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 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1088 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
|
1089 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
|
1090 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
|
1091 */ |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1092 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1093 static void |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1094 finalize_fc_config (Lisp_Object obj) |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1095 { |
|
5127
a9c41067dd88
more cleanups, terminology clarification, lots of doc work
Ben Wing <ben@xemacs.org>
parents:
5125
diff
changeset
|
1096 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
|
1097 if (p->fccfgPtr && p->fccfgPtr != FcConfigGetCurrent()) |
|
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 /* 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
|
1100 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
|
1101 fontconfig keeps is the current FcConfig. */ |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1102 FcConfigDestroy (p->fccfgPtr); |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1103 } |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1104 p->fccfgPtr = 0; |
|
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 |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1107 static const struct memory_description fcconfig_description [] = { |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1108 /* #### nothing here, is this right?? */ |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1109 { XD_END } |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1110 }; |
|
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1111 |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4758
diff
changeset
|
1112 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
|
1113 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
|
1114 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
|
1115 struct fc_config); |
|
4758
75975fd0b7fc
Implement more of the fontconfig API.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4757
diff
changeset
|
1116 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1117 DEFUN ("fc-init", Ffc_init, 0, 0, 0, /* |
| 3931 | 1118 -- Function: FcBool FcInit (void) |
| 1119 Loads the default configuration file and the fonts referenced | |
| 1120 therein and sets the default configuration to that result. | |
| 1121 Returns whether this process succeeded or not. If the default | |
| 1122 configuration has already been loaded, this routine does nothing | |
| 1123 and returns FcTrue. */ | |
| 1124 ()) | |
| 1125 { | |
| 1126 return (FcInit () == FcTrue) ? Qt : Qnil; | |
| 1127 } | |
| 1128 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1129 DEFUN ("fc-get-version", Ffc_get_version, 0, 0, 0, /* |
| 3931 | 1130 -- Function: int FcGetVersion (void) |
| 1131 Returns the version number of the library. | |
| 3935 | 1132 XEmacs: No, this should NOT return a pretty string. |
| 3931 | 1133 (let ((i (fc-get-version))) |
| 1134 (format "%d.%d.%d" (/ i 10000) (mod (/ i 100) 100) (mod i 100))) | |
| 3935 | 1135 gives the usual x.y.z format. This is the version of the .so. It can be |
| 1136 checked against `fc-version', which is the version of fontconfig.h. | |
| 1137 It's probably not a disaster if `(> (fc-get-version) fc-version)'. */ | |
| 3931 | 1138 ()) |
| 1139 { | |
| 1140 return make_int (FcGetVersion ()); | |
| 1141 } | |
| 1142 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1143 DEFUN ("fc-init-reinitialize", Ffc_init_reinitialize, 0, 0, 0, /* |
| 3931 | 1144 -- Function: FcBool FcInitReinitialize (void) |
| 1145 Forces the default configuration file to be reloaded and resets | |
| 1146 the default configuration. */ | |
| 1147 ()) | |
| 1148 { | |
| 1149 return (FcInitReinitialize () == FcTrue) ? Qt : Qnil; | |
| 1150 } | |
| 1151 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1152 DEFUN ("fc-init-bring-up-to-date", Ffc_init_bring_up_to_date, 0, 0, 0, /* |
| 3931 | 1153 -- Function: FcBool FcInitBringUptoDate (void) |
| 1154 Checks the rescan interval in the default configuration, checking | |
| 1155 the configuration if the interval has passed and reloading the | |
| 1156 configuration when any changes are detected. */ | |
| 1157 ()) | |
| 1158 { | |
| 1159 return (FcInitBringUptoDate () == FcTrue) ? Qt : Qnil; | |
| 1160 } | |
| 1161 | |
| 1162 #endif /* FONTCONFIG_EXPOSE_CONFIG */ | |
| 1163 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1164 DEFUN ("xlfd-font-name-p", Fxlfd_font_name_p, 1, 1, 0, /* |
| 3354 | 1165 Check whether the string FONTNAME is a XLFD font name. */ |
| 1166 (fontname)) | |
| 1167 { | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1168 CHECK_STRING (fontname); |
| 3354 | 1169 /* #### should bind `case-fold-search' here? */ |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1170 return Fstring_match (Vxlfd_font_name_regexp, fontname, Qnil, Qnil); |
| 3354 | 1171 } |
| 1172 | |
| 1173 /* FcPatternPrint: there is no point in having wrappers fc-pattern-print, | |
| 1174 Ffc_pattern_print since this function prints to stdout. */ | |
| 1175 | |
| 1176 /* Initialization of font-mgr */ | |
| 1177 | |
| 1178 #define XE_XLFD_SEPARATOR "-" | |
| 1179 /* XLFD specifies ISO 8859-1 encoding, but we can't handle non-ASCII | |
| 1180 in Mule when this function is called. So use HPC. */ | |
| 1181 #if 0 | |
| 1182 #define XE_XLFD_PREFIX "\\(\\+[\040-\176\240-\377]*\\)?-" | |
| 1183 #define XE_XLFD_OPT_TEXT "\\([\040-\044\046-\176\240-\377]*\\)" | |
| 1184 #define XE_XLFD_TEXT "\\([\040-\044\046-\176\240-\377]+\\)" | |
| 1185 #else | |
| 1186 #define XE_XLFD_PREFIX "\\(\\+[\040-\176]*\\)?-" | |
| 1187 #define XE_XLFD_OPT_TEXT "\\([^-]*\\)" | |
| 1188 #define XE_XLFD_TEXT "\\([^-]+\\)" | |
| 1189 #endif | |
| 1190 | |
| 1191 #define XE_XLFD_SLANT "\\([0-9ior?*][iot]?\\)" | |
| 1192 #define XE_XLFD_SPACING "\\([cmp?*]\\)" | |
| 1193 /* Hyphen as minus conflicts with use as separator. */ | |
| 1194 #define XE_XLFD_OPT_NEGATE "~?" | |
| 1195 #define XE_XLFD_NUMBER "\\([0-9?*]+\\)" | |
| 1196 #define XE_XLFD_PSIZE "\\([0-9?*]+\\|\\[[ 0-9+~.e?*]+\\]\\)" | |
| 1197 | |
| 1198 /* Call this only from the init code | |
| 1199 #### This is really horrible, let's get rid of it, please. */ | |
| 1200 static Lisp_Object | |
| 1201 make_xlfd_font_regexp (void) | |
| 1202 { | |
| 1203 struct gcpro gcpro1; | |
| 1204 unsigned i; | |
| 1205 Lisp_Object reg = Qnil; | |
| 1206 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
|
1207 cpp and passed to build_extstring. */ |
| 3354 | 1208 { |
| 1209 /* Regular expression matching XLFDs as defined by XLFD v. 1.5. | |
| 1210 Matches must be case-insensitive. | |
| 1211 PSIZE is a pixel or point size, which may be a "matrix". The | |
| 1212 syntax of a matrix is not checked, just some lexical properties. | |
| 1213 AFAICT none of the TEXT fields except adstyle is optional. | |
| 1214 | |
| 1215 NB. It should not be a problem if this matches "too much", since | |
| 1216 an "old" server will simply not be able to find a matching font. */ | |
| 1217 "\\`", | |
| 1218 XE_XLFD_PREFIX, /* prefix */ | |
| 1219 XE_XLFD_TEXT, /* foundry */ | |
| 1220 XE_XLFD_SEPARATOR, | |
| 1221 XE_XLFD_TEXT, /* family */ | |
| 1222 XE_XLFD_SEPARATOR, | |
| 1223 XE_XLFD_TEXT, /* weight */ | |
| 1224 XE_XLFD_SEPARATOR, | |
| 1225 XE_XLFD_SLANT, /* slant */ | |
| 1226 XE_XLFD_SEPARATOR, | |
| 1227 XE_XLFD_TEXT, /* swidth */ | |
| 1228 XE_XLFD_SEPARATOR, | |
| 1229 XE_XLFD_OPT_TEXT, /* adstyle */ | |
| 1230 XE_XLFD_SEPARATOR, | |
| 1231 XE_XLFD_PSIZE, /* pixelsize */ | |
| 1232 XE_XLFD_SEPARATOR, | |
| 1233 XE_XLFD_PSIZE, /* pointsize */ | |
| 1234 XE_XLFD_SEPARATOR, | |
| 1235 XE_XLFD_NUMBER, /* resx */ | |
| 1236 XE_XLFD_SEPARATOR, | |
| 1237 XE_XLFD_NUMBER, /* resy */ | |
| 1238 XE_XLFD_SEPARATOR, | |
| 1239 XE_XLFD_SPACING, /* spacing */ | |
| 1240 XE_XLFD_SEPARATOR, | |
| 1241 XE_XLFD_OPT_NEGATE, /* avgwidth */ | |
| 1242 XE_XLFD_NUMBER, | |
| 1243 XE_XLFD_SEPARATOR, | |
| 1244 XE_XLFD_TEXT, /* registry */ | |
| 1245 XE_XLFD_SEPARATOR, | |
| 1246 XE_XLFD_TEXT, /* encoding */ | |
| 1247 "\\'" | |
| 1248 }; | |
| 1249 | |
| 1250 GCPRO1 (reg); | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1251 for (i = 0; i < sizeof (re)/sizeof (Extbyte *); i++) |
| 3354 | 1252 { |
| 1253 /* #### 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
|
1254 reg = concat2 (reg, build_extstring (re[i], Qx_font_name_encoding)); |
| 3354 | 1255 } |
| 1256 | |
| 1257 RETURN_UNGCPRO (reg); | |
| 1258 } | |
| 1259 #undef XE_XLFD_SEPARATOR | |
| 1260 #undef XE_XLFD_PREFIX | |
| 1261 #undef XE_XLFD_OPT_TEXT | |
| 1262 #undef XE_XLFD_TEXT | |
| 1263 #undef XE_XLFD_OPT_SLANT | |
| 1264 #undef XE_XLFD_OPT_SPACING | |
| 1265 #undef XE_XLFD_OPT_NEGATE | |
| 1266 #undef XE_XLFD_NUMBER | |
| 1267 #undef XE_XLFD_PSIZE | |
| 1268 | |
| 1269 #define MINL(x,y) ((((unsigned long) (x)) < ((unsigned long) (y))) \ | |
| 1270 ? ((unsigned long) (x)) : ((unsigned long) (y))) | |
| 1271 | |
| 1272 static void | |
| 1273 string_list_to_fcobjectset (Lisp_Object list, FcObjectSet *os) | |
| 1274 { | |
| 1275 EXTERNAL_LIST_LOOP_2 (elt, list) | |
| 1276 { | |
| 3469 | 1277 const Extbyte *s; |
| 3354 | 1278 |
| 1279 CHECK_STRING (elt); | |
| 1280 s = fc_intern (elt); | |
| 1281 FcObjectSetAdd (os, s); | |
| 1282 } | |
| 1283 } | |
| 1284 | |
| 1285 void | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1286 syms_of_font_mgr (void) |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1287 { |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1288 INIT_LISP_OBJECT (fc_pattern); |
| 3354 | 1289 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1290 DEFSYMBOL_MULTIWORD_PREDICATE (Qfc_patternp); |
| 3354 | 1291 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1292 DEFSYMBOL (Qfc_result_type_mismatch); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1293 DEFSYMBOL (Qfc_result_no_match); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1294 DEFSYMBOL (Qfc_result_no_id); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1295 DEFSYMBOL (Qfc_internal_error); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1296 DEFSYMBOL (Qfc_match_pattern); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1297 DEFSYMBOL (Qfc_match_font); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1298 DEFSYMBOL (Qfont_mgr); |
| 3354 | 1299 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1300 DEFSUBR (Ffc_pattern_p); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1301 DEFSUBR (Ffc_pattern_create); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1302 DEFSUBR (Ffc_name_parse); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1303 DEFSUBR (Ffc_name_unparse); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1304 DEFSUBR (Ffc_pattern_duplicate); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1305 DEFSUBR (Ffc_pattern_add); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1306 DEFSUBR (Ffc_pattern_del); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1307 DEFSUBR (Ffc_pattern_get); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1308 DEFSUBR (Ffc_list_fonts_pattern_objects); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1309 DEFSUBR (Ffc_font_sort); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1310 DEFSUBR (Ffc_font_match); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1311 DEFSUBR (Ffc_default_substitute); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1312 DEFSUBR (Ffc_config_substitute); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1313 DEFSUBR (Ffc_font_render_prepare); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1314 DEFSUBR (Fxlfd_font_name_p); |
| 3931 | 1315 |
| 1316 #ifdef FONTCONFIG_EXPOSE_CONFIG | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1317 INIT_LISP_OBJECT (fc_config); |
| 3931 | 1318 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1319 DEFSYMBOL_MULTIWORD_PREDICATE (Qfc_configp); |
| 3931 | 1320 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1321 DEFSUBR (Ffc_config_p); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1322 DEFSUBR (Ffc_config_create); |
| 3931 | 1323 #if 0 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1324 DEFSUBR (Ffc_config_destroy); |
| 3931 | 1325 #endif |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1326 DEFSUBR (Ffc_config_set_current); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1327 DEFSUBR (Ffc_config_get_current); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1328 DEFSUBR (Ffc_config_up_to_date); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1329 DEFSUBR (Ffc_config_build_fonts); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1330 DEFSUBR (Ffc_config_get_config_dirs); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1331 DEFSUBR (Ffc_config_get_font_dirs); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1332 DEFSUBR (Ffc_config_get_config_files); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1333 DEFSUBR (Ffc_config_get_cache); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1334 DEFSUBR (Ffc_config_get_fonts); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1335 DEFSUBR (Ffc_config_get_blanks); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1336 DEFSUBR (Ffc_config_get_rescan_interval); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1337 DEFSUBR (Ffc_config_set_rescan_interval); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1338 DEFSUBR (Ffc_config_app_font_add_file); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1339 DEFSUBR (Ffc_config_app_font_add_dir); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1340 DEFSUBR (Ffc_config_app_font_clear); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1341 DEFSUBR (Ffc_config_filename); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1342 DEFSUBR (Ffc_init_load_config); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1343 DEFSUBR (Ffc_init_load_config_and_fonts); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1344 DEFSUBR (Ffc_init); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1345 DEFSUBR (Ffc_get_version); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1346 DEFSUBR (Ffc_init_reinitialize); |
|
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1347 DEFSUBR (Ffc_init_bring_up_to_date); |
| 3931 | 1348 #endif /* FONTCONFIG_EXPOSE_CONFIG */ |
| 3354 | 1349 } |
| 1350 | |
| 1351 void | |
| 1352 vars_of_font_mgr (void) | |
| 1353 { | |
| 3935 | 1354 /* #### The next two DEFVARs belong somewhere else. */ |
| 3354 | 1355 |
| 1356 /* #### 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
|
1357 DEFVAR_INT ("debug-xft", &debug_xft /* |
| 3354 | 1358 Level of debugging messages to issue to stderr for Xft. |
| 1359 A nonnegative integer. Set to 0 to suppress all warnings. | |
| 1360 Default is 1 to ensure a minimum of debugging output at initialization. | |
| 1361 Higher levels give even more information. | |
| 1362 */ ); | |
|
4757
a23ac8f90a49
Improve warning and error messages from Xft.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4328
diff
changeset
|
1363 debug_xft = 0; |
| 3354 | 1364 |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1365 DEFVAR_CONST_INT ("xft-version", &xft_version /* |
| 3354 | 1366 The major version number of the Xft library being used. |
| 1367 */ ); | |
| 3935 | 1368 xft_version = XFT_VERSION; |
| 1369 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1370 DEFVAR_CONST_INT ("fc-version", &fc_version /* |
| 3935 | 1371 The version number of fontconfig.h. It can be checked against |
| 1372 `(fc-get-version)', which is the version of the .so. | |
| 1373 It's probably not a disaster if `(> (fc-get-version) fc-version)'. | |
| 1374 */ ); | |
| 1375 fc_version = FC_VERSION; | |
| 3354 | 1376 |
| 3360 | 1377 Fprovide (intern ("font-mgr")); |
| 3354 | 1378 } |
| 1379 | |
| 1380 void | |
| 1381 complex_vars_of_font_mgr (void) | |
| 1382 { | |
| 3931 | 1383 #ifdef FONTCONFIG_EXPOSE_CONFIG |
| 1384 Vfc_config_weak_list = make_weak_list (WEAK_LIST_SIMPLE); | |
| 1385 staticpro (&Vfc_config_weak_list); | |
| 1386 #endif | |
| 1387 | |
|
5189
b65692aa90d8
Cosmetic XFT-code fixes, some variable renamings
Ben Wing <ben@xemacs.org>
parents:
5178
diff
changeset
|
1388 DEFVAR_LISP ("xft-xlfd-font-regexp", &Vxlfd_font_name_regexp /* |
| 3354 | 1389 The regular expression used to match XLFD font names. */ |
| 1390 ); | |
| 1391 Vxlfd_font_name_regexp = make_xlfd_font_regexp(); | |
| 1392 } | |
| 1393 | |
| 1394 void | |
| 1395 reinit_vars_of_font_mgr (void) | |
| 1396 { | |
| 1397 int i, size = (int) countof (fc_standard_properties); | |
| 1398 | |
| 1399 FcInit (); | |
| 1400 | |
| 1401 fc_property_name_hash_table = make_string_hash_table (size); | |
| 1402 for (i = 0; i < size; ++i) | |
| 1403 puthash (fc_standard_properties[i], NULL, fc_property_name_hash_table); | |
| 1404 } | |
| 1405 |
