Pillow icon indicating copy to clipboard operation
Pillow copied to clipboard

Fixed set_variation_by_name offset

Open radarhere opened this issue 3 years ago • 1 comments

Resolves #6439

When calling FT_Set_Named_Instance, the index starts at 1.

https://freetype.org/freetype2/docs/reference/ft2-multiple_masters.html#ft_set_named_instance

The index of the requested instance, starting with value 1.

Apparently in #3802, I presumed it started at zero, leading to the wrong variation being selected.

https://github.com/python-pillow/Pillow/blob/d53344b39fc245744a6eb1d8cdf4e0427e871258/src/PIL/ImageFont.py#L798

radarhere avatar Jul 16 '22 10:07 radarhere

Instead of increasing the epsilon so much, would it be better to modify variation_adobe_older_harfbuzz_name.png instead?

You can grab the image rendered on the CI from the errors artifact of the failed build, looks like a.png from tmpqztw6w8z is the correct replacement, attached below:

a

nulano avatar Jul 17 '22 21:07 nulano

To be clear - I have implemented the suggestion from @nulano, and then he approved that.

radarhere avatar Oct 28 '22 10:10 radarhere