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.
Otherwise don't add padding. This is against the spec, but "should"
work everywhere. The spec only says offsets "should" be padded:
"""Note that the local offsets should be long-aligned, i.e., multiples
of 4. Offsets which are not long-aligned may seriously degrade
performance of some processors."""
We don't add any padded that we absolutely don't have to. Should save
an average of one byte per glyph on large fonts.
When I added the font.lazy setting, I made glyf table non-lazy
by default. This is helpful to users who typically access glyphs
like:
glyf_table.glyphs[glyfname]
instead of the correct way:
glyf_table[glyfname]
and also forget to call expand() on the glyph. However, this
significantly slows down most scripts that load the font without
lazy=True... As such, add a third mode to laziness. By default
lazy=None and does NOT expand glyphs. If lazy=False is passed
in, all glyphs are loaded.
I hope this is an acceptable middle ground and not too confusing.
This has been broken since f2c2b4d38bd7bba23db71936262db984e4b7aebb,
assigning a new object to a function argument will not change the
original one, so we need to return the modified list.
Extend GlyphCoordinates to transparently support float coordinates.
As a result, transformed glyph components now don't have their
coordinates rounded anymore. This slightly changes bounding box
calculations.
There's also code added, but disabled, to calculate exact glyph
bounding box, but we don't seem to actually want that.