When dumping the Macintosh Skia font to XML, the TTX tool crashed
with a Python exception. After this change, the font can be dumped
fine. This was caused by a name record with platformID=1 (Macintosh)
and platEncID=2 (Traditional Chinese).
The Python libraries come with two ways of writing unittests:
module unittest, and module doctest. In some cases, unittest
is more natural (less cumbersome) than doctest.
Wrote tests on xmlWriter for illustration.
https://github.com/behdad/fonttools/issues/54
There's a new attribute named unicode that can choose whether the
text in the XML entry is to be interpretted as Unicode, or as the
target encoding.
If a contextual lookup recurses twice on the same index, that index
most be marked chaotic for the second recursion.
Also, when a non-1-to-1 recursion happens, only mark glyph locations
after current to be chaotic, not everything.
I believe this fixes a bug that before we were not inclusive enough.
Now we might have introduced more false positives, but we are at least
correct.
Improves NotoNastaliqDraft closure_glyphs() time from 60s to 50s.
This was originally introduced in 1d4fa13b4. I'm fairly confident
new code is correct.
Dynamic-Programming-based algorithm. Previously we had a greedy
algorithm only.
Unfortunately the savings are truly negligible. In the order of ~20
bytes for each of the Roboto faces, less so for Noto fonts. Even on
a 20MB font, it produced less than 100 bytes saving compared to our
greedy packing. Either I made a huge mistake, or this is so not worth
it. Anyway, the code is there, but disabled.
Apparently these days these tables are used to encode symbols in
PUA, so they are still Unicode-compatible...
This follows a similar change in fontconfig.
Set font['SVG '].compressed=True to enable. Here's a snippet to convert a
WOFF-compressed SVG+OpenType font to a compressed SVG+OpenType non-WOFF font:
from fontTools.ttLib import TTFont
font = TTFont("NotoColorEmojiSvg.woff")
font['SVG '].compressed=True
font.flavor=None
font.save("NotoColorEmojiSvgCompressed.ttf")