freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Taming CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y* for a gam


From: Nikolaus Waxweiler
Subject: Re: [ft-devel] Taming CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y* for a gamma of ~2.2/sRGB?
Date: Tue, 18 Aug 2015 19:23:22 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

Unfortunately, FreeType's source code is not sufficiently documented.
It would be great if you could add comments while walking over the
various functions that I can then further massage and commit.

Alright, will get back to you once I understand.. something ;)

Speaking of understanding, I'm trying to understand how darkening works in the CFF driver. So far, I have: cf2_computeDarkening()[1] is called twice per font face (CF2_Font =~ FT_Face?) upon initialization, once for vertical, once for horizontal stems, and calculates by how many pixels between 0 and 0.4 (default params) the font needs to grow in the X and Y direction. These "deltas"/2 are then used to shift points around when turning the individual points of a glyph into a path, but before passing the path on to the rest of the hinting machinery. Is that correct?

I still have to understand the actual calculations and "character space" stuff, etc. So the idea is, I outfit AF_ModuleRec_ with the no-stem-darkening and darkening-parameters attributes including getters and setters and use the same algorithm as cf2_computeDarkening() to come up with two FT_Pos that get used in FT_Outline_EmboldenXY() after each FT_Load_Glyph(). Correct?

Now to figure out how the autohinter is hooked up and invoked by font engines. I need to figure out where to best place the darkening calculations so they are done just once per face/size. And how to obtain stdVW/stdHW.

Mode `forced A' is strong auto-hinting, which hints horizontally also,
thus modifying the advance widths.  `forced B' (which is identical to
`B') is light auto-hinting that only hints along the vertical axis,
thus the advance widths are the same as if you render the font
unhinted.  `forced C' should have the same advance widths as `forced
A'.

Thanks for the explanation. Unfortunately, 'forced A' and 'forced C' have slightly different metrics for Ubuntu-R.ttf and
SourceSansPro-Regular.otf...

By the way, I find this mode stuff confusing. Shouldn't it be
1. native-grid-fitting, autohinter-unless-tricky, no-grid-fitting
2. hint-X-and-Y, hint-Y-only
3. subpixel-none, subpixel-RGB, ...
all as separate knobs with warnings if some combination doesn't work? That's what also bugs me about fontconfig's hintfull, hintslight, etc. I know, organic growth, but this always puts me in a cleaning-up mood ;)

Regards,
Nikolaus

[1]: It is slightly amusing that the CF2 stuff sometimes uses camelCasing while the rest of FT does_not.



reply via email to

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