[HarfBuzz] harfbuzz-ng: Branch 'master'

Behdad Esfahbod behdad at behdad.org
Tue Mar 1 22:01:23 PST 2011


On 02/26/11 12:57, Wouter Bolsterlee wrote:
> Hi Behdad,
> 
> Thanks for working on this. I've added a few comments below.

Thanks Wouter.  Comments inline.


>     — Wouter
> 
> Behdad Esfahbod schreef op di 22-02-2011 om 15:06 [-0800]:
>> commit 5353bf439c150492708ef9337078cfd73b83627b
> [snip]
>> +int
>> +main (int argc, char **argv)
>> +{
> [...]
>> +  cairo_face = cairo_ft_font_face_create_for_ft_face (ft_face, 0);
>> +
>> +  draw ();
>> +  draw ();
> 
> What is the reason to invoke draw() twice?

The code needs restructuring to not use global variables the way it currently
does.  But regardless, the first draw starts with a 0x0 surface, draw, and
computes the desired width and height, and the second draw creates a surface
with the desired width and height and does the same.  It's a common pattern
reoccurring with cairo drawing.


>> +  cairo_surface_write_to_png (surface, out_file);
> 
> Error handling here would be helpful to diagnose issues that fall
> outside the scope of HarfBuzz, e.g. file system permissions. Something
> like this would do I think:
> 
>   cairo_status_t status;
>   st = cairo_surface_write_to_png (surface, out_file);
>   if (status != CAIRO_STATUS_SUCCESS) {
>     fprintf (stderr, "Failed to write output file: `%s'\n", cairo_status_to_string (status));
>     exit (1);
>   }

Thanks.  Pushed.

behdad



More information about the HarfBuzz mailing list