[cairo] "charset=" in trace file cause FcNameParse return NULL
Behdad Esfahbod
behdad at behdad.org
Fri Jul 11 07:37:21 PDT 2014
On 14-07-11 08:22 AM, Xi Yang wrote:
> 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.
Interesting. I wasn't aware that cairo perf traces contain fontconfig pattern
names with charset in them. Is this your own trace or from a cairo repository?
> Does it mean that my fontconfig has problems? I attached the patch.
I assume you are using fontconfig master? I changed the charset format to
make it human-readable. Maybe I should add support for the previous format
back, though I prefer not to do that since that format should have had gone
years ago.
Can you just regenerate your traces or is that too much trouble?
behdad
>
>
> 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);
>
--
behdad
http://behdad.org/
More information about the cairo
mailing list