|
From: | Craig White |
Subject: | Re: Progress update on adjustment database |
Date: | Thu, 20 Jul 2023 12:32:54 -0400 |
> The next thing I'm doing for the adjustment database is making
> combining characters work. Currently, only precomposed characters
> will be adjusted. If my understanding is correct, this would mean
> finding any lookups that map a character + combining character onto
> a glyph, then apply the appropriate adjustments to that glyph.
Yes. I suggest that you use the `ttx` decompiler from fonttools and
analyse the contents of a GSUB table of your favourite font.
https://pypi.org/project/fonttools/
At the same time, use the `ftview` FreeType demo program with an
appropriate `FT2_DEBUG` setting so that you can see what the current
HarfBuzz code does for the given font. Examples:
```
ttx -t GSUB arial.ttf
FT2_DEBUG="afshaper:7 afglobal:7 -v" \
ftview -l 2 -kq arial.ttf &> arial.log
```
Option `-l 2` selects 'light' hinting (i.e., auto-hinting), `-kq`
emulates the 'q' keypress (i.e., quitting immediately). See appended
files for `arial.ttf` version 7.00.
In `arial.log`, the information coming from the 'afshaper' component
tells you the affected GSUB lookups; this helps poking around in the
XML data as produced by `ttx`. The 'afglobal' information tells you
the glyph indices covering a given script and feature (start with
'latn_dflt').
You might also try a font editor of your choice (for example,
FontForge, menu entry 'View->Show ATT') to further analyze how the
GSUB data is constructed, and to get some visual feeling on what's
going on.
> Right now, I'm trying to figure out what features I need to look
> inside to find these lookups. Should I just search all features?
Yes, I think so. Since the auto-hinter is agnostic to the script and
the used language, you have to have all information in advance.
> After that, I'm going to tackle the tilde-flattening issue, and any
> other similar marks that are getting flattened.
Note that in most fonts you won't find any GSUB data for common
combinations like 'a' + 'acute' -> 'aacute'. Usually, such stuff gets
handled by the GPOS table, i.e., instead of mapping two glyphs to a
another single one, the accent gets moved to a better position. In
this case, the glyphs are rendered separately, *outside of FreeType's
scope*. This means that we can't do anything on the auto-hinter side
to optimize the distance between the base and the accent glyph (see
also the comment in file `afshaper.c` starting at line 308, and this
nice article
https://learn.microsoft.com/en-us/typography/develop/processing-part1).
It thus probably makes sense to do the tilde stuff first.
Werner
[Prev in Thread] | Current Thread | [Next in Thread] |