Multi-weight TTF of font "Cascadia Code" renders artifacts on some glyphs
Migrated from: [SAVANNAH-59026]
Ronan Jouchet reported:
This is a followup of Cascadia Code bug "[linux + VariableTTF-specific]
Some glyphs (e.g. a '4', or the bottom-right stem of lowercase 'u') look
weird at certain sizes, maybe due to mis-handling overlapping paths of
variable font", [FONTBUG]
Font "Cascadia Code" (zip artifact available at [FONTZIP]) ships:
1. `ttf/CascadiaCode.ttf`, a multi-weight TTF bundle
2. `ttf/static/CascadiaCode-{Regular,Bold,...}.ttf`, individual TTF fonts
3. `otf/static/CascadiaCode-{Regular,Bold,...}.otf`, individual OTF fonts
Fonts 2. and 3. (individual OTF/TTF fonts) do display fine on my machine,
but the font bundle 1. (packaging all the weights in a single .ttf file)
render with artifacts. A particularly noticeable one is a protrusion on the
inner-right side of the bottom curve of a `u`, but it isn't the only one.
Screenshots:
1. ftview of the multi-font bundle showing glitches:
`ftview -d 1024x768x24 30 CascadiaCode-2008.25/ttf/CascadiaCode.ttf`
2. ftview of the `-Regular` single font showing no glitches:
`ftview -d 1024x768x24 30 CascadiaCode-2008.25/ttf/static/CascadiaCode-Regular.ttf`
3. A looping GIF animating between 1. and 2.
4. A close-up on a few problematic letters.
Discussing with one of the font maintainers at [FONTBUG], they say they cannot
reproduce the problem under Windows/macOS, and suspect a FreeType bug, saying:
> "It is probably an issue with FreeType's method of dealing with variable fonts,
> or fonts that have overlapping paths within one glyph (normally these overlaps
> are removed, but for variable fonts it is useful to preserve them)."
, or maybe something is wrong in their font build, and only noticeable in FT?
Bug confirmed on:
- FreeType 2.10.1-2 (from the official Ubuntu 20.04.1 package, [PKG/UBUNTU])
- FreeType 2.10.2-1 stable (from the official Arch package, [PKG/ARCH])
- FreeType 2.10.2+p53+g6730854c (from AUR package freetype2-git, [PKG/AUR])
Any idea of what's wrong?
Thanks for FreeType and sorry if this is a dupe, I did my best to search
for existing bugs but am not familiar with font terminology.
[FONTBUG] https://github.com/microsoft/cascadia-code/issues/350
[FONTZIP] https://github.com/microsoft/cascadia-code/releases/download/v2008.25/CascadiaCode-2008.25.zip
[PKG/UBUNTU] https://packages.ubuntu.com/focal/freetype2-demos
[PKG/ARCH] https://www.archlinux.org/packages/extra/x86_64/freetype2/
[PKG/AUR] https://aur.archlinux.org/packages/freetype2-git/