googlefonts / googlefonts/glyphsLib
Crashes with TrueType-hinted Glyphs file
- Dominant language
- Python
- Stars
- 201
- Forks
- 56
- Avg merge
- 17m
- Merged PRs (30d)
- 1
Description
I get crashes on nearly all my TrueType-hinted Glyphs files when trying to build fonts with fontmake, or converting them to UFO.
The problem is somewhere in the parsing of the hints.
It seems the values of the TrueType hint properties `origin`, `other1`, `other2`, and `target` are parsed as `Point`s when in reality they are references to a node by contour index and node index, e.g. in this hint:
```
{
horizontal = 1;
options = 4;
origin = (1,3);
target = (1,0);
type = TTStem;
},
```
(this at least doesn't crash glyphs2ufo), or, more problematic, they reference a contour index, node index, and up to two other parameters, which are used when points not present in PostScript outlines are hinted, or points which appear only after removing overlaps. Example:
```
{
horizontal = 1;
options = 4;
origin = (0,3,1,0);
other1 = (0,3,0);
target = (0,3);
type = TTInterpolate;
},
```
Georg told me that a 2-tuple refers to a node (path index, node index), a 3-tuple refers to an inflection or handle, and a 4-tuple to an intersection. These can appear on all of `origin`, `other1`, `other2`, and `target`.
I've looked at the hint parsing code, but I can't in a reasonable amount of time figure out how to support all those notations.
I've attached a file that uses all kinds of TrueType hints and custom parameters that are available in G3.
[TrueTypeHintingV3.glyphs.zip](https://github.com/googlefonts/glyphsLib/files/9724959/TrueTypeHintingV3.glyphs.zip)
Contributor guide
Research direction
Start with the hint parsing code and the attached TrueTypeHintingV3.glyphs fixture, then reproduce the crash by building with fontmake or converting to UFO. Trace parsing of origin, other1, other2, and target and verify that 2-, 3-, and 4-tuples are handled without crashes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100