comparison src/font-mgr.c @ 5189:b65692aa90d8

Cosmetic XFT-code fixes, some variable renamings -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-04-04 Ben Wing <ben@xemacs.org> * font-mgr.c: * font-mgr.c (fc_standard_properties): * font-mgr.c (Ffc_pattern_p): * font-mgr.c (Ffc_pattern_create): * font-mgr.c (Ffc_name_parse): * font-mgr.c (Ffc_name_unparse): * font-mgr.c (Ffc_pattern_duplicate): * font-mgr.c (Ffc_pattern_add): * font-mgr.c (Ffc_pattern_del): * font-mgr.c (Ffc_pattern_get): * font-mgr.c (fc_config_create_using): * font-mgr.c (fc_strlist_to_lisp_using): * font-mgr.c (fontset_to_list): * font-mgr.c (Ffc_config_p): * font-mgr.c (Ffc_config_create): * font-mgr.c (Ffc_config_destroy): * font-mgr.c (Ffc_config_up_to_date): * font-mgr.c (Ffc_config_build_fonts): * font-mgr.c (Ffc_config_get_config_dirs): * font-mgr.c (Ffc_config_get_font_dirs): * font-mgr.c (Ffc_config_get_config_files): * font-mgr.c (Ffc_config_get_cache): * font-mgr.c (Ffc_config_get_fonts): * font-mgr.c (Ffc_config_set_current): * font-mgr.c (Ffc_config_get_blanks): * font-mgr.c (Ffc_config_get_rescan_interval): * font-mgr.c (Ffc_config_set_rescan_interval): * font-mgr.c (Ffc_config_app_font_add_file): * font-mgr.c (Ffc_config_app_font_add_dir): * font-mgr.c (Ffc_config_app_font_clear): * font-mgr.c (Ffc_init_load_config): * font-mgr.c (Ffc_init_load_config_and_fonts): * font-mgr.c (Ffc_config_get_current): * font-mgr.c (size): * font-mgr.c (Ffc_font_render_prepare): * font-mgr.c (Ffc_font_match): * font-mgr.c (Ffc_font_sort): * font-mgr.c (Ffc_init): * font-mgr.c (Ffc_get_version): * font-mgr.c (Ffc_init_reinitialize): * font-mgr.c (Ffc_init_bring_up_to_date): * font-mgr.c (Fxlfd_font_name_p): * font-mgr.c (make_xlfd_font_regexp): * font-mgr.c (syms_of_font_mgr): * font-mgr.c (vars_of_font_mgr): * font-mgr.c (complex_vars_of_font_mgr): Fix the code to conform to GNU style standards. Rename xft-debug-level to debug-xft. * fontcolor-x.c: * fontcolor-x.c (vars_of_fontcolor_x): Rename debug-x-objects to debug-x-fonts. * fontcolor-xlike-inc.c: * fontcolor-xlike-inc.c (DEBUG_FONTS1): * fontcolor-xlike-inc.c (DEBUG_FONTS2): * fontcolor-xlike-inc.c (DEBUG_FONTS3): * fontcolor-xlike-inc.c (DEBUG_FONTS4): * fontcolor-xlike-inc.c (DEBUG_FONTS_LISP1): * fontcolor-xlike-inc.c (count_hyphens): * fontcolor-xlike-inc.c (XFUN): * fontcolor-xlike-inc.c (xlistfonts_checking_charset): * fontcolor-xlike-inc.c (xft_find_charset_font): Misc. code fixes, mostly cosmetic. Get rid of some warnings. Fix the code to conform to GNU style standards. * lisp.h: * print.c: * print.c (debug_out_lisp): New function for doing printf-like formatting involving Lisp objects and outputting to the debug output.
author Ben Wing <ben@xemacs.org>
date Sun, 04 Apr 2010 23:46:50 -0500
parents 97eb4942aec8
children c096d8051f89 308d34e9f07d
comparison
equal deleted inserted replaced
5181:a00bfbd64e0a 5189:b65692aa90d8
171 I suspect that using symbol names or even keywords does not provide 171 I suspect that using symbol names or even keywords does not provide
172 assurance that the string won't move in memory. So we hash them 172 assurance that the string won't move in memory. So we hash them
173 ourselves; hash.c hashtables do not interpret the value pointers. 173 ourselves; hash.c hashtables do not interpret the value pointers.
174 174
175 This array should be FcChar8**, but GCC 4.x bitches about signedness. */ 175 This array should be FcChar8**, but GCC 4.x bitches about signedness. */
176 static const Extbyte *fc_standard_properties[] = { 176 static const Extbyte *fc_standard_properties[] =
177 {
177 /* treated specially, ordered first */ 178 /* treated specially, ordered first */
178 "family", "size", 179 "family", "size",
179 /* remaining are alphabetized by group */ 180 /* remaining are alphabetized by group */
180 /* standard properties in fontconfig and Xft v.2 */ 181 /* standard properties in fontconfig and Xft v.2 */
181 "antialias", "aspect", "autohint", "charset", "dpi", "file", 182 "antialias", "aspect", "autohint", "charset", "dpi", "file",
210 puthash (prop, NULL, fc_property_name_hash_table); 211 puthash (prop, NULL, fc_property_name_hash_table);
211 } 212 }
212 return prop; 213 return prop;
213 } 214 }
214 215
215 DEFUN("fc-pattern-p", Ffc_pattern_p, 1, 1, 0, /* 216 DEFUN ("fc-pattern-p", Ffc_pattern_p, 1, 1, 0, /*
216 Returns t if OBJECT is of type fc-pattern, nil otherwise. 217 Returns t if OBJECT is of type fc-pattern, nil otherwise.
217 */ 218 */
218 (object)) 219 (object))
219 { 220 {
220 return FC_PATTERNP(object) ? Qt : Qnil; 221 return FC_PATTERNP (object) ? Qt : Qnil;
221 } 222 }
222 223
223 DEFUN("fc-pattern-create", Ffc_pattern_create, 0, 0, 0, /* 224 DEFUN ("fc-pattern-create", Ffc_pattern_create, 0, 0, 0, /*
224 Return a new, empty fc-pattern object. 225 Return a new, empty fc-pattern object.
225 */ 226 */
226 ()) 227 ())
227 { 228 {
228 fc_pattern *fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); 229 fc_pattern *fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern));
229 230
230 fcpat->fcpatPtr = FcPatternCreate (); 231 fcpat->fcpatPtr = FcPatternCreate ();
231 return wrap_fc_pattern (fcpat); 232 return wrap_fc_pattern (fcpat);
232 } 233 }
233 234
234 DEFUN("fc-name-parse", Ffc_name_parse, 1, 1, 0, /* 235 DEFUN ("fc-name-parse", Ffc_name_parse, 1, 1, 0, /*
235 Parse an Fc font name and return its representation as a fc pattern object. 236 Parse an Fc font name and return its representation as a fc pattern object.
236 */ 237 */
237 (name)) 238 (name))
238 { 239 {
239 fc_pattern *fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); 240 fc_pattern *fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern));
244 return wrap_fc_pattern (fcpat); 245 return wrap_fc_pattern (fcpat);
245 } 246 }
246 247
247 /* #### Ga-a-ack! Xft's similar function is actually a different API. 248 /* #### Ga-a-ack! Xft's similar function is actually a different API.
248 We provide both. */ 249 We provide both. */
249 DEFUN("fc-name-unparse", Ffc_name_unparse, 1, 1, 0, /* 250 DEFUN ("fc-name-unparse", Ffc_name_unparse, 1, 1, 0, /*
250 Unparse an fc pattern object to a string. 251 Unparse an fc pattern object to a string.
251 */ 252 */
252 (pattern)) 253 (pattern))
253 { 254 {
254 FcChar8 *name; 255 FcChar8 *name;
255 Lisp_Object result; 256 Lisp_Object result;
256 CHECK_FC_PATTERN(pattern); 257 CHECK_FC_PATTERN (pattern);
257 name = FcNameUnparse (XFC_PATTERN_PTR (pattern)); 258 name = FcNameUnparse (XFC_PATTERN_PTR (pattern));
258 result = build_fcapi_string (name); 259 result = build_fcapi_string (name);
259 xfree (name); 260 xfree (name);
260 return result; 261 return result;
261 } 262 }
262 263
263 DEFUN("fc-pattern-duplicate", Ffc_pattern_duplicate, 1, 1, 0, /* 264 DEFUN ("fc-pattern-duplicate", Ffc_pattern_duplicate, 1, 1, 0, /*
264 Make a copy of the fc pattern object PATTERN and return it. 265 Make a copy of the fc pattern object PATTERN and return it.
265 */ 266 */
266 (pattern)) 267 (pattern))
267 { 268 {
268 struct fc_pattern *copy = NULL; 269 struct fc_pattern *copy = NULL;
271 copy = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); 272 copy = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern));
272 copy->fcpatPtr = FcPatternDuplicate (XFC_PATTERN_PTR (pattern)); 273 copy->fcpatPtr = FcPatternDuplicate (XFC_PATTERN_PTR (pattern));
273 return wrap_fc_pattern (copy); 274 return wrap_fc_pattern (copy);
274 } 275 }
275 276
276 DEFUN("fc-pattern-add", Ffc_pattern_add, 3, 3, 0, /* 277 DEFUN ("fc-pattern-add", Ffc_pattern_add, 3, 3, 0, /*
277 Add attributes to the pattern object PATTERN. PROPERTY is a string naming 278 Add attributes to the pattern object PATTERN. PROPERTY is a string naming
278 the attribute to add, VALUE the value for this attribute. 279 the attribute to add, VALUE the value for this attribute.
279 280
280 VALUE may be a string, integer, float, or symbol, in which case the value 281 VALUE may be a string, integer, float, or symbol, in which case the value
281 will be added as an FcChar8[], int, double, or FcBool respectively. 282 will be added as an FcChar8[], int, double, or FcBool respectively.
290 CHECK_STRING (property); 291 CHECK_STRING (property);
291 292
292 obj = fc_intern (property); 293 obj = fc_intern (property);
293 fcpat = XFC_PATTERN_PTR (pattern); 294 fcpat = XFC_PATTERN_PTR (pattern);
294 295
295 if (STRINGP(value)) 296 if (STRINGP (value))
296 { 297 {
297 FcChar8 *str = (FcChar8 *) extract_fcapi_string (value); 298 FcChar8 *str = (FcChar8 *) extract_fcapi_string (value);
298 res = FcPatternAddString (fcpat, obj, str); 299 res = FcPatternAddString (fcpat, obj, str);
299 } 300 }
300 else if (INTP(value)) 301 else if (INTP (value))
301 { 302 {
302 res = FcPatternAddInteger (fcpat, obj, XINT(value)); 303 res = FcPatternAddInteger (fcpat, obj, XINT (value));
303 } 304 }
304 else if (FLOATP(value)) 305 else if (FLOATP (value))
305 { 306 {
306 res = FcPatternAddDouble (fcpat, obj, (double) XFLOAT_DATA(value)); 307 res = FcPatternAddDouble (fcpat, obj, (double) XFLOAT_DATA (value));
307 } 308 }
308 else if (SYMBOLP(value)) 309 else if (SYMBOLP (value))
309 { 310 {
310 res = FcPatternAddBool (fcpat, obj, !NILP(value)); 311 res = FcPatternAddBool (fcpat, obj, !NILP (value));
311 } 312 }
312 /* else ... maybe we should wta here? */ 313 /* else ... maybe we should wta here? */
313 314
314 return res ? Qt : Qnil; 315 return res ? Qt : Qnil;
315 } 316 }
316 317
317 DEFUN("fc-pattern-del", Ffc_pattern_del, 2, 2, 0, /* 318 DEFUN ("fc-pattern-del", Ffc_pattern_del, 2, 2, 0, /*
318 Remove attribute PROPERTY from fc pattern object OBJECT. 319 Remove attribute PROPERTY from fc pattern object OBJECT.
319 */ 320 */
320 (pattern, property)) 321 (pattern, property))
321 { 322 {
322 Bool res; 323 Bool res;
323 324
324 CHECK_FC_PATTERN(pattern); 325 CHECK_FC_PATTERN (pattern);
325 CHECK_STRING(property); 326 CHECK_STRING (property);
326 327
327 res = FcPatternDel(XFC_PATTERN_PTR(pattern), extract_fcapi_string (property)); 328 res = FcPatternDel (XFC_PATTERN_PTR (pattern), extract_fcapi_string (property));
328 return res ? Qt : Qnil; 329 return res ? Qt : Qnil;
329 } 330 }
330 331
331 /* Generic interface to FcPatternGet() 332 /* Generic interface to FcPatternGet()
332 * Don't support the losing symbol-for-property interface. 333 * Don't support the losing symbol-for-property interface.
333 */ 334 */
334 DEFUN("fc-pattern-get", Ffc_pattern_get, 2, 4, 0, /* 335 DEFUN ("fc-pattern-get", Ffc_pattern_get, 2, 4, 0, /*
335 From PATTERN, extract PROPERTY for the ID'th member, of type TYPE. 336 From PATTERN, extract PROPERTY for the ID'th member, of type TYPE.
336 337
337 PATTERN is an Xft (fontconfig) pattern object. 338 PATTERN is an Xft (fontconfig) pattern object.
338 PROPERTY is a string naming an fontconfig font property. 339 PROPERTY is a string naming an fontconfig font property.
339 Optional ID is a nonnegative integer indexing the list of values for PROPERTY 340 Optional ID is a nonnegative integer indexing the list of values for PROPERTY
438 if (!NILP (type)) CHECK_SYMBOL (type); 439 if (!NILP (type)) CHECK_SYMBOL (type);
439 440
440 /* get property */ 441 /* get property */
441 fc_result = FcPatternGet (XFC_PATTERN_PTR (pattern), 442 fc_result = FcPatternGet (XFC_PATTERN_PTR (pattern),
442 fc_property, 443 fc_property,
443 NILP (id) ? 0 : XINT(id), 444 NILP (id) ? 0 : XINT (id),
444 &fc_value); 445 &fc_value);
445 446
446 switch (fc_result) 447 switch (fc_result)
447 { 448 {
448 case FcResultMatch: 449 case FcResultMatch:
496 new object if we don't already have a reference to it there. */ 497 new object if we don't already have a reference to it there. */
497 498
498 enum DestroyFontsetP { DestroyNo = 0, DestroyYes = 1 }; 499 enum DestroyFontsetP { DestroyNo = 0, DestroyYes = 1 };
499 500
500 static Lisp_Object 501 static Lisp_Object
501 fc_config_create_using (FcConfig * (*create_function) ()) 502 fc_config_create_using (FcConfig * (*create_function) (void))
502 { 503 {
503 FcConfig *fc = (*create_function) (); 504 FcConfig *fc = (*create_function) ();
504 Lisp_Object configs = XWEAK_LIST_LIST (Vfc_config_weak_list); 505 Lisp_Object configs = XWEAK_LIST_LIST (Vfc_config_weak_list);
505 506
506 /* Linear search: fc_configs are not going to multiply like conses. */ 507 /* Linear search: fc_configs are not going to multiply like conses. */
526 FcChar8 *thing; 527 FcChar8 *thing;
527 Lisp_Object value = Qnil; 528 Lisp_Object value = Qnil;
528 FcStrList *thing_list; 529 FcStrList *thing_list;
529 530
530 CHECK_FC_CONFIG (config); 531 CHECK_FC_CONFIG (config);
531 thing_list = (*getter) (XFC_CONFIG_PTR(config)); 532 thing_list = (*getter) (XFC_CONFIG_PTR (config));
532 /* Yes, we need to do this check -- sheesh, Keith! */ 533 /* Yes, we need to do this check -- sheesh, Keith! */
533 if (!thing_list) 534 if (!thing_list)
534 return Qnil; 535 return Qnil;
535 while ((thing = FcStrListNext (thing_list))) 536 while ((thing = FcStrListNext (thing_list)))
536 value = Fcons (build_fcapi_string (thing), value); 537 value = Fcons (build_fcapi_string (thing), value);
550 invalid_state ("failed to create FcFontSet", Qunbound); 551 invalid_state ("failed to create FcFontSet", Qunbound);
551 for (idx = 0; idx < fontset->nfont; ++idx) 552 for (idx = 0; idx < fontset->nfont; ++idx)
552 { 553 {
553 fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); 554 fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern));
554 fcpat->fcpatPtr = FcPatternDuplicate (fontset->fonts[idx]); 555 fcpat->fcpatPtr = FcPatternDuplicate (fontset->fonts[idx]);
555 fontlist = Fcons (wrap_fc_pattern(fcpat), fontlist); 556 fontlist = Fcons (wrap_fc_pattern (fcpat), fontlist);
556 } 557 }
557 if (destroyp) 558 if (destroyp)
558 FcFontSetDestroy (fontset); 559 FcFontSetDestroy (fontset);
559 return fontlist; 560 return fontlist;
560 } 561 }
561 562
562 DEFUN("fc-config-p", Ffc_config_p, 1, 1, 0, /* 563 DEFUN ("fc-config-p", Ffc_config_p, 1, 1, 0, /*
563 Returns t if OBJECT is of type fc-config, nil otherwise. 564 Returns t if OBJECT is of type fc-config, nil otherwise.
564 */ 565 */
565 (object)) 566 (object))
566 { 567 {
567 return FC_CONFIGP (object) ? Qt : Qnil; 568 return FC_CONFIGP (object) ? Qt : Qnil;
568 } 569 }
569 570
570 DEFUN("fc-config-create", Ffc_config_create, 0, 0, 0, /* 571 DEFUN ("fc-config-create", Ffc_config_create, 0, 0, 0, /*
571 -- Function: FcConfig *FcConfigCreate (void) 572 -- Function: FcConfig *FcConfigCreate (void)
572 Creates an empty configuration. */ 573 Creates an empty configuration. */
573 ()) 574 ())
574 { 575 {
575 return fc_config_create_using (&FcConfigCreate); 576 return fc_config_create_using (&FcConfigCreate);
576 } 577 }
577 578
578 #if 0 579 #if 0
579 /* I'm sorry, but we just don't do this in Lisp, OK? 580 /* I'm sorry, but we just don't do this in Lisp, OK?
580 Don't even think about implementing this. */ 581 Don't even think about implementing this. */
581 DEFUN("fc-config-destroy", Ffc_config_destroy, 1, 1, 0, /* 582 DEFUN ("fc-config-destroy", Ffc_config_destroy, 1, 1, 0, /*
582 -- Function: void FcConfigDestroy (FcConfig *config) 583 -- Function: void FcConfigDestroy (FcConfig *config)
583 Destroys a configuration and any data associated with it. Note 584 Destroys a configuration and any data associated with it. Note
584 that calling this function with the return value from 585 that calling this function with the return value from
585 FcConfigGetCurrent will place the library in an indeterminate 586 FcConfigGetCurrent will place the library in an indeterminate
586 state. */ 587 state. */
589 signal_error (Qunimplemented, "No user-servicable parts!", 590 signal_error (Qunimplemented, "No user-servicable parts!",
590 intern ("fc-config-destroy")); 591 intern ("fc-config-destroy"));
591 } 592 }
592 #endif 593 #endif
593 594
594 DEFUN("fc-config-up-to-date", Ffc_config_up_to_date, 1, 1, 0, /* 595 DEFUN ("fc-config-up-to-date", Ffc_config_up_to_date, 1, 1, 0, /*
595 -- Function: FcBool FcConfigUptoDate (FcConfig *config) 596 -- Function: FcBool FcConfigUptoDate (FcConfig *config)
596 Checks all of the files related to 'config' and returns whether the 597 Checks all of the files related to 'config' and returns whether the
597 in-memory version is in sync with the disk version. */ 598 in-memory version is in sync with the disk version. */
598 (config)) 599 (config))
599 { 600 {
600 CHECK_FC_CONFIG (config); 601 CHECK_FC_CONFIG (config);
601 return FcConfigUptoDate (XFC_CONFIG_PTR (config)) == FcFalse ? Qnil : Qt; 602 return FcConfigUptoDate (XFC_CONFIG_PTR (config)) == FcFalse ? Qnil : Qt;
602 } 603 }
603 604
604 DEFUN("fc-config-build-fonts", Ffc_config_build_fonts, 1, 1, 0, /* 605 DEFUN ("fc-config-build-fonts", Ffc_config_build_fonts, 1, 1, 0, /*
605 -- Function: FcBool FcConfigBuildFonts (FcConfig *config) 606 -- Function: FcBool FcConfigBuildFonts (FcConfig *config)
606 Builds the set of available fonts for the given configuration. 607 Builds the set of available fonts for the given configuration.
607 Note that any changes to the configuration after this call have 608 Note that any changes to the configuration after this call have
608 indeterminate effects. Returns FcFalse if this operation runs out 609 indeterminate effects. Returns FcFalse if this operation runs out
609 of memory. 610 of memory.
614 if (FcConfigBuildFonts (XFC_CONFIG_PTR (config)) == FcFalse) 615 if (FcConfigBuildFonts (XFC_CONFIG_PTR (config)) == FcFalse)
615 out_of_memory ("FcConfigBuildFonts failed", config); 616 out_of_memory ("FcConfigBuildFonts failed", config);
616 return Qnil; 617 return Qnil;
617 } 618 }
618 619
619 DEFUN("fc-config-get-config-dirs", Ffc_config_get_config_dirs, 1, 1, 0, /* 620 DEFUN ("fc-config-get-config-dirs", Ffc_config_get_config_dirs, 1, 1, 0, /*
620 -- Function: FcStrList *FcConfigGetConfigDirs (FcConfig *config) 621 -- Function: FcStrList *FcConfigGetConfigDirs (FcConfig *config)
621 Returns the list of font directories specified in the 622 Returns the list of font directories specified in the
622 configuration files for 'config'. Does not include any 623 configuration files for 'config'. Does not include any
623 subdirectories. */ 624 subdirectories. */
624 (config)) 625 (config))
625 { 626 {
626 return fc_strlist_to_lisp_using (&FcConfigGetConfigDirs, config); 627 return fc_strlist_to_lisp_using (&FcConfigGetConfigDirs, config);
627 } 628 }
628 629
629 DEFUN("fc-config-get-font-dirs", Ffc_config_get_font_dirs, 1, 1, 0, /* 630 DEFUN ("fc-config-get-font-dirs", Ffc_config_get_font_dirs, 1, 1, 0, /*
630 -- Function: FcStrList *FcConfigGetFontDirs (FcConfig *config) 631 -- Function: FcStrList *FcConfigGetFontDirs (FcConfig *config)
631 Returns the list of font directories in 'config'. This includes the 632 Returns the list of font directories in 'config'. This includes the
632 configured font directories along with any directories below those 633 configured font directories along with any directories below those
633 in the filesystem. */ 634 in the filesystem. */
634 (config)) 635 (config))
635 { 636 {
636 return fc_strlist_to_lisp_using (&FcConfigGetFontDirs, config); 637 return fc_strlist_to_lisp_using (&FcConfigGetFontDirs, config);
637 } 638 }
638 639
639 DEFUN("fc-config-get-config-files", Ffc_config_get_config_files, 1, 1, 0, /* 640 DEFUN ("fc-config-get-config-files", Ffc_config_get_config_files, 1, 1, 0, /*
640 -- Function: FcStrList *FcConfigGetConfigFiles (FcConfig *config) 641 -- Function: FcStrList *FcConfigGetConfigFiles (FcConfig *config)
641 Returns the list of known configuration files used to generate 642 Returns the list of known configuration files used to generate
642 'config'. Note that this will not include any configuration done 643 'config'. Note that this will not include any configuration done
643 with FcConfigParse. */ 644 with FcConfigParse. */
644 (config)) 645 (config))
645 { 646 {
646 return fc_strlist_to_lisp_using (&FcConfigGetConfigFiles, config); 647 return fc_strlist_to_lisp_using (&FcConfigGetConfigFiles, config);
647 } 648 }
648 649
649 DEFUN("fc-config-get-cache", Ffc_config_get_cache, 1, 1, 0, /* 650 DEFUN ("fc-config-get-cache", Ffc_config_get_cache, 1, 1, 0, /*
650 -- Function: char *FcConfigGetCache (FcConfig *config) 651 -- Function: char *FcConfigGetCache (FcConfig *config)
651 Returns the name of the file used to store per-user font 652 Returns the name of the file used to store per-user font
652 information. */ 653 information. */
653 (config)) 654 (config))
654 { 655 {
655 CHECK_FC_CONFIG (config); 656 CHECK_FC_CONFIG (config);
656 /* Surely FcConfigGetCache just casts an FcChar8* to char*. */ 657 /* Surely FcConfigGetCache just casts an FcChar8* to char*. */
657 return build_fcapi_string ((FcChar8 *) FcConfigGetCache (XFC_CONFIG_PTR (config))); 658 return build_fcapi_string ((FcChar8 *) FcConfigGetCache (XFC_CONFIG_PTR (config)));
658 } 659 }
659 660
660 DEFUN("fc-config-get-fonts", Ffc_config_get_fonts, 2, 2, 0, /* 661 DEFUN ("fc-config-get-fonts", Ffc_config_get_fonts, 2, 2, 0, /*
661 -- Function: FcFontSet *FcConfigGetFonts (FcConfig *config, FcSetName set) 662 -- Function: FcFontSet *FcConfigGetFonts (FcConfig *config, FcSetName set)
662 Returns one of the two sets of fonts from the configuration as 663 Returns one of the two sets of fonts from the configuration as
663 specified by 'set'. 664 specified by 'set'.
664 `FcSetName' 665 `FcSetName'
665 Specifies one of the two sets of fonts available in a 666 Specifies one of the two sets of fonts available in a
683 684
684 fs = FcConfigGetFonts (XFC_CONFIG_PTR (config), name); 685 fs = FcConfigGetFonts (XFC_CONFIG_PTR (config), name);
685 return fs ? fontset_to_list (fs, DestroyNo) : Qnil; 686 return fs ? fontset_to_list (fs, DestroyNo) : Qnil;
686 } 687 }
687 688
688 DEFUN("fc-config-set-current", Ffc_config_set_current, 1, 1, 0, /* 689 DEFUN ("fc-config-set-current", Ffc_config_set_current, 1, 1, 0, /*
689 -- Function: FcBool FcConfigSetCurrent (FcConfig *config) 690 -- Function: FcBool FcConfigSetCurrent (FcConfig *config)
690 Sets the current default configuration to 'config'. Implicitly 691 Sets the current default configuration to 'config'. Implicitly
691 calls FcConfigBuildFonts if necessary, returning FcFalse if that 692 calls FcConfigBuildFonts if necessary, returning FcFalse if that
692 call fails. 693 call fails.
693 XEmacs: signals out-of-memory if FcConfigBuildFonts fails, or args-out-of-range 694 XEmacs: signals out-of-memory if FcConfigBuildFonts fails, or args-out-of-range
715 if (FcConfigSetCurrent (XFC_CONFIG_PTR (config)) == FcFalse) 716 if (FcConfigSetCurrent (XFC_CONFIG_PTR (config)) == FcFalse)
716 out_of_memory ("FcConfigBuildFonts failed in set", config); 717 out_of_memory ("FcConfigBuildFonts failed in set", config);
717 return Qnil; 718 return Qnil;
718 } 719 }
719 720
720 DEFUN("fc-config-get-blanks", Ffc_config_get_blanks, 1, 1, 0, /* 721 DEFUN ("fc-config-get-blanks", Ffc_config_get_blanks, 1, 1, 0, /*
721 -- Function: FcBlanks *FcConfigGetBlanks (FcConfig *config) 722 -- Function: FcBlanks *FcConfigGetBlanks (FcConfig *config)
722 Returns the FcBlanks object associated with the given 723 Returns the FcBlanks object associated with the given
723 configuration, if no blanks were present in the configuration, 724 configuration, if no blanks were present in the configuration,
724 this function will return 0. 725 this function will return 0.
725 XEmacs: should convert to a chartable. 726 XEmacs: should convert to a chartable.
729 CHECK_FC_CONFIG (config); 730 CHECK_FC_CONFIG (config);
730 signal_error (Qunimplemented, "no method to convert FcBlanks object", 731 signal_error (Qunimplemented, "no method to convert FcBlanks object",
731 intern ("fc-config-get-blanks")); 732 intern ("fc-config-get-blanks"));
732 } 733 }
733 734
734 DEFUN("fc-config-get-rescan-interval", Ffc_config_get_rescan_interval, 1, 1, 0, /* 735 DEFUN ("fc-config-get-rescan-interval", Ffc_config_get_rescan_interval, 1, 1, 0, /*
735 -- Function: int FcConfigGetRescanInterval (FcConfig *config) 736 -- Function: int FcConfigGetRescanInterval (FcConfig *config)
736 Returns the interval between automatic checks of the configuration 737 Returns the interval between automatic checks of the configuration
737 (in seconds) specified in 'config'. The configuration is checked 738 (in seconds) specified in 'config'. The configuration is checked
738 during a call to FcFontList when this interval has passed since 739 during a call to FcFontList when this interval has passed since
739 the last check. */ 740 the last check. */
741 { 742 {
742 CHECK_FC_CONFIG (config); 743 CHECK_FC_CONFIG (config);
743 return make_int (FcConfigGetRescanInterval (XFC_CONFIG_PTR (config))); 744 return make_int (FcConfigGetRescanInterval (XFC_CONFIG_PTR (config)));
744 } 745 }
745 746
746 DEFUN("fc-config-set-rescan-interval", Ffc_config_set_rescan_interval, 2, 2, 0, /* 747 DEFUN ("fc-config-set-rescan-interval", Ffc_config_set_rescan_interval, 2, 2, 0, /*
747 -- Function: FcBool FcConfigSetRescanInterval (FcConfig *config, int 748 -- Function: FcBool FcConfigSetRescanInterval (FcConfig *config, int
748 rescanInterval) 749 rescanInterval)
749 Sets the rescan interval; returns FcFalse if an error occurred. 750 Sets the rescan interval; returns FcFalse if an error occurred.
750 XEmacs: signal such error, or return nil on success. */ 751 XEmacs: signal such error, or return nil on success. */
751 (config, rescan_interval)) 752 (config, rescan_interval))
758 intern ("fc-config-set-rescan-interval")); 759 intern ("fc-config-set-rescan-interval"));
759 return Qnil; 760 return Qnil;
760 } 761 }
761 762
762 /* #### This might usefully be made interactive. */ 763 /* #### This might usefully be made interactive. */
763 DEFUN("fc-config-app-font-add-file", Ffc_config_app_font_add_file, 2, 2, 0, /* 764 DEFUN ("fc-config-app-font-add-file", Ffc_config_app_font_add_file, 2, 2, 0, /*
764 -- Function: FcBool FcConfigAppFontAddFile (FcConfig *config, const 765 -- Function: FcBool FcConfigAppFontAddFile (FcConfig *config, const
765 char *file) 766 char *file)
766 Adds an application-specific font to the configuration. */ 767 Adds an application-specific font to the configuration. */
767 (config, file)) 768 (config, file))
768 { 769 {
776 else 777 else
777 return Qt; 778 return Qt;
778 } 779 }
779 780
780 /* #### This might usefully be made interactive. */ 781 /* #### This might usefully be made interactive. */
781 DEFUN("fc-config-app-font-add-dir", Ffc_config_app_font_add_dir, 2, 2, 0, /* 782 DEFUN ("fc-config-app-font-add-dir", Ffc_config_app_font_add_dir, 2, 2, 0, /*
782 -- Function: FcBool FcConfigAppFontAddDir (FcConfig *config, const 783 -- Function: FcBool FcConfigAppFontAddDir (FcConfig *config, const
783 char *dir) 784 char *dir)
784 Scans the specified directory for fonts, adding each one found to 785 Scans the specified directory for fonts, adding each one found to
785 the application-specific set of fonts. */ 786 the application-specific set of fonts. */
786 (config, dir)) 787 (config, dir))
795 else 796 else
796 return Qt; 797 return Qt;
797 } 798 }
798 799
799 /* #### This might usefully be made interactive. */ 800 /* #### This might usefully be made interactive. */
800 DEFUN("fc-config-app-font-clear", Ffc_config_app_font_clear, 1, 1, 0, /* 801 DEFUN ("fc-config-app-font-clear", Ffc_config_app_font_clear, 1, 1, 0, /*
801 -- Function: void FcConfigAppFontClear (FcConfig *config) 802 -- Function: void FcConfigAppFontClear (FcConfig *config)
802 Clears the set of application-specific fonts. */ 803 Clears the set of application-specific fonts. */
803 (config)) 804 (config))
804 { 805 {
805 CHECK_FC_CONFIG (config); 806 CHECK_FC_CONFIG (config);
809 810
810 /* These functions provide some control over how the default 811 /* These functions provide some control over how the default
811 configuration of the library is initialized. (This configuration is 812 configuration of the library is initialized. (This configuration is
812 normally implicitly initialized.) */ 813 normally implicitly initialized.) */
813 814
814 DEFUN("fc-config-filename", Ffc_config_filename, 1, 1, 0, /* 815 DEFUN ("fc-config-filename", Ffc_config_filename, 1, 1, 0, /*
815 -- Function: char *FcConfigFilename (const char *name) 816 -- Function: char *FcConfigFilename (const char *name)
816 Given the specified external entity name, return the associated 817 Given the specified external entity name, return the associated
817 filename. This provides applications a way to convert various 818 filename. This provides applications a way to convert various
818 configuration file references into filename form. 819 configuration file references into filename form.
819 820
836 LISP_PATHNAME_CONVERT_OUT (name, fcname); 837 LISP_PATHNAME_CONVERT_OUT (name, fcname);
837 } 838 }
838 return (build_fcapi_string (FcConfigFilename ((FcChar8 *) fcname))); 839 return (build_fcapi_string (FcConfigFilename ((FcChar8 *) fcname)));
839 } 840 }
840 841
841 DEFUN("fc-init-load-config", Ffc_init_load_config, 0, 0, 0, /* 842 DEFUN ("fc-init-load-config", Ffc_init_load_config, 0, 0, 0, /*
842 -- Function: FcConfig *FcInitLoadConfig (void) 843 -- Function: FcConfig *FcInitLoadConfig (void)
843 Loads the default configuration file and returns the resulting 844 Loads the default configuration file and returns the resulting
844 configuration. Does not load any font information. */ 845 configuration. Does not load any font information. */
845 ()) 846 ())
846 { 847 {
847 return fc_config_create_using (&FcInitLoadConfig); 848 return fc_config_create_using (&FcInitLoadConfig);
848 } 849 }
849 850
850 DEFUN("fc-init-load-config-and-fonts", Ffc_init_load_config_and_fonts, 0, 0, 0, /* 851 DEFUN ("fc-init-load-config-and-fonts", Ffc_init_load_config_and_fonts, 0, 0, 0, /*
851 -- Function: FcConfig *FcInitLoadConfigAndFonts (void) 852 -- Function: FcConfig *FcInitLoadConfigAndFonts (void)
852 Loads the default configuration file and builds information about 853 Loads the default configuration file and builds information about
853 the available fonts. Returns the resulting configuration. */ 854 the available fonts. Returns the resulting configuration. */
854 ()) 855 ())
855 { 856 {
856 return fc_config_create_using (&FcInitLoadConfigAndFonts); 857 return fc_config_create_using (&FcInitLoadConfigAndFonts);
857 } 858 }
858 859
859 DEFUN("fc-config-get-current", Ffc_config_get_current, 0, 0, 0, /* 860 DEFUN ("fc-config-get-current", Ffc_config_get_current, 0, 0, 0, /*
860 -- Function: FcConfig *FcConfigGetCurrent (void) 861 -- Function: FcConfig *FcConfigGetCurrent (void)
861 Returns the current default configuration. */ 862 Returns the current default configuration. */
862 ()) 863 ())
863 { 864 {
864 return fc_config_create_using (&FcConfigGetCurrent); 865 return fc_config_create_using (&FcConfigGetCurrent);
865 } 866 }
866 867
867 /* Pattern manipulation functions. */ 868 /* Pattern manipulation functions. */
868 869
869 DEFUN("fc-default-substitute", Ffc_default_substitute, 1, 1, 0, /* 870 DEFUN ("fc-default-substitute", Ffc_default_substitute, 1, 1, 0, /*
870 Adds defaults for certain attributes if not specified in PATTERN. 871 Adds defaults for certain attributes if not specified in PATTERN.
871 FcPattern PATTERN is modified in-place, and nil is returned. 872 FcPattern PATTERN is modified in-place, and nil is returned.
872 * Patterns without a specified style or weight are set to Medium 873 * Patterns without a specified style or weight are set to Medium
873 * Patterns without a specified style or slant are set to Roman 874 * Patterns without a specified style or slant are set to Roman
874 * Patterns without a specified pixel size are given one computed from any 875 * Patterns without a specified pixel size are given one computed from any
882 883
883 /* -- Function: FcBool FcConfigSubstituteWithPat (FcConfig *config, 884 /* -- Function: FcBool FcConfigSubstituteWithPat (FcConfig *config,
884 FcPattern *p, FcPattern *p_pat FcMatchKind kind) 885 FcPattern *p, FcPattern *p_pat FcMatchKind kind)
885 OMITTED: use optional arguments in `fc-config-substitute'. */ 886 OMITTED: use optional arguments in `fc-config-substitute'. */
886 887
887 DEFUN("fc-config-substitute", Ffc_config_substitute, 1, 4, 0, /* 888 DEFUN ("fc-config-substitute", Ffc_config_substitute, 1, 4, 0, /*
888 Modifies PATTERN according to KIND and TESTPAT using operations from CONFIG. 889 Modifies PATTERN according to KIND and TESTPAT using operations from CONFIG.
889 PATTERN is modified in-place. Returns an undocumented Boolean value. 890 PATTERN is modified in-place. Returns an undocumented Boolean value.
890 If optional KIND is `fc-match-pattern', then those tagged as pattern operations 891 If optional KIND is `fc-match-pattern', then those tagged as pattern operations
891 are applied, else if KIND is `fc-match-font', those tagged as font operations 892 are applied, else if KIND is `fc-match-font', those tagged as font operations
892 are applied and TESTPAT is used for <test> elements with target=pattern. KIND 893 are applied and TESTPAT is used for <test> elements with target=pattern. KIND
930 pattern on a certain set of properties. `FcFontSort' returns the 931 pattern on a certain set of properties. `FcFontSort' returns the
931 entire list of fonts, sorted in order of match quality, possibly 932 entire list of fonts, sorted in order of match quality, possibly
932 filtering out fonts that do not provide additional characters beyond 933 filtering out fonts that do not provide additional characters beyond
933 those provided by preferred fonts. */ 934 those provided by preferred fonts. */
934 935
935 DEFUN("fc-font-render-prepare", Ffc_font_render_prepare, 2, 3, 0, /* 936 DEFUN ("fc-font-render-prepare", Ffc_font_render_prepare, 2, 3, 0, /*
936 Return a new pattern blending PATTERN and FONT. 937 Return a new pattern blending PATTERN and FONT.
937 Optional CONFIG is an FcConfig, defaulting to the current one. 938 Optional CONFIG is an FcConfig, defaulting to the current one.
938 The returned pattern consists of elements of FONT not appearing in PATTERN, 939 The returned pattern consists of elements of FONT not appearing in PATTERN,
939 elements of PATTERN not appearing in FONT, and the best matching value from 940 elements of PATTERN not appearing in FONT, and the best matching value from
940 PATTERN for elements appearing in both. The result is passed to 941 PATTERN for elements appearing in both. The result is passed to
947 CHECK_FC_PATTERN (pattern); 948 CHECK_FC_PATTERN (pattern);
948 CHECK_FC_PATTERN (font); 949 CHECK_FC_PATTERN (font);
949 CHECK_FC_CONFIG (config); 950 CHECK_FC_CONFIG (config);
950 951
951 /* I don't think this can fail? */ 952 /* I don't think this can fail? */
952 return wrap_fc_pattern (FcFontRenderPrepare (XFC_CONFIG_PTR(config), 953 return wrap_fc_pattern (FcFontRenderPrepare (XFC_CONFIG_PTR (config),
953 XFC_PATTERN_PTR(font), 954 XFC_PATTERN_PTR (font),
954 XFC_PATTERN_PTR(pattern))); 955 XFC_PATTERN_PTR (pattern)));
955 } 956 }
956 957
957 DEFUN("fc-font-match", Ffc_font_match, 2, 3, 0, /* 958 DEFUN ("fc-font-match", Ffc_font_match, 2, 3, 0, /*
958 Return the font on DEVICE that most closely matches PATTERN. 959 Return the font on DEVICE that most closely matches PATTERN.
959 960
960 DEVICE is an X11 device. 961 DEVICE is an X11 device.
961 PATTERN is a fontconfig pattern object. 962 PATTERN is a fontconfig pattern object.
962 Optional CONFIG is an FcConfig, defaulting to the current one. 963 Optional CONFIG is an FcConfig, defaulting to the current one.
970 FcResult res; 971 FcResult res;
971 struct fc_pattern *res_fcpat; 972 struct fc_pattern *res_fcpat;
972 FcPattern *p; 973 FcPattern *p;
973 FcConfig *fcc; 974 FcConfig *fcc;
974 975
975 CHECK_FC_PATTERN(pattern); 976 CHECK_FC_PATTERN (pattern);
976 if (NILP(device)) 977 if (NILP (device))
977 return Qnil; 978 return Qnil;
978 CHECK_X_DEVICE(device); 979 CHECK_X_DEVICE (device);
979 if (!DEVICE_LIVE_P(XDEVICE(device))) 980 if (!DEVICE_LIVE_P (XDEVICE (device)))
980 return Qnil; 981 return Qnil;
981 if (!NILP (config)) 982 if (!NILP (config))
982 CHECK_FC_CONFIG (config); 983 CHECK_FC_CONFIG (config);
983 984
984 res_fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern)); 985 res_fcpat = XFC_PATTERN (ALLOC_NORMAL_LISP_OBJECT (fc_pattern));
985 p = XFC_PATTERN_PTR(pattern); 986 p = XFC_PATTERN_PTR (pattern);
986 fcc = NILP (config) ? FcConfigGetCurrent () : XFC_CONFIG_PTR (config); 987 fcc = NILP (config) ? FcConfigGetCurrent () : XFC_CONFIG_PTR (config);
987 988
988 FcConfigSubstitute (fcc, p, FcMatchPattern); 989 FcConfigSubstitute (fcc, p, FcMatchPattern);
989 FcDefaultSubstitute (p); 990 FcDefaultSubstitute (p);
990 res = FcResultMatch; 991 res = FcResultMatch;
991 res_fcpat->fcpatPtr = FcFontMatch (fcc, p, &res); 992 res_fcpat->fcpatPtr = FcFontMatch (fcc, p, &res);
992 993
993 if (res_fcpat->fcpatPtr == NULL) 994 if (res_fcpat->fcpatPtr == NULL)
994 switch (res) { 995 switch (res)
995 case FcResultNoMatch: 996 {
996 return Qfc_result_no_match; 997 case FcResultNoMatch:
997 case FcResultNoId: 998 return Qfc_result_no_match;
998 return Qfc_result_no_id; 999 case FcResultNoId:
999 default: 1000 return Qfc_result_no_id;
1000 return Qfc_internal_error; 1001 default:
1001 } 1002 return Qfc_internal_error;
1003 }
1002 else 1004 else
1003 return wrap_fc_pattern(res_fcpat); 1005 return wrap_fc_pattern (res_fcpat);
1004 } 1006 }
1005 1007
1006 /* #### fix this name to correspond to Ben's new nomenclature */ 1008 /* #### fix this name to correspond to Ben's new nomenclature */
1007 DEFUN("fc-list-fonts-pattern-objects", Ffc_list_fonts_pattern_objects, 1009 DEFUN ("fc-list-fonts-pattern-objects", Ffc_list_fonts_pattern_objects,
1008 3, 3, 0, /* 1010 3, 3, 0, /*
1009 Return a list of fonts on DEVICE that match PATTERN for PROPERTIES. 1011 Return a list of fonts on DEVICE that match PATTERN for PROPERTIES.
1010 Each font is represented by a fontconfig pattern object. 1012 Each font is represented by a fontconfig pattern object.
1011 1013
1012 DEVICE is an X11 device. 1014 DEVICE is an X11 device.
1032 return fontset_to_list (fontset, DestroyYes); 1034 return fontset_to_list (fontset, DestroyYes);
1033 1035
1034 } 1036 }
1035 1037
1036 /* #### maybe this can/should be folded into fc-list-fonts-pattern-objects? */ 1038 /* #### maybe this can/should be folded into fc-list-fonts-pattern-objects? */
1037 DEFUN("fc-font-sort", Ffc_font_sort, 2, 4, 0, /* 1039 DEFUN ("fc-font-sort", Ffc_font_sort, 2, 4, 0, /*
1038 Return a list of all fonts sorted by proximity to PATTERN. 1040 Return a list of all fonts sorted by proximity to PATTERN.
1039 Each font is represented by a fontconfig pattern object. 1041 Each font is represented by a fontconfig pattern object.
1040 1042
1041 DEVICE is an X11 device. 1043 DEVICE is an X11 device.
1042 PATTERN is a fontconfig pattern to be matched. 1044 PATTERN is a fontconfig pattern to be matched.
1058 FcConfig *fcc = FcConfigGetCurrent(); 1060 FcConfig *fcc = FcConfigGetCurrent();
1059 FcFontSet *fontset; 1061 FcFontSet *fontset;
1060 FcPattern *p = XFC_PATTERN_PTR (pattern); 1062 FcPattern *p = XFC_PATTERN_PTR (pattern);
1061 FcResult fcresult; 1063 FcResult fcresult;
1062 1064
1063 if (NILP(nosub)) /* #### temporary debug hack */ 1065 if (NILP (nosub)) /* #### temporary debug hack */
1064 FcDefaultSubstitute (p); 1066 FcDefaultSubstitute (p);
1065 FcConfigSubstitute (fcc, p, FcMatchPattern); 1067 FcConfigSubstitute (fcc, p, FcMatchPattern);
1066 fontset = FcFontSort (fcc, p, !NILP(trim), NULL, &fcresult); 1068 fontset = FcFontSort (fcc, p, !NILP (trim), NULL, &fcresult);
1067 1069
1068 return fontset_to_list (fontset, DestroyYes); 1070 return fontset_to_list (fontset, DestroyYes);
1069 } 1071 }
1070 } 1072 }
1071 1073
1104 DEFINE_NODUMP_LISP_OBJECT ("fc-config", fc_config, 1106 DEFINE_NODUMP_LISP_OBJECT ("fc-config", fc_config,
1105 0, external_object_printer, finalize_fc_config, 1107 0, external_object_printer, finalize_fc_config,
1106 0, 0, fcconfig_description, 1108 0, 0, fcconfig_description,
1107 struct fc_config); 1109 struct fc_config);
1108 1110
1109 DEFUN("fc-init", Ffc_init, 0, 0, 0, /* 1111 DEFUN ("fc-init", Ffc_init, 0, 0, 0, /*
1110 -- Function: FcBool FcInit (void) 1112 -- Function: FcBool FcInit (void)
1111 Loads the default configuration file and the fonts referenced 1113 Loads the default configuration file and the fonts referenced
1112 therein and sets the default configuration to that result. 1114 therein and sets the default configuration to that result.
1113 Returns whether this process succeeded or not. If the default 1115 Returns whether this process succeeded or not. If the default
1114 configuration has already been loaded, this routine does nothing 1116 configuration has already been loaded, this routine does nothing
1116 ()) 1118 ())
1117 { 1119 {
1118 return (FcInit () == FcTrue) ? Qt : Qnil; 1120 return (FcInit () == FcTrue) ? Qt : Qnil;
1119 } 1121 }
1120 1122
1121 DEFUN("fc-get-version", Ffc_get_version, 0, 0, 0, /* 1123 DEFUN ("fc-get-version", Ffc_get_version, 0, 0, 0, /*
1122 -- Function: int FcGetVersion (void) 1124 -- Function: int FcGetVersion (void)
1123 Returns the version number of the library. 1125 Returns the version number of the library.
1124 XEmacs: No, this should NOT return a pretty string. 1126 XEmacs: No, this should NOT return a pretty string.
1125 (let ((i (fc-get-version))) 1127 (let ((i (fc-get-version)))
1126 (format "%d.%d.%d" (/ i 10000) (mod (/ i 100) 100) (mod i 100))) 1128 (format "%d.%d.%d" (/ i 10000) (mod (/ i 100) 100) (mod i 100)))
1130 ()) 1132 ())
1131 { 1133 {
1132 return make_int (FcGetVersion ()); 1134 return make_int (FcGetVersion ());
1133 } 1135 }
1134 1136
1135 DEFUN("fc-init-reinitialize", Ffc_init_reinitialize, 0, 0, 0, /* 1137 DEFUN ("fc-init-reinitialize", Ffc_init_reinitialize, 0, 0, 0, /*
1136 -- Function: FcBool FcInitReinitialize (void) 1138 -- Function: FcBool FcInitReinitialize (void)
1137 Forces the default configuration file to be reloaded and resets 1139 Forces the default configuration file to be reloaded and resets
1138 the default configuration. */ 1140 the default configuration. */
1139 ()) 1141 ())
1140 { 1142 {
1141 return (FcInitReinitialize () == FcTrue) ? Qt : Qnil; 1143 return (FcInitReinitialize () == FcTrue) ? Qt : Qnil;
1142 } 1144 }
1143 1145
1144 DEFUN("fc-init-bring-up-to-date", Ffc_init_bring_up_to_date, 0, 0, 0, /* 1146 DEFUN ("fc-init-bring-up-to-date", Ffc_init_bring_up_to_date, 0, 0, 0, /*
1145 -- Function: FcBool FcInitBringUptoDate (void) 1147 -- Function: FcBool FcInitBringUptoDate (void)
1146 Checks the rescan interval in the default configuration, checking 1148 Checks the rescan interval in the default configuration, checking
1147 the configuration if the interval has passed and reloading the 1149 the configuration if the interval has passed and reloading the
1148 configuration when any changes are detected. */ 1150 configuration when any changes are detected. */
1149 ()) 1151 ())
1151 return (FcInitBringUptoDate () == FcTrue) ? Qt : Qnil; 1153 return (FcInitBringUptoDate () == FcTrue) ? Qt : Qnil;
1152 } 1154 }
1153 1155
1154 #endif /* FONTCONFIG_EXPOSE_CONFIG */ 1156 #endif /* FONTCONFIG_EXPOSE_CONFIG */
1155 1157
1156 DEFUN("xlfd-font-name-p", Fxlfd_font_name_p, 1, 1, 0, /* 1158 DEFUN ("xlfd-font-name-p", Fxlfd_font_name_p, 1, 1, 0, /*
1157 Check whether the string FONTNAME is a XLFD font name. */ 1159 Check whether the string FONTNAME is a XLFD font name. */
1158 (fontname)) 1160 (fontname))
1159 { 1161 {
1160 CHECK_STRING(fontname); 1162 CHECK_STRING (fontname);
1161 /* #### should bind `case-fold-search' here? */ 1163 /* #### should bind `case-fold-search' here? */
1162 return Fstring_match(Vxlfd_font_name_regexp, fontname, Qnil, Qnil); 1164 return Fstring_match (Vxlfd_font_name_regexp, fontname, Qnil, Qnil);
1163 } 1165 }
1164 1166
1165 /* FcPatternPrint: there is no point in having wrappers fc-pattern-print, 1167 /* FcPatternPrint: there is no point in having wrappers fc-pattern-print,
1166 Ffc_pattern_print since this function prints to stdout. */ 1168 Ffc_pattern_print since this function prints to stdout. */
1167 1169
1238 XE_XLFD_TEXT, /* encoding */ 1240 XE_XLFD_TEXT, /* encoding */
1239 "\\'" 1241 "\\'"
1240 }; 1242 };
1241 1243
1242 GCPRO1 (reg); 1244 GCPRO1 (reg);
1243 for (i = 0; i < sizeof(re)/sizeof(Extbyte *); i++) 1245 for (i = 0; i < sizeof (re)/sizeof (Extbyte *); i++)
1244 { 1246 {
1245 /* #### Currently this is Host Portable Coding, not ISO 8859-1. */ 1247 /* #### Currently this is Host Portable Coding, not ISO 8859-1. */
1246 reg = concat2(reg, build_extstring (re[i], Qx_font_name_encoding)); 1248 reg = concat2 (reg, build_extstring (re[i], Qx_font_name_encoding));
1247 } 1249 }
1248 1250
1249 RETURN_UNGCPRO (reg); 1251 RETURN_UNGCPRO (reg);
1250 } 1252 }
1251 #undef XE_XLFD_SEPARATOR 1253 #undef XE_XLFD_SEPARATOR
1273 FcObjectSetAdd (os, s); 1275 FcObjectSetAdd (os, s);
1274 } 1276 }
1275 } 1277 }
1276 1278
1277 void 1279 void
1278 syms_of_font_mgr (void) { 1280 syms_of_font_mgr (void)
1279 INIT_LISP_OBJECT(fc_pattern); 1281 {
1280 1282 INIT_LISP_OBJECT (fc_pattern);
1281 DEFSYMBOL_MULTIWORD_PREDICATE(Qfc_patternp); 1283
1282 1284 DEFSYMBOL_MULTIWORD_PREDICATE (Qfc_patternp);
1283 DEFSYMBOL(Qfc_result_type_mismatch); 1285
1284 DEFSYMBOL(Qfc_result_no_match); 1286 DEFSYMBOL (Qfc_result_type_mismatch);
1285 DEFSYMBOL(Qfc_result_no_id); 1287 DEFSYMBOL (Qfc_result_no_match);
1286 DEFSYMBOL(Qfc_internal_error); 1288 DEFSYMBOL (Qfc_result_no_id);
1287 DEFSYMBOL(Qfc_match_pattern); 1289 DEFSYMBOL (Qfc_internal_error);
1288 DEFSYMBOL(Qfc_match_font); 1290 DEFSYMBOL (Qfc_match_pattern);
1289 DEFSYMBOL(Qfont_mgr); 1291 DEFSYMBOL (Qfc_match_font);
1290 1292 DEFSYMBOL (Qfont_mgr);
1291 DEFSUBR(Ffc_pattern_p); 1293
1292 DEFSUBR(Ffc_pattern_create); 1294 DEFSUBR (Ffc_pattern_p);
1293 DEFSUBR(Ffc_name_parse); 1295 DEFSUBR (Ffc_pattern_create);
1294 DEFSUBR(Ffc_name_unparse); 1296 DEFSUBR (Ffc_name_parse);
1295 DEFSUBR(Ffc_pattern_duplicate); 1297 DEFSUBR (Ffc_name_unparse);
1296 DEFSUBR(Ffc_pattern_add); 1298 DEFSUBR (Ffc_pattern_duplicate);
1297 DEFSUBR(Ffc_pattern_del); 1299 DEFSUBR (Ffc_pattern_add);
1298 DEFSUBR(Ffc_pattern_get); 1300 DEFSUBR (Ffc_pattern_del);
1299 DEFSUBR(Ffc_list_fonts_pattern_objects); 1301 DEFSUBR (Ffc_pattern_get);
1300 DEFSUBR(Ffc_font_sort); 1302 DEFSUBR (Ffc_list_fonts_pattern_objects);
1301 DEFSUBR(Ffc_font_match); 1303 DEFSUBR (Ffc_font_sort);
1302 DEFSUBR(Ffc_default_substitute); 1304 DEFSUBR (Ffc_font_match);
1303 DEFSUBR(Ffc_config_substitute); 1305 DEFSUBR (Ffc_default_substitute);
1304 DEFSUBR(Ffc_font_render_prepare); 1306 DEFSUBR (Ffc_config_substitute);
1305 DEFSUBR(Fxlfd_font_name_p); 1307 DEFSUBR (Ffc_font_render_prepare);
1308 DEFSUBR (Fxlfd_font_name_p);
1306 1309
1307 #ifdef FONTCONFIG_EXPOSE_CONFIG 1310 #ifdef FONTCONFIG_EXPOSE_CONFIG
1308 INIT_LISP_OBJECT(fc_config); 1311 INIT_LISP_OBJECT (fc_config);
1309 1312
1310 DEFSYMBOL_MULTIWORD_PREDICATE(Qfc_configp); 1313 DEFSYMBOL_MULTIWORD_PREDICATE (Qfc_configp);
1311 1314
1312 DEFSUBR(Ffc_config_p); 1315 DEFSUBR (Ffc_config_p);
1313 DEFSUBR(Ffc_config_create); 1316 DEFSUBR (Ffc_config_create);
1314 #if 0 1317 #if 0
1315 DEFSUBR(Ffc_config_destroy); 1318 DEFSUBR (Ffc_config_destroy);
1316 #endif 1319 #endif
1317 DEFSUBR(Ffc_config_set_current); 1320 DEFSUBR (Ffc_config_set_current);
1318 DEFSUBR(Ffc_config_get_current); 1321 DEFSUBR (Ffc_config_get_current);
1319 DEFSUBR(Ffc_config_up_to_date); 1322 DEFSUBR (Ffc_config_up_to_date);
1320 DEFSUBR(Ffc_config_build_fonts); 1323 DEFSUBR (Ffc_config_build_fonts);
1321 DEFSUBR(Ffc_config_get_config_dirs); 1324 DEFSUBR (Ffc_config_get_config_dirs);
1322 DEFSUBR(Ffc_config_get_font_dirs); 1325 DEFSUBR (Ffc_config_get_font_dirs);
1323 DEFSUBR(Ffc_config_get_config_files); 1326 DEFSUBR (Ffc_config_get_config_files);
1324 DEFSUBR(Ffc_config_get_cache); 1327 DEFSUBR (Ffc_config_get_cache);
1325 DEFSUBR(Ffc_config_get_fonts); 1328 DEFSUBR (Ffc_config_get_fonts);
1326 DEFSUBR(Ffc_config_get_blanks); 1329 DEFSUBR (Ffc_config_get_blanks);
1327 DEFSUBR(Ffc_config_get_rescan_interval); 1330 DEFSUBR (Ffc_config_get_rescan_interval);
1328 DEFSUBR(Ffc_config_set_rescan_interval); 1331 DEFSUBR (Ffc_config_set_rescan_interval);
1329 DEFSUBR(Ffc_config_app_font_add_file); 1332 DEFSUBR (Ffc_config_app_font_add_file);
1330 DEFSUBR(Ffc_config_app_font_add_dir); 1333 DEFSUBR (Ffc_config_app_font_add_dir);
1331 DEFSUBR(Ffc_config_app_font_clear); 1334 DEFSUBR (Ffc_config_app_font_clear);
1332 DEFSUBR(Ffc_config_filename); 1335 DEFSUBR (Ffc_config_filename);
1333 DEFSUBR(Ffc_init_load_config); 1336 DEFSUBR (Ffc_init_load_config);
1334 DEFSUBR(Ffc_init_load_config_and_fonts); 1337 DEFSUBR (Ffc_init_load_config_and_fonts);
1335 DEFSUBR(Ffc_init); 1338 DEFSUBR (Ffc_init);
1336 DEFSUBR(Ffc_get_version); 1339 DEFSUBR (Ffc_get_version);
1337 DEFSUBR(Ffc_init_reinitialize); 1340 DEFSUBR (Ffc_init_reinitialize);
1338 DEFSUBR(Ffc_init_bring_up_to_date); 1341 DEFSUBR (Ffc_init_bring_up_to_date);
1339 #endif /* FONTCONFIG_EXPOSE_CONFIG */ 1342 #endif /* FONTCONFIG_EXPOSE_CONFIG */
1340 } 1343 }
1341 1344
1342 void 1345 void
1343 vars_of_font_mgr (void) 1346 vars_of_font_mgr (void)
1344 { 1347 {
1345 /* #### The next two DEFVARs belong somewhere else. */ 1348 /* #### The next two DEFVARs belong somewhere else. */
1346 1349
1347 /* #### I know, but the right fix is use the generic debug facility. */ 1350 /* #### I know, but the right fix is use the generic debug facility. */
1348 DEFVAR_INT ("xft-debug-level", &debug_xft /* 1351 DEFVAR_INT ("debug-xft", &debug_xft /*
1349 Level of debugging messages to issue to stderr for Xft. 1352 Level of debugging messages to issue to stderr for Xft.
1350 A nonnegative integer. Set to 0 to suppress all warnings. 1353 A nonnegative integer. Set to 0 to suppress all warnings.
1351 Default is 1 to ensure a minimum of debugging output at initialization. 1354 Default is 1 to ensure a minimum of debugging output at initialization.
1352 Higher levels give even more information. 1355 Higher levels give even more information.
1353 */ ); 1356 */ );
1354 debug_xft = 0; 1357 debug_xft = 0;
1355 1358
1356 DEFVAR_CONST_INT("xft-version", &xft_version /* 1359 DEFVAR_CONST_INT ("xft-version", &xft_version /*
1357 The major version number of the Xft library being used. 1360 The major version number of the Xft library being used.
1358 */ ); 1361 */ );
1359 xft_version = XFT_VERSION; 1362 xft_version = XFT_VERSION;
1360 1363
1361 DEFVAR_CONST_INT("fc-version", &fc_version /* 1364 DEFVAR_CONST_INT ("fc-version", &fc_version /*
1362 The version number of fontconfig.h. It can be checked against 1365 The version number of fontconfig.h. It can be checked against
1363 `(fc-get-version)', which is the version of the .so. 1366 `(fc-get-version)', which is the version of the .so.
1364 It's probably not a disaster if `(> (fc-get-version) fc-version)'. 1367 It's probably not a disaster if `(> (fc-get-version) fc-version)'.
1365 */ ); 1368 */ );
1366 fc_version = FC_VERSION; 1369 fc_version = FC_VERSION;
1374 #ifdef FONTCONFIG_EXPOSE_CONFIG 1377 #ifdef FONTCONFIG_EXPOSE_CONFIG
1375 Vfc_config_weak_list = make_weak_list (WEAK_LIST_SIMPLE); 1378 Vfc_config_weak_list = make_weak_list (WEAK_LIST_SIMPLE);
1376 staticpro (&Vfc_config_weak_list); 1379 staticpro (&Vfc_config_weak_list);
1377 #endif 1380 #endif
1378 1381
1379 DEFVAR_LISP("xft-xlfd-font-regexp", &Vxlfd_font_name_regexp /* 1382 DEFVAR_LISP ("xft-xlfd-font-regexp", &Vxlfd_font_name_regexp /*
1380 The regular expression used to match XLFD font names. */ 1383 The regular expression used to match XLFD font names. */
1381 ); 1384 );
1382 Vxlfd_font_name_regexp = make_xlfd_font_regexp(); 1385 Vxlfd_font_name_regexp = make_xlfd_font_regexp();
1383 } 1386 }
1384 1387