Where's the problem? The auto-hinter provides different standard
width values depending on the script. It tries up to three characters
(cf. the last three arguments to the `SCRIPT' macro in file
`afscript.h') in function `af_latin_metrics_init_widths' for finding a
standard width. As soon as we have found a glyph (the first hit
wins), all stems of the glyph are computed, which are then sorted and
quantized. The result of this process is stored in the `widths' array
of `AF_LatinAxisRec'; the smallest one is handled as the default
width. If no width could be determined, a default value of 50/2048 em
is used.
I don't understand this. Please elaborate.
Thanks for the explanation. The source code needs comments like that :)
In my first prototype, I tried to get a face-wide stdVW and modified
af_latin_metrics_init_widths to upload whatever is computed to
AF_FaceGlobals. Then I found that when displaying all glyphs in a font
with ftview, the first few glyphs don't produce anything (spoiler:
af_cjk_metrics_init_widths was here, maybe because #define
AF_STYLE_FALLBACK AF_STYLE_HANI_DFLT), and later runs produced different
standard_widths (for different scripts). My hack was to look at each run
of init_width and take the biggest value that any of it produces, and,
depending on the font, recompute the darkening amount multiple times per
size (each time a bigger standard_width came along). That was quite ugly
and probably buggy.
So by "in a controlled way", I mean run all script analyzers from
af_face_globals_get_standard_widths() upon metrics initialization and do
something meaningful with the produced standard_widths, ONCE PER SIZE
before anything else is done.
Hm, I just had the idea to extend the writing system class with a
AF_WritingSystem_GetStdWidthsFunc. Will experiment later.
And "hard-to-follow" was a general comment. I find the excessive
preprocessor use in FT difficult to follow and it took me a while to
understand how the different parts of the autohinter click together and
what is done in what order...
Direct access is not possible except with ugly hacks.
Alright. My idea was to listen to what the private dict of a font said
before computing it the hard way. So, only Postscript fonts get listened
to now ;)
_______________________________________________
Freetype-devel mailing list
Freetype-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/freetype-devel