53 Commits

Author SHA1 Message Date
Cosimo Lupo
c8f591ea8a
subset: remove FeatureVariations table and downgrade to version 0x10000 when empty
https://github.com/fonttools/fonttools/issues/1881#issuecomment-620719882
2020-04-28 18:34:15 +01:00
Cosimo Lupo
ec6205199e
subset_test: add test for dropping 'rvrn' feature and all FeatureVariationRecords
Added a TODO for the partial dropping of FeatureVariationRecords
https://github.com/fonttools/fonttools/issues/1881#issuecomment-619415044
2020-04-25 18:40:19 +01:00
Cosimo Lupo
cf0567d8a5
subset_test: test subsetting font to empty glyf table 2020-02-12 14:25:25 +00:00
Cosimo Lupo
a32fd30c2d
subset_test: add test for optimizing SinglePos format when all subsetted values are same 2020-01-16 18:30:07 -08:00
Cosimo Lupo
9c0c3a1375
subset_test: Add (failing) test to repro #1777
the 'rvrn' feature is being incorrectly dropped because the feature indexes
change if some other feature occuring before 'rvrn' is dropped, like
in this test case.
2019-12-12 12:29:08 +00:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Khaled Hosny
4db8cb237f [subset] Support sbix table
Test font is a subset of:
https://github.com/djrrb/Bungee/blob/master/fonts/Bungee_Color_Fonts/BungeeColor-Regular_sbix_MacOS.ttf
2019-08-01 01:52:38 +02:00
Cosimo Lupo
33fa149c31
subset: Add tests for --flavor option 2019-06-19 11:32:34 +01:00
Khaled Hosny
a56b1af2f6 [subset] Gracefully handle partial MATH table (#1635)
Both MathGlyphInfo and MathVariants can be None, so check for that first
before trying to access their methods.
2019-06-08 17:59:53 -07:00
Khaled Hosny
2861d65e56 [subset] Update font extents in head table
When --recalc-bounds option is used the font extents in the head table
need to be updated, but since tables are lazy-loaded by default the
table will not be recompiled and will keep the old value. Force
recompiling the table by adding it to prune_post_subset tables, though
I’m not 100% sure this is the best approach.
2019-05-17 21:10:11 +02:00
Garret Rieger
dce15980fd Make --retain-gids truncate empty glyphs after the last non-empty glyph. 2019-05-16 10:13:33 -07:00
Cosimo Lupo
96c81ebd8a
Merge pull request #1598 from fonttools/update-OTF-testfonts
Convert OTF font files in test data to ttx files.
2019-05-13 13:09:37 +01:00
Khaled Hosny
b1999a1a0e Add test for previous commit 2019-05-03 01:14:09 +02:00
ReadRoberts
77f72bc62b Convert OTF font files in test data to ttx files.
This required a fix to fontTools/cffLib. When reading a CFF2 variable font (VF) from XML, the VF state in FontDict and PrivateDict does not get set. I made a temporary fix by adding a loop to set PrivateDict.vstore for all the PrivateDict objects after the XML file has been read. This should not be necessary, and in the near future I will revisit both this issue, and the related use of isCFF2 when compiling/decompiling.
2019-05-01 16:01:43 -07:00
Miguel Sousa
9cbfef1972
Merge pull request #1588 from fonttools/hvar-vvar-retain-gids
[subset] HVAR/VVAR with --retain-gids
2019-04-26 06:55:17 -07:00
Miguel Sousa
45596108e2 (Re)calculate OS/2.usMaxContext value
The value is only modified in the context of fontBuilder or subset. It will NOT be modified when using ttx.

maxContextCalc.py was copied from https://github.com/googlefonts/ufo2ft/blob/master/Lib/ufo2ft/maxContextCalc.py

Fixes #1191
Fixes #466
2019-04-24 18:31:12 -07:00
Michiharu Ariza
00dddb1c32 fixed non retain-gids with no AdvWidthMap behavior
deltas in VarData[0] are directly look up by GID so compacted
if any deltas are referenced by LsbMap / RsbMap but not used for advance widths, they are moved to the end of VarData[0]

updated expected test result expect_HVVAR.ttx accordingly
2019-04-24 16:46:21 -07:00
Michiharu Ariza
f028c75d2a issue #1587: AdvWidthMap null with Lsb/RsbMaps non-null
along with tests
2019-04-23 17:03:04 -07:00
justvanrossum
e22453c933 followup to #1531 2019-03-06 16:47:16 +01:00
Read Roberts
7ae6ca8106 [subset CFF] Fix de-subroutinizing bug when subroutines contain hints (#1499)
* [subset CFF] Fix bug in de-subroutinizing when subroutines contain hints, issue 1493

The  code was skipping executing a subroutine if it had already been desubroutinized. The initial set of vstemhm and hstemhm operators and values may be in a subroutine. If a charstring is being executed which calls such subroutines, they still need to be executed in order to count the number of hint values seen, so that the byte length of the hintmask can be calculated.

I fixed this bug by executing subroutines even if they have already been desubroutinized, as long  as  (we don't know yet if we are doing hintmasks) or ( we do need a hintmask, but have not yet seen it).

Clean up code per Cosimo's suggestions:

In arg list for stop_hint_count(), use *args to accept unused argument, rather than a dummy positional argument.

Change stop_hintcount_ops to a from a global variable to a class variable  in _DesubroutinizingT2Decompiler.

Remove un-needed 'return' at line 387

Remove duplicate assignment of cs at line 437

Add patch for the bug where AttributeError is encountered when remove_hints is run after desubroutinize: remove lines deleting the GlobalSubrs for each FontDict. This always needed to be done only once, and is now in any case done in cff.GlobalSubrs.clear(), at the end of the desubroutinize() function.

Changed test case subset_test.py::'test_no_hinting_desubroutinize_CFF' to reference a font with a non-empty GlobalSubr, in order to trigger AttributeError traceback.
2019-02-18 09:43:27 +00:00
Cosimo Lupo
1cde186172
subset_test: add test for --retain-gids and CFF2 table 2019-01-16 16:02:07 +00:00
Cosimo Lupo
336abfcaf0
[subset] set charstring's effective width to 0 when --retain-gids
seems to be the consensus, despite this may add a few bytes when
the emptied glyph's width is different from PrivateDict.defaultWidthX
2019-01-15 15:24:26 +00:00
Cosimo Lupo
af1a0d1fe5
[subset] set emptied CFF charstrings to 'endchar' with --retain-gids
Part of #1446
2019-01-15 14:07:54 +00:00
Cosimo Lupo
71dbe2daea
subset_test: add test for --retain-gids option 2019-01-15 11:31:28 +00:00
Cosimo Lupo
38566f3a30
subset_test: minor 2018-07-24 12:17:59 +01:00
Cosimo Lupo
18bd9603a9
[Tests] fixup for new subset default --name-IDs
25d3822275c04169ba380393b1d41c7605c61d58
2018-02-16 18:11:59 +00:00
Miguel Sousa
5eebad29df [subset_test] Include nameIDs 3, 4, 6 in results 2018-02-11 18:00:34 -08:00
Cosimo Lupo
bbcb3776ac [Tests/subset] adjust expected test results 2017-11-27 19:37:56 +00:00
Sascha Brawer
898f6911f8 [AAT] Implement subsetting of anchor points table 2017-08-31 12:49:55 +02:00
Sascha Brawer
307d0d4c57 [AAT] Implement subsetting of baseline table 2017-08-26 09:53:04 +02:00
Sascha Brawer
16a4001901 [AAT] Implement subsetting of lcar ligature carets table 2017-08-25 07:35:13 -07:00
Sascha Brawer
84b0cacf95 [AAT] Implement subsetting of opbd Optical Bounds table 2017-08-22 14:36:05 -07:00
Sascha Brawer
28b179a018 [AAT] Implement subsetting of prop table with AAT glyph properties 2017-08-22 08:06:59 -07:00
Denis Moyogo Jacquerye
6d07d48846 Upate CFF tests for default for UnderlinePosition
Missing UnderlinePosition added in a72f26e5
2017-06-09 07:03:54 +01:00
Sascha Brawer
017fa4e9c6 [fvar] Expose flags in XML
Fixes https://github.com/fonttools/fonttools/issues/932.
2017-05-02 00:51:44 +08:00
Miguel Sousa
306882a00a [tests] Change hhea and vhea table version from float to hex to mute fontTools warnings 2017-02-28 16:35:13 -08:00
justvanrossum
c5aa43238f Make sure to load the 'head' table when recalculating the time stamp. Fixes #847. 2017-02-21 13:45:50 +01:00
Cosimo Lupo
34fec90630
[subset_test] verify that --recal-timestamp actually works
Closes #847
2017-02-19 20:12:22 -08:00
Masaya Nakamura
7ac8c32274 [Tests/subset] Add a test case for .notdef glyph width (#845) 2017-02-16 13:58:49 +09:00
Cosimo Lupo
f7a5d83cbb
[Tests/subset] make the test pass: we can now drop empty subroutines! 2017-02-15 01:19:12 -08:00
Cosimo Lupo
489db26da9
[Tests/subset] we still don't remove empty subroutines; adjust test data 2017-02-15 00:42:45 -08:00
Cosimo Lupo
1ec6d30aa9
[Tests/subset] add failing test case: we still drop drawing instructions before the first hintmask... 2017-02-15 00:22:49 -08:00
Cosimo Lupo
aca7dd7db3
[subset] we don't remove empty subroutines (yet) 2017-02-15 00:17:50 -08:00
Cosimo Lupo
3a8f976cfe
[subset_test] add two test cases for subr starting with hintmask, one acting as implied vstem, the other occurring after path drawing operations 2017-02-14 23:00:17 -08:00
Cosimo Lupo
c234e3606c
[data/expect_no_hinting_TTF.ttx] adjust data using empty instructions elements 2017-01-25 15:35:16 +00:00
Cosimo Lupo
99303de5c5
[subset_test] add tests for desubroutinize and no-hinting options using Lobster subset
The following test cases are expected to fail because the current implementation of drop_hints
also strips the charstrings' advance widths:

Tests/subset/subset_test.py::SubsetTest::test_no_hinting_CFF
Tests/subset/subset_test.py::SubsetTest::test_no_hinting_desubroutinize_CFF
2017-01-25 15:31:54 +00:00
Cosimo Lupo
385c6d8f4f
[data/expect_keep_colr.ttx] adjust empty instructions elements in test data 2017-01-24 18:34:55 +00:00
Cosimo Lupo
e8527bcb48
[data/TestCLR-Regular.ttx] revert unnecessary changes from 337dd1d 2017-01-24 16:39:02 +00:00
Cosimo Lupo
7e1f56a645
[data/expect_keep_colr.ttx] adjust expected data in SubsetTest.test_subset_clr 2017-01-24 14:35:55 +00:00
Jens Kutilek
337dd1d94a Fix tests for indentation changes 2017-01-24 13:20:27 +01:00