Re: "charset=" in trace file cause FcNameParse return NULL

Behdad Esfahbod <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
I just pushed a commit to master to remove charset before writing trace.  If
you regenerate your traces you shouldn't have this problem anymore.  Sorry
about the inconvenience.

If that's too much trouble, I don't mind adding something like your patch, to
remove charset when parsing.

On 14-07-11 10:37 AM, Behdad Esfahbod wrote:
> 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/
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.