13 Commits

Author SHA1 Message Date
Cosimo Lupo
b6467b7e85
ttGlyphPen: quantize component.transform to F2Dot14 to fix issue with bbox
Fixes https://github.com/googlefonts/fontmake/issues/558

When drawing a composite glyph with a scaled component using the TTGlyphPen, the bounding
box coordinates may change depending on whether one computes them *before* compiling or
*after* decompiling. Before compiling, component.transform holds double precision floats,
but after compiling and decompiling, these are necessarily clamped to F2Dot14 fixed precision.

The TTGlyphPen needs to quantize transform floats to F2Dot14 so that the values don't
change after compilation.

Without this change, it may happen that round-tripping fonts through ttx (which by default
recalcBBoxes) will produce different bounding boxes for composite glyphs that have
scaled or transformed components.
2020-02-13 13:49:01 +00:00
Cosimo Lupo
7fe59e4b94
ttGlyphPen_test: test computing bounds with float coordinates and offsets
https://github.com/googlefonts/fontmake/issues/593

This test currently fails. The compositeGlyph.xMax is set to 281, but it should be 282.
2019-11-26 16:03:18 +00:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
ae69133924
ttGlyphPen: gracefully handle missing components while decomposing 2018-06-11 18:40:11 +01:00
Cosimo Lupo
4173315f09
[ttGlyphPen] rename option to 'handleOverflowingTransforms' 2018-03-01 20:17:48 +00:00
Cosimo Lupo
6ce8eec89c
[ttGlyphPen_test] add test for decomposeOverflowingTransform=False 2018-03-01 20:10:32 +00:00
Cosimo Lupo
08c663f798
[ttGlyphPen_test] remove OverflowError test 2018-03-01 19:59:49 +00:00
Cosimo Lupo
4771e7cd6c
[ttGlyphPen_test] add test for OverflowError 2018-03-01 19:41:40 +00:00
Cosimo Lupo
ede35d72c8
[ttGlyphPen_test] test decomposed contours keep original order 2018-03-01 18:52:55 +00:00
Cosimo Lupo
778d4933da
[ttGlyphPen_test] check ambiguous out-of-range case
that has both a value that exceeds the bounds, and one that's almost 2;
the former case should take precedence and the componed be decomposed
2018-03-01 18:01:01 +00:00
Denis Moyogo Jacquerye
85e363c216
Add TTGlyphPen test for scale limits 2018-03-01 17:48:49 +00:00
Cosimo Lupo
3cdc800873
[Tests] rename all 'testdata' folders to simply 'data'
as it's now obvious what kind of data they are
2017-01-17 13:33:46 +00:00
Cosimo Lupo
78ad48eaf3
Move all *_test.py modules and test data to external Tests/ folder 2017-01-16 09:14:12 +00:00