Quantize stem widths in bytecode.
commit7deb5c3854cef32d6afdf695680eac3734448bc0
authorWerner Lemberg <wl@gnu.org>
Sat, 2 Dec 2017 11:24:15 +0000 (2 12:24 +0100)
committerWerner Lemberg <wl@gnu.org>
Sat, 2 Dec 2017 11:24:15 +0000 (2 12:24 +0100)
treecda494a49923cbff39505c4744648cb7371ba6ab
parent8442f0b370cbce208a377794f0720f8e4938979e
Quantize stem widths in bytecode.

Contrary to `normal' TrueType bytecode, ttfautohint's generated code doesn't
use, say, scaled CVT values for stem widths.  Instead, it computes stem
widths on the fly by measuring point distances.  Due to rounding from font
units to pixels, however, identical distances in font units might slightly
differ if taken from scaled points.  In the worst case, rounding to integer
pixels then leads to two different stem widths, which is very ugly and
noticeable at small sizes.

This commit introduces an array of quantized stem widths in the storage
area; while computing a new width, the code compares it against already used
values (in function `bci_quantize_stem_width'), checks for a small
difference, and takes the old value instead if the difference is very small.
Otherwise, the new value gets added to the widths array.
lib/tabytecode.c
lib/tabytecode.h
lib/tafpgm.c