[cairo] "charset=" in trace file cause FcNameParse return NULL

Xi Yang hiyangxi at gmail.com
Fri Jul 11 05:22:51 PDT 2014


Hi,

cairo-perf-trace is not working on my machine (ubuntu 14.04, x86-64).

It looks like the problem is that FcNameParse is not happy with long
"charset= " substring. After cut it off, cairo-perf-trace works fine.

Does it mean that my fontconfig has problems? I attached the patch.


Regards.


diff --git a/util/cairo-script/cairo-script-operators.c
b/util/cairo-script/cairo-script-operators.c
index d4af312..4bc23be 100644
--- a/util/cairo-script/cairo-script-operators.c
+++ b/util/cairo-script/cairo-script-operators.c
@@ -1925,6 +1925,7 @@ _ft_create_for_pattern (csi_t *ctx,
     csi_status_t status;
     struct mmap_vec vec;
     void *bytes;
+    char *s;

     _csi_blob_init (&tmpl, (uint8_t *) string->string, string->len);
     _csi_blob_hash (&tmpl, (uint32_t *) string->string, string->len /
sizeof (uint32_t));
@@ -1944,7 +1945,9 @@ _ft_create_for_pattern (csi_t *ctx,
     } else {
     bytes = tmpl.bytes;
     }
-
+    s = strstr((char *)bytes, ":charset");
+    if (s != NULL)
+    *s = '\0';
     pattern = FcNameParse (bytes);
     if (bytes != tmpl.bytes)
     _csi_free (ctx, bytes);


More information about the cairo mailing list