freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft-devel] [PATCH] Re: losing outline flags while auto-hinting


From: Miles Bader
Subject: Re: [ft-devel] [PATCH] Re: losing outline flags while auto-hinting
Date: Fri, 17 Feb 2012 14:28:52 +0900

Alexei Podtelezhnikov <address@hidden> writes:
>> This is a bug.  Reason is that the autohinter doesn't preserve this
>> flag while copying around the outlines (in function af_loader_load_g).
>
> This safe patch fixes it for me.
>
> -      slot->outline = internal->loader->base.outline;
> +      /* reassign all outline fields except flags to protect them */
> +      slot->outline.n_contours = internal->loader->base.outline.n_contours;
> +      slot->outline.n_points = internal->loader->base.outline.n_points;
> +      slot->outline.points = internal->loader->base.outline.points;
> +      slot->outline.tags = internal->loader->base.outline.tags;
> +      slot->outline.contours = internal->loader->base.outline.contours;

This has the slight danger that if someone adds a new field to
FT_Outline, they will forget to copy it here.

Maybe a safer way (and shorter) to do this is just save the contents
of "slot->outline.flags" before the structure copy, and then write it
back immediately afterwards:

    int saved_flags = slot->outline.flags;  /* preserve flags */
    slot->outline = internal->loader->base.outline;
    slot->outline.flags = saved_flags;

[moving the actual variable declaration to the head of the block to be
valid C89, of course.]

-Miles

-- 
/\ /\
(^.^)
(")")
*This is the cute kitty virus, please copy this into your sig so it can spread.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]