296 Commits

Author SHA1 Message Date
Cosimo Lupo
5b3176f4fd add test for parsing and compiling DeviceTable's DeltaValue 2025-02-04 10:37:27 +00:00
Andrew Suzuki
68dbfba5c4 Ensure names attr exists on table__n_a_m_e 2024-12-22 10:44:06 -05:00
Behdad Esfahbod
e8146a6d07 [glyf] Add optimizeSize option
Set to True by default. Can be turned to False on the table,
or at Glyph() compile time.

Also fixes Glyph's draw() to expand the glyph first. Otherwise
it was failing.
2024-10-11 08:31:31 -06:00
Behdad Esfahbod
0213bea88e [TupleVariation] Option to optimize for loading speed, not size 2024-10-06 18:11:48 -06:00
Behdad Esfahbod
74f870f4ef [varc] Add ConditionSets 2024-05-22 18:46:07 -06:00
Behdad Esfahbod
f24808c58c Black 2024-05-22 18:46:06 -06:00
Behdad Esfahbod
ebd877bbcb [VARC/test] Start adding 2024-05-22 18:46:06 -06:00
Behdad Esfahbod
3ff2ee61e1 Move lazy datastructures to misc.lazyTools 2024-05-22 18:45:28 -06:00
Behdad Esfahbod
c952237ed3 [otConverters] Make _LazyList generic 2024-05-22 18:45:27 -06:00
David Corbett
0738c41dfb [psCharStrings] Shorten output of encodeFloat 2024-05-10 18:47:23 -07:00
Behdad Esfahbod
d590feba99 [avar] Add test for ttGlyphSet support 2024-04-02 11:42:42 -06:00
Cosimo Lupo
f518e5a704
[OS/2] don't error getting/setting codepages if version=0
return empty set, or set the bits and bump the version to match
2023-11-15 12:21:02 +00:00
Cosimo Lupo
aaed718e41
[glyf_test] Test that composite referencing empty glyph also gets zero bounds
Add reproducer for possible regression in Glyph.recalcBounds introduced with https://github.com/fonttools/fonttools/pull/3301
2023-11-14 16:30:26 +00:00
Khaled Hosny
be8ec35934 [OS/2] Add recalcCodePageRanges
Ported from the ufo2ft code (which is port from FontForge code), with
some additional functions for parity with recalcUnicodeRanges.
2023-11-11 01:54:00 +02:00
Cosimo Lupo
335a1e56ec re-run black v23.10 on all .py files 2023-11-03 10:25:15 +00:00
Behdad Esfahbod
27932c525b [glyf] Add tests for getGlyphID() 2023-10-16 13:14:01 -04:00
Khaled Hosny
ae31d05605 [ttLib] Fix warning when calling addMultilingualName() with "ar" name
I get warning from _makeMacName() because it does not have a TTFont, but
the font is there, just not passed from addMultilingualName() ->
findMultilingualName() -> _makeMacName().
2023-08-13 14:21:32 +03:00
Cosimo Lupo
d2fd4dfb24
C_O_L_R_test: add test for paint pointed to by both 3- and 4-byte offsets 2023-08-04 11:45:20 +01:00
Behdad Esfahbod
4ae0a93692 black
I'm sorry.
2023-06-27 08:49:31 -06:00
Behdad Esfahbod
9983ffe27a [cubic-glyf] Fix tests
Ouch.
2023-06-27 08:47:56 -06:00
Cosimo Lupo
4298c28e3c
add 2nd test contour to expose bug in dropImpliedOnCurvePoints
there's a bug whereby we don't correctly drop impliable oncurve if it occurs on the first point of the second contour.. because we forgot to update the contour start = last + 1...
2023-06-06 17:00:16 +01:00
Cosimo Lupo
5b93100616
also check endPtsOfContours in dropImpliedOnCurvePoints
as per review https://github.com/fonttools/fonttools/pull/3147#discussion_r1214708207

Also, don't do same work multiple times when dropping points from flags/endPtsOfContours arrays since these are supposed to be the same for all interpolatable glyphs
2023-06-05 12:11:17 +01:00
Cosimo Lupo
6a276d9f6a
dropImpliedOnCurvePoints: raise if incompatible, skip empty/composites 2023-06-02 13:51:28 +01:00
Cosimo Lupo
a039e1dda8
_g_l_y_f_test: add tests for dropImpliedOnCurvePoints 2023-06-01 19:27:32 +01:00
Behdad Esfahbod
a99e130b26 [Tests] Silence a few deprecation warnings 2023-05-24 14:38:41 -06:00
Jens Kutilek
85c80be6b6
Fix missing composite instructions in ttx (#3092)
* Fix calculation of haveInstructions
* Add test
2023-04-25 16:21:24 +02:00
Behdad Esfahbod
05872d6878
Merge pull request #2679 from fonttools/avar2
Avar2
2023-03-15 11:56:30 -06:00
Behdad Esfahbod
2edbbc1b32 [avar2] Test xml for equality 2023-03-15 11:46:57 -06:00
Behdad Esfahbod
b009e63733 [avar2] Use fl2fi in test 2023-03-15 11:40:24 -06:00
Behdad Esfahbod
1deed38b8d [avar2] Add compile test 2023-03-14 14:09:32 -06:00
Jens Kutilek
f1a75bacb2
Handle string input to Program.fromAssembly() (#3038)
* Add tests for fromAssembly() output (#3036)
* Handle string input to fromAssembly() (Fixes #3036)
* Fixups suggested by @anthrotype
* Add some more typing annotations
* Program.assembly always returns List[str] now
* Add annotation for bytecode
* Move code from setter to fromAssembly
* Remove property
* Fix attribute names
2023-03-14 14:51:16 +01:00
Cosimo Lupo
c5e464ad8f
C_O_L_R_test: add tests for computeClipBoxes
using a subset from test_glyphs font from the googlefonts/color-fonts repository
2023-03-10 15:23:30 +00:00
Behdad Esfahbod
43b16df8db [avar] Update test expectations 2023-03-08 11:10:07 -07:00
Behdad Esfahbod
2b5686205e [avar] Support previous API in compile/decompile
Using the otData mechanism with handcoded shim.
2023-03-08 09:29:58 -07:00
Johannes Neumeier
f52b3da721 Make NameRecord comparison not fail on encoding errors #3006 2023-02-24 15:58:53 +02:00
Behdad Esfahbod
568dd0c5d4 [glyf] Support and test cubic spline 2023-02-21 13:01:49 -07:00
Behdad Esfahbod
9df8e6dd64 Add missing test file 2023-02-21 13:01:49 -07:00
Behdad Esfahbod
0a0b152c33 [glyf] Support, and add test for, all-offcurve cubic contour 2023-02-21 13:01:49 -07:00
Behdad Esfahbod
77e96bdcd9 [glyf_test] Add cubic test 2023-02-21 13:01:49 -07:00
Behdad Esfahbod
b7deb93647 Move VarComposite roundtrip tests to glyf_test 2023-02-06 11:09:11 -07:00
Behdad Esfahbod
4c201b9a42 [glyf/VarComposite] Implement padding trimming 2023-02-06 11:00:05 -07:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Cosimo Lupo
36de9df3cc [gvar] be non lazy for TTFont.lazy=False, add ensureDecompiled
like cmap, or glyf or OTL tables, we need to respect lazy=False flag and decompile everything upfront, also we want to add an ensureDecompiled method (called by TTFont.ensureDecompiled) to allow loading everything in one go even when a font had been opened lazily.
2022-08-31 11:10:50 +01:00
Cosimo Lupo
1dffbae240 support proposed PaintSweepGradient's angles with +1.0 (180°) bias
In the upcoming draft of COLR spec, PaintSweepGradient's startAngle/endAngle are encoded with a +1.0 bias to allow for representation of a full +360° positive angle. Normal F2Dot14-fraction-of-half-circle angles can only represent angles between -360 <= angle < +360

This is a breaking change and will need to be coordinated with rendering implementations (at least FreeType/Skia).
2022-08-15 12:52:28 +02:00
Cosimo Lupo
676a66fad3 otTables: make DeltaSetIndexMap TTX dump less verbose by omitting no-op entries
though we still emit the empty <Map index=.../> elements; they help identify chunks of delta-set indices, and define the length of the array upon loading from XML
2022-06-21 17:27:11 +01:00
Cosimo Lupo
119b7732cc SVG: strip timestamp to make compressed gzip reproducible
we tell GzipFile to write the MTIME field to zero so that the compressed output is reproducible and doesn't change depending on when the data is compressed.
2022-06-09 16:29:29 +01:00
Cosimo Lupo
8673073a87 S_V_G__test: test compiling/decompiling compressed doc 2022-06-09 15:27:57 +01:00
Olli Meier
61ad06fc3a rename unittest with better name + get rid of redundant code 2022-02-11 17:51:52 +01:00
Olli Meier
1d51bc2b8e Changes as requested by Just. 2022-02-11 15:55:25 +01:00
Olli Meier
68fa3bbd47 Cleaning code based on feedback from Just 2022-02-10 22:13:58 +01:00