97 Commits

Author SHA1 Message Date
rsheeter
991e7914e3 Lets not add inconsistent names? 2024-11-13 16:17:56 -08:00
Nathan Williis
23e3ab60f8 Docs: fix code-example blocks in varLib. 2024-09-03 17:53:56 +01:00
Behdad Esfahbod
a1641d91b2 Newer black 2024-05-22 18:46:07 -06:00
Behdad Esfahbod
bcd5e4c216 Rip out glyf1 VarComposites
In favor of separate VARC table.

ttGlyphSet does NOT yet know how to draw VARC table though.

The 9 failing tests are all VarComposite-related and need
to be updated with VARC equivalents eventually when we
add VARC support to subsetter and instancer.
2024-05-22 18:45:27 -06:00
Khaled Hosny
cf08265cd5 Black 2024-02-06 15:47:35 +02:00
Behdad Esfahbod
0d24114ad0 [varLib/VarComposite] Plug in in a couple places 2023-01-30 11:26:20 -07:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Behdad Esfahbod
9369edb6a9 [mutator] Remove DSIG table if present
Fixes https://github.com/fonttools/fonttools/issues/1480
2022-10-26 14:48:32 -06:00
Guillaume Ayoub
fd0e81ad13 Avoid negative hmtx values when creating font from variable font
Fix #2821.
2022-09-20 16:27:54 +02:00
Cosimo Lupo
7b3a8d3d2c [mutator] rename --no-recalc-timestamp, like in pyftsusbet; simplify option parsing 2022-06-14 15:11:47 +01:00
Garret Rieger
b2c00d7883 Add flag to mutator to allow recalc timestamp to be disabled. 2022-06-13 22:03:32 +00:00
Khaled Hosny
a1c6c184ef [mutator] Round lsb for CFF2 fonts as well
Otherwise head table compilation would fail because of the floating
point side bearing. The advance width is already rounded.
2021-05-03 00:06:46 +02:00
Behdad Esfahbod
a756bb01ab [glyf] Prefix setCoordinates, getCoordinatesAndControls, getPhantomPoints
Will add old name with old API next.
2021-04-14 14:09:40 -06:00
Behdad Esfahbod
6aa9d192b6 [varLib] Use TTFont.get() in a couple of places 2021-04-14 13:50:00 -06:00
Behdad Esfahbod
34b5ff623c [varLib] Optimize getPhantomPoints()
To reduce calling TTFont.__getitem__ many times per glyph!
2021-04-13 13:49:12 -06:00
Behdad Esfahbod
062b7c434e
Merge pull request #2214 from fonttools/varLib-round
[varLib] Move rounding to VariationModel, to avoid error accumulation from multiple deltas
2021-03-04 16:40:40 -07:00
Behdad Esfahbod
abc1ba07a4 [misc.roundTools] New module; move otRound() here
Code relying on old place (fixedTools.otRound) still works.
2021-03-04 09:20:43 -07:00
Cosimo Lupo
53b13263e9
Merge remote-tracking branch 'origin/main' into mutator-trivial-fixes 2021-03-04 10:49:49 +00:00
Behdad Esfahbod
a93ced044f [varLib.mutator] Simplify maxp handling 2021-02-28 18:19:24 -07:00
Behdad Esfahbod
23e5d4eb0b [varLib.mutator] Fix typo: maxInstructionDefs -> maxStackElements 2021-02-28 18:16:23 -07:00
Cosimo Lupo
0957dc7ab3
mutator: fix missing tab in interpolate_cff2_metrics
Originally reported in https://twitter.com/ken_lunde/status/1335987620002709507?s=20
2020-12-07 17:16:21 +00:00
Cosimo Lupo
e78d7cf50a
backport fix to varLib.mutator as well 2020-10-05 18:17:14 +01:00
Simon Cozens
2cef07af80
[doc] Add help options to fonttools CLI (#1920)
This adds a `help` verb (and `--help` option) to the `fonttools` command line tool. Submodules will be listed in the help text if they have an importable `main` function with a docstring, and `main`'s docstring will be used as the one-line description for the help text.
2020-05-12 06:31:13 +01:00
Nikolaus Waxweiler
68a5ceac6d varLib: Remove py23 imports 2019-08-10 15:39:02 +01:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
65b0609be1
remove redundant table__g_l_y_f.getCoordinates method
just use getCoordinatesAndControls
2019-06-14 11:17:37 +01:00
Cosimo Lupo
f74e82fec5
Merge remote-tracking branch 'origin/master' into partial-instancer 2019-04-29 12:47:37 +02:00
Read Roberts
5b3db36670
Sparse cff2vf support (#1591)
* Added getter (in the form of a property decorator) for T2Charstring.vsindex. Fixes endless compile loop in some circumstances.

Fixed bug in mutator: need to remove vsindex from snapshotted charstrings, plus formatting clean up

* Fix for subsetting HVAR tables that have an AdvanceWidthMap when the --retain-gid option is used. Needed to make subset_test.py::test_retain_gids_cff2 tests pass.

* in varLib/cffLib.py, add support for sparse sources, and sources with more than one model, and hence more than one VarData element in the VarStore.

CFF2 source fonts with multiple FontDicts in the FDArray need some extra work. With sparse fonts, some of the source fonts may have a fewer FontDicts than the default font. The getfd_map function() builds a map from the FontDict indices in the default font to those in each region font. This is needed when building up the blend value lists in the master font FontDict PrivateDicts, in order to fetch PrivateDict values from the correct FontDict in each region font.

In specializer.py, add support for CFF2 CharStrings with blend operators. 1) In generalizeCommands, convert a blend op to a list of args that are blend lists for the following regular operator. A blend list as a default font value, followed by the delta tuple. 2) In specializeCommands(), convert these back to blend ops, combining as many successive blend lists as allowed by the stack limit.

Add test case for sparse CFF2 sources.
The test font has 55 glyphs. 2 glyphs use only 2 sources (weight = 0 and 100). The rest use 4 source fonts: the two end points of the weight axis, and two intermediate masters. The intermediate masters are only 1 design space unit apart, and are used to change glyph design at the point in design space. For the rest, at most 2 glyphs use the same set of source fonts. There are 12 source fonts.

Add test case for specializer programToCommands() and commandsToProgram by converting each CharString.program in the font to a command list, and back again, and comparing original and final versions.
2019-04-26 09:33:52 -07:00
Cosimo Lupo
4db603be96
varLib.merger: have MutatorMerger use pre-computed deltas and optionally keep VarIdx tables 2019-04-18 10:23:37 +01:00
Cosimo Lupo
3adcf8051c add glyf.getCoordinates method that only returns coordinates, and no controls 2019-03-12 19:01:26 +00:00
Cosimo Lupo
b4fd0e5ca0 varLib: move _{Get,Set}Coordinates to methods of glyf table class 2019-03-11 15:50:16 +00:00
Cosimo Lupo
a4c6abbbb6 mutator: --no-overlap option doesn't belong to logging group of options
copypasta error
2019-02-28 09:50:58 -08:00
Cosimo Lupo
67d9830978 mutator: add --no-overlap cli option to disable setting OVERLAP glyf flags
can be useful for debugging
2019-02-28 09:46:16 -08:00
Chris Simpkins
16bb3fd605 [varLib.mutator] set OVERLAP_SIMPLE and OVERLAP_COMPOUND by default in instantiateVariableFont (#1518) 2019-02-28 09:34:43 -08:00
Cosimo Lupo
e6d5b5531a
mutator: drop 'ltag' table if no longer referenced from 'name' table 2019-01-13 14:42:36 +00:00
ReadRoberts
1f2600ff65 [cff2] Add subset.cff functions for CFF/CFF2 class:
desubroutinize
remove_hints
remove_unused_subroutines

Fix issue in cff2mergePen.py because of  removing CFFS2Subrs class in prior commit.
2018-12-04 18:34:22 -08:00
Behdad Esfahbod
8b1730774a [CFF] Move varLib.mutator-specific code out of subset.cff 2018-11-29 17:07:51 -05:00
Behdad Esfahbod
fb3248ff1b [CFF] Whitespace 2018-11-29 14:15:54 -05:00
Behdad Esfahbod
18cfe2371a [CFF} Rename subset.cffLib to subset.cff 2018-11-29 14:09:57 -05:00
Behdad Esfahbod
7daf9ef298 [CFF] Whitespace 2018-11-29 14:08:53 -05:00
ReadRoberts
c2abd045b3 [varLib.mutator] Add interpolation of glyph metrics.
Added interpolation of glyph advance width, from HVAR/hmtx, and derivation of new LSB.
Updated tests to match.
Needed to cherrypick from another branch an update for psCharstrings to allow the CFFSubr.draw() method to work.
2018-11-20 12:44:21 -08:00
ReadRoberts
92b5e0faaa [varLib.mutator] Fix changes lost during cherry-picking. 2018-11-19 20:35:34 -08:00
ReadRoberts
272244a822 [varLib.mutator] Merge with master head. 2018-11-19 20:12:45 -08:00
ReadRoberts
fddd5b2bae [varLib.mutator] Interpolating CFF2 tables. Makes fixes per recommendations
varLib.py. restore import of 'fontTools.misc.py23 import *'
varStore.py. Rename 'applyScalar' to 'interpolateFromDeltasAndScalars', and refactor common code with __git__item to a static method.
mutator.py. Update to reflect function name change to interpolateFromDeltasAndScalars. Changed some logic from one line to several lines for readability, and i to avoid flake8 warnings about line too long.
2018-11-19 20:06:16 -08:00
ReadRoberts
d43ebd5e49 [varLib.mutator] Add support for interpolating CFF2 tables
Add handling of CFF2 table to mutator.py

Add public method applyScalars() to varStore.py::VarStoreInstancer()
2018-11-19 20:06:03 -08:00
Behdad Esfahbod
a766d8d91e [varLib.mutator] Mutate GDEF itself 2018-11-19 16:45:30 -05:00
Behdad Esfahbod
0218e07f76 [varLib.mutator] Move some code out of merger 2018-11-19 16:38:27 -05:00
Nyshadh Reddy Rachamallu
69c3f2c001 Fix unwanted white space changes 2018-11-16 18:11:25 -05:00
Nyshadh Reddy Rachamallu
3512c8b77f Avoid has_key; move break statement 2018-11-16 17:49:17 -05:00
Nyshadh Reddy Rachamallu
be793c80b9 stack data should follow same order as fvar; fix maxStackElements calculation 2018-11-16 15:33:33 -05:00