diff src/font-mgr.c @ 5923:61d7d7bcbe76 cygwin

merged heads after pull -u
author Henry Thompson <ht@markup.co.uk>
date Thu, 05 Feb 2015 17:19:05 +0000
parents 5f02d29a2a65
children
line wrap: on
line diff
--- a/src/font-mgr.c	Wed Apr 23 22:22:37 2014 +0100
+++ b/src/font-mgr.c	Thu Feb 05 17:19:05 2015 +0000
@@ -255,13 +255,23 @@
    We provide both. */
 DEFUN ("fc-name-unparse", Ffc_name_unparse, 1, 1, 0, /*
 Unparse an fc pattern object to a string.
+  To work around a bug in fontconfig (at least 2.11.1), the 'charset' property
+is removed before passing to FcNameUnparse.  To extract the 'charset' property,
+use `\(fc-pattern-get PATTERN "charset")'.
 */
       (pattern))
 {
   FcChar8 *name;
   Lisp_Object result;
+
   CHECK_FC_PATTERN (pattern);
-  name = FcNameUnparse (XFC_PATTERN_PTR (pattern));
+  /* #### Could use multiple values here to extract and return charset? */
+  {
+    FcPattern* temp = FcPatternDuplicate (XFC_PATTERN_PTR (pattern));
+    FcPatternDel (temp, FC_CHARSET);
+    name = FcNameUnparse (temp);
+    FcPatternDestroy (temp);
+  }
   result = build_fcapi_string (name);
   xfree (name);
   return result;
@@ -337,6 +347,9 @@
 
 /* Generic interface to FcPatternGet()
  * Don't support the losing symbol-for-property interface.
+ * To support that interface properly, we should have `fc-register-property'
+ * so that only registered symbols could be used.  Then it would serve to
+ * provide the same kind of check that the C-level FC_* macros do.
  */
 DEFUN ("fc-pattern-get", Ffc_pattern_get, 2, 4, 0, /*
 From PATTERN, extract PROPERTY for the ID'th member, of type TYPE.