Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support new AFDKO variable layout syntax #2228

Closed
wants to merge 293 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
293 commits
Select commit Hold shift + click to select a range
da39a79
Shorten exception names
simoncozens Mar 18, 2021
6227a73
super doesn’t magically call its own methods
simoncozens Mar 18, 2021
207083a
Improve error message
simoncozens Mar 18, 2021
b3266ca
More tests
simoncozens Mar 18, 2021
8ba64df
Use kwargs and explicit stack
simoncozens Mar 19, 2021
1ca6ee8
Make CFF merge errors inherit differently
simoncozens Mar 19, 2021
914b664
Remove pass if we have a docstring
simoncozens Mar 19, 2021
9e0cf4c
[py23] change deprecation warning from "next release" to "future rele…
chrissimpkins Mar 20, 2021
97fb234
[subset] Call VariationStore.subset_varidxes() as method
behdad Mar 11, 2021
40937b0
[otlLib] Generate Value1 / Value2 if respective formats are non-zero
behdad Mar 19, 2021
f348db3
Update test data
madig Mar 22, 2021
edc4bba
Don't write Format for Coverage, ClassDef, Single/Alternate/LigatureS…
behdad Dec 17, 2013
c825def
Revert "[varLib.merge] Fix tests"
behdad Mar 23, 2021
cd4dc79
[varLib.merger] Adjust for removal of Coverage / ClassDef .Format
behdad Mar 23, 2021
af81665
[Tests] Fix most tests expectations for Coverage/ClassDef .Format change
behdad Mar 23, 2021
f8fdfca
[Tests] Fix more tests expectations for Coverage/ClassDef .Format change
behdad Mar 23, 2021
f1f7816
[Tests] Fix most tests expectations for SingleSubst .Format change
behdad Mar 23, 2021
63e8dd4
[Tests] Fix most tests expectations for LigatureSubst .Format change
behdad Mar 23, 2021
6ebbdf7
[Tests] Fix most test expectations for AlternateSubst .Format removal
behdad Mar 23, 2021
b91b382
[Tests] Fix most test expectations for ClassDef[12] .Format removal
behdad Mar 23, 2021
51dcd98
[Tests] Fix more test expectations for SingleSubst .Format removal
behdad Mar 23, 2021
c7b460f
[Tests] Remove hack after Coverage .Format removal
behdad Mar 23, 2021
1279ba2
Remove .Format from MultipleSubst as well
behdad Mar 24, 2021
55f963f
[Tests] Fix most test expectations for AlternateSubst .Format removal
behdad Mar 24, 2021
1e1d17a
[otBase] Delete .Format if was introduced by .preWrite()
behdad Mar 24, 2021
260b4f1
Test that G* table compilation does not change data
madig Mar 22, 2021
62fd70e
[feaLib] Set RangeStart/RangeEnd as float
behdad Mar 24, 2021
06270d5
Remove run-tests.sh
behdad Mar 24, 2021
281da3c
[otlLib] Ensure built PairPos1 ValueRecords are padded with 0s
anthrotype Mar 23, 2021
0cda858
[otlLib] Ensure built PairPos2 ValueRecords are padded with 0s
behdad Mar 24, 2021
b310185
[otlLib] Ensure built SinglePos ValueRecords are padded with 0s
behdad Mar 24, 2021
d4ad757
transition `basestring` to `str`
chrissimpkins Mar 27, 2021
b031462
Misc py23 cleanups (#2243)
justvanrossum Mar 29, 2021
1444558
[subset] Improve PairPosFormat2 subsetting
behdad Mar 10, 2021
dcd73a8
subset_test: add tests for PairPos2 useClass0 #2221
anthrotype Mar 23, 2021
8f0749c
TTFont.save: create file on disk only after compilation to tmp stream…
justvanrossum Mar 31, 2021
1ecd20a
refactored TTFont.__getitem__ somewhat: don't do major work in an exc…
justvanrossum Mar 30, 2021
f736d6a
Add missing dict operators to CFF2
punchcutter Mar 30, 2021
45988eb
Update NEWS.rst
madig Mar 31, 2021
5a01270
Release 4.22.0
madig Apr 1, 2021
c112fc3
Bump version: 4.22.0 → 4.22.1.dev0
madig Apr 1, 2021
db074e0
subset: fix pruning unused CPAL palettes when 0xFFFF is present
anthrotype Apr 6, 2021
2a8c85d
[GlyphCoordinates] Remove Jython workaround
behdad Apr 6, 2021
543953b
[GlyphCoordinates] Speed up __isub__() and __iadd__()
behdad Apr 6, 2021
af3d954
[GlyphCoordinates] Move identity check to scale() / translate()
behdad Apr 6, 2021
5ef70c6
[varLib] Optimize out multiplication by 1 when computing deltas
behdad Apr 6, 2021
0bc9f1b
[GlyphCoordinates] Speed up __imul__()
behdad Apr 6, 2021
621b663
[GlyphCoordinates] Store int data as 4byte, not 2byte
behdad Apr 7, 2021
e06a884
[GlyphCoordinates] Revert back from double to float
behdad Apr 7, 2021
bb8c667
[GlyphCoordinates] Speed up .zeros()
behdad Apr 7, 2021
11a9531
[GlyphCoordinates] Faster .zeros()
behdad Apr 7, 2021
b47406a
[GlyphCoordinates] Remove internal dual representation
behdad Apr 7, 2021
de1a2bc
[GlyphCoordinates] Remove unused .isFloat()
behdad Apr 7, 2021
d8ba7c4
[glyf] Use bytearray() when compiling
behdad Apr 7, 2021
b6a245d
[glyf] Use memoryview() in decompile for larger glyphs
behdad Apr 7, 2021
ce64a78
[glyf] Avoid a copy during decompile of flags
behdad Apr 7, 2021
222f8fd
[glyf] Remove unnecessary use of byteord()
behdad Apr 7, 2021
5b1d9d2
[glyf] Remove reprflag()
behdad Apr 7, 2021
f5518c2
[glyf] Remove most use of py23 byteord etc
behdad Apr 7, 2021
197f23d
[glyf] Minor
behdad Apr 7, 2021
b34da83
[GlyphCoordinates] Micro-optimize _i() access
behdad Apr 7, 2021
bcab655
[TupleVariation] Use list(coordinates) instead of coordinates[:]
behdad Apr 7, 2021
8a7527f
[glyf] Remove several bytes slicings
behdad Apr 7, 2021
4f60d19
[subset] Set glyph.data to b'' instead of ''
behdad Apr 7, 2021
a26af50
[subset] Use bytearray() instead of array.array('B')
behdad Apr 7, 2021
69da57a
[py23] Change tobytes() to accept bytearray
behdad Apr 7, 2021
414c750
[glyf] Use bytearray() in trim()
behdad Apr 7, 2021
e6f4f60
[glyf] Use bytearray() instead of array.array('B') for flags
behdad Apr 7, 2021
1466874
[TupleVariation] Use bytearray() instead of io.Bytes()
behdad Apr 7, 2021
1d7bb29
[TupleVariation] Don't round deltas (again!)
behdad Apr 7, 2021
315ff46
[TupleVariation] Use array.array to serialize multiple deltas
behdad Apr 7, 2021
c138967
[TupleVariation] Minor
behdad Apr 7, 2021
7ea6e35
[TupleVariation] Remove a few hot asserts
behdad Apr 7, 2021
299ee58
[TupleVariations] Optimize serialization loops
behdad Apr 7, 2021
4ee2124
[TupleVariation] Micro-optimize away a lambda
behdad Apr 7, 2021
158f014
[TupleVariation] More bytes optimization
behdad Apr 7, 2021
970719e
[TupleVariation] Optimize compilePoints()
behdad Apr 7, 2021
ea63d06
[TupleVariation] Do away with another bytesjoin()
behdad Apr 8, 2021
df39d61
[GlyphCoordinates] Format
behdad Apr 8, 2021
183ba2c
[GlyphCoordinates] Use float.is_integer()
behdad Apr 8, 2021
18f0225
[GlyphCoordinates] Inline _i()
behdad Apr 8, 2021
7b741d6
[GlyphCoordinates] Add back isFloat() and deprecate it
behdad Apr 8, 2021
ca12330
[TupleVariation] Minor rewrite bound checks
behdad Apr 8, 2021
2f81301
[TupleVariation] Remove use of bytesjoin()
behdad Apr 8, 2021
919823f
[py23] Make tobytes() always return bytes even for bytearray
behdad Apr 8, 2021
586f44e
[GlyphCoordinates] Remove isFloat() again
behdad Apr 8, 2021
79d1f02
[TupleVariation] Minor optimize in using sharedCoordinates
behdad Apr 8, 2021
5a86771
[TupleVariation] Minor optimization in compileCoord()
behdad Apr 8, 2021
2da9b21
[TupleVariation] Further optimize compileCoord()
behdad Apr 8, 2021
e900220
[TupleVariation] Use defaultdict in compileSharedTuples
behdad Apr 8, 2021
c542b86
[gvar] Remove use of bytesjoin()
behdad Apr 8, 2021
870d003
[TupleVariation] Rewrite assertion faster
behdad Apr 8, 2021
dc549c3
[gvar] Avoid a copy in compileGlyph_()
behdad Apr 8, 2021
08591c8
[TupleVariation] Minor optimization in compileDeltaValues_()
behdad Apr 8, 2021
d228a9e
[TupleVariation] Remove use of byteord()
behdad Apr 8, 2021
df11e19
[TupleVariation] Rewrite getUsedPoints() as list comprehension
behdad Apr 8, 2021
b92e98a
[TupleVariatin] Minor optimization of sharedPoints
behdad Apr 8, 2021
933a32e
[TupleVariation] Speed up case of useSharedPoints=False
behdad Apr 8, 2021
56fd521
[TupleVariation] Optimize point-sharing
behdad Apr 8, 2021
6a6f5ed
[TupleVariation] Compile point set counts outside of key()
behdad Apr 8, 2021
6acfbb7
[TupleVariation] Avoid recompiling pointData
behdad Apr 8, 2021
0d41bea
[TupleVariation] Optimize compilePoints()
behdad Apr 8, 2021
c9a31e9
[TupleVariation] Optimize compileDeltas()
behdad Apr 9, 2021
71d5702
[VariationData] Fix tests after recent changes
behdad Apr 9, 2021
1dcfb9e
[TupleVariation] Minor shift more code into getUsedPoints()
behdad Apr 9, 2021
ba6075e
[TupleVariation] Comment
behdad Apr 9, 2021
9f9aad7
[TupleVariation] Use Counter() instead of defaultdict() for sharedCoords
behdad Apr 9, 2021
f45f74d
[GlyphCoordinates] Use double, not float, again
behdad Apr 9, 2021
bf2e4b3
[TupleVariation] Remove unused usesSharedPoints return from tv.compile()
behdad Apr 9, 2021
57f1c25
[TupleVariation] Use b'' instead of NotImplemented for "use shared po…
behdad Apr 9, 2021
a0bbc59
[TupleVariation] Fold call to hasImpact() into getUsedPoints()
behdad Apr 9, 2021
661f938
[varLib/glyf] Remove fallback vertical phantom-points code
behdad Apr 12, 2021
bf2d9a6
[glyf] Remove useless assert in getPhantomPoints()
behdad Apr 13, 2021
5362926
[varLib] Optimize getPhantomPoints()
behdad Apr 13, 2021
5c8027d
[glyf] Remove useless assert in setCoordinates()
behdad Apr 13, 2021
b61c3be
[gvar] Reduce TTFont.__getitem__() calls
behdad Apr 13, 2021
93fb805
[varLib] Reduce TTFont.__getitem__() in _merge_TTHinting
behdad Apr 13, 2021
a63c423
[varLib] Minor optimizations in maxp and TThinting
behdad Apr 13, 2021
95fa3b5
[glyf] Add .get() which is like __getitem__() but returning None if n…
behdad Apr 13, 2021
b1685a9
[glyf] Remove unused code
behdad Apr 13, 2021
5611167
[glyf] Add default=None to glyf.get()
behdad Apr 14, 2021
c7ca37c
[varLib] Use TTFont.get() in a couple of places
behdad Apr 14, 2021
ca2702c
[glyf] Prefix setCoordinates, getCoordinatesAndControls, getPhantomPo…
behdad Apr 14, 2021
48e3761
[glyf] Add old setCoordinates, getCoordinatesAndControls, getPhantomP…
behdad Apr 14, 2021
3aa34d0
[varLib.instancer] Add back instantiateGvarGlyph()
behdad Apr 14, 2021
fedf8f2
Update Lib/fontTools/varLib/instancer/__init__.py
behdad Apr 15, 2021
75b66a1
Include record size adjustment.
garretrieger Apr 21, 2021
c1a170b
Add tests for lazy loading of MVAR with more than 8 value records.
garretrieger Apr 21, 2021
8b00e39
[ttLib] Add Value.getEffectiveFormat()
behdad Apr 21, 2021
4151481
[varLib.merger] Use Value.getEffectiveFormat() instead of .getFormat()
behdad Apr 21, 2021
2c570b4
[subset] Fix drop-hints implementation in Device tables
behdad Apr 21, 2021
54ae41b
add test to repro AttributeError when getAlternateGlyphs for empty lo…
anthrotype Apr 22, 2021
5596596
feaLib: ignore empty named lookup reference
anthrotype Apr 22, 2021
2b7298e
another test to check that empty lookups blocks are skipped
anthrotype Apr 26, 2021
95f2b4f
Update changelog [skip ci]
anthrotype Apr 26, 2021
096f275
Release 4.22.1
anthrotype Apr 26, 2021
cbe2e9a
Bump version: 4.22.1 → 4.22.2.dev0
anthrotype Apr 26, 2021
aef9961
[varLib.instancer] update instantiateVariableFont docs
chrissimpkins Apr 28, 2021
2793b73
[mutator] Round lsb for CFF2 fonts as well
khaledhosny May 2, 2021
704d043
RecordingPointPen: handle identifier args
madig Feb 28, 2021
913f396
Introduce PenError, use instead of asserts
madig Feb 28, 2021
9b18610
Use TypeError for not enough points
madig May 1, 2021
ea90f84
VarLibMergeError.stack is a list of str, not a str
anthrotype May 6, 2021
d4c6231
#2289 fix for typo in typo in ttLib.tables._g_l_y_f.py
Eigi May 6, 2021
830633a
test if issue #2295 is fixed
Eigi May 7, 2021
1e6e3c0
[otTables] Default varIdx should be 0xFFFFFFFF (#2298)
justvanrossum May 7, 2021
5a1195a
Fix for #2293: allow more than one lookahead glyph/class in contextua…
justvanrossum May 8, 2021
c1247a1
[otBase] Add array version of various int readers
behdad Apr 30, 2021
5be1980
[otConverters] Use array readers when reading ItemVariationStore payload
behdad Apr 30, 2021
1ff8e7d
[otConverters] Add array readers to int converters
behdad Apr 30, 2021
24981b1
[otBase] fix array-reader to return list, not array.array
behdad Apr 30, 2021
40cbaac
[otBase/otConverters] Add array-writers for int types
behdad Apr 30, 2021
0af3473
[otConverters] Use array-writers for ItemVariationStore payload
behdad Apr 30, 2021
f0ff817
[otBase] Add array reader/writer for UInt24
behdad Apr 30, 2021
cda8ef6
[otBase] Actually call conv.writeArray()
behdad Apr 30, 2021
bdaabd3
[otConverters] Use array read/write in VarIdxMapValue
behdad Apr 30, 2021
87a3e96
[otConverters] Implement writeArray for GlyphID
behdad May 1, 2021
9f82ee9
[otConverters] Minor in VarStore padding
behdad May 1, 2021
dba17cc
[otConverters] Rename VarStore shortCount to wordCount in local varia…
behdad May 1, 2021
ba86469
[otConverters] Support read/write of 32bit VarStore
behdad May 1, 2021
99bf8ff
[varLib.builder] Implement building 32bit VarStore
behdad May 1, 2021
7c40406
[varLib.varStore] Remove use of array.array
behdad May 1, 2021
8b8d0c7
[varLib.varStore] Implement 32bit VarStore optimization
behdad May 1, 2021
e65c3bc
add 32-bit tests to test_buildVarData_no_optimize
justvanrossum May 4, 2021
2b7d169
add 32-bit tests to test_buildVarData_optimize
justvanrossum May 4, 2021
b78f727
add tests for OnlineVarStoreBuilder/VarStoreInstancer
justvanrossum May 4, 2021
6f17d22
use optimizer
justvanrossum May 4, 2021
da0891f
add 32-bit master value tests
justvanrossum May 4, 2021
23cb298
adding compile/decompile step; this currently fails for the 32-bit te…
justvanrossum May 4, 2021
7d9fd1d
uncomment failing tests
justvanrossum May 4, 2021
844b07d
fix struct vs array mismatch: for array 'l' is 8 bytes, not 4. I'm no…
justvanrossum May 4, 2021
57a156a
font placeholder doesn't need an fvar table
justvanrossum May 4, 2021
da4945b
[otBase/otConverters] Add back array index to exception in writeArray()
behdad May 7, 2021
623db87
[varLib.builder] Document bit-tweedling
behdad May 7, 2021
ccddd90
[varLib.varStore] Use binary notation for bit constants
behdad May 7, 2021
27dfece
[otBase] Assert array.array('i').itemsize
behdad May 7, 2021
3e38997
fix for issue #2299
Eigi May 9, 2021
50ea33e
axisPoints is not used outside the sort function
simoncozens May 12, 2021
cdb5c5f
Avoid unnecessary intermediary variables
simoncozens May 12, 2021
1dd872d
Index was never used
simoncozens May 12, 2021
9558173
Another unused enumeration
simoncozens May 12, 2021
bbe2c70
Reformat with black
simoncozens May 12, 2021
65464e3
Remove else-after-return
simoncozens May 12, 2021
101f4c1
We are iterating over supports, not locations, here
simoncozens May 12, 2021
66686cb
removeOverlaps: print glyph name when pathops.simplify fails
anthrotype May 4, 2021
5b97554
removeOverlaps: try rounding to ints before simplify to workaround sk…
anthrotype May 6, 2021
403414b
split simplify logic to separate func for easier unit-testing
anthrotype May 6, 2021
86c38d2
add test for pathops simplify bug workaround
anthrotype May 6, 2021
65ffeff
skip removeOveraps_test if pathops can't be imported
anthrotype May 6, 2021
038099c
minor refactorings following review comment
anthrotype May 7, 2021
5f99cc7
Update changelog [skip ci]
anthrotype May 12, 2021
6f23541
g_l_y_f: fix undefined name 'topSideBearing'
anthrotype May 13, 2021
25ba6c3
add deprecation warnings for old getPhantomPoints, etc.
anthrotype May 13, 2021
16daa57
[feaLib] Allow substituting a glyph class with NULL
khaledhosny May 12, 2021
c4777b5
VarLibMergeError first parameter must be a Merger object
anthrotype May 10, 2021
75a3729
Update changelog [skip ci]
anthrotype May 13, 2021
83a489b
Release 4.23.0
anthrotype May 13, 2021
5b935a6
Bump version: 4.23.0 → 4.23.1.dev0
anthrotype May 13, 2021
25c12b8
subset: test mixed COLR v0/v1 with subset excluding all v0 glyphs
anthrotype May 14, 2021
7038ec3
COLR: set {BaseGlyph,Layer}RecordArray to None when no colorGlyphsV0 …
anthrotype May 14, 2021
3584471
subset: prune v0 base glyphs and layers when none are left after subs…
anthrotype May 14, 2021
b58d4dc
Update changelog [skip ci]
anthrotype May 14, 2021
90debbf
Release 4.23.1
anthrotype May 14, 2021
9f5196e
Bump version: 4.23.1 → 4.23.2.dev0
anthrotype May 14, 2021
0866d68
Add TTGlyphPointPen (#2205)
jenskutilek May 17, 2021
4d89944
Update NEWS.rst [skip ci]
jenskutilek May 17, 2021
a1395bb
Release 4.24.0
anthrotype May 17, 2021
656573b
Bump version: 4.24.0 → 4.24.1.dev0
anthrotype May 17, 2021
7c6d0d8
Add test to reproduce issue 2312
anthrotype May 19, 2021
1ff86ca
subset: don't prune_post_subset if no SinglePos Value
anthrotype May 19, 2021
cb031d1
return True from SinglePos.prune_post_subset to not change semantics
anthrotype May 20, 2021
7949acd
Update changelog [skip ci]
anthrotype May 20, 2021
1125728
Release 4.24.1
anthrotype May 20, 2021
e7af4ec
Bump version: 4.24.1 → 4.24.2.dev0
anthrotype May 20, 2021
8d5b24a
ttGlyphPen: run black
anthrotype May 20, 2021
4df38ed
ttGlyphPen: fix typing annotation for glyphSet parameter
anthrotype May 20, 2021
fb065ee
make glyphSet required.. but Optional :)
anthrotype May 20, 2021
b939bc5
leave self.glyphSet alone
anthrotype May 20, 2021
ec2da24
fixed two instances of 'DeprecationWarning: invalid escape sequence'
justvanrossum May 19, 2021
6f2402e
Use r-string instead of escaping backslash
justvanrossum May 20, 2021
7305a67
Update changelog [skip ci]
anthrotype May 20, 2021
e24bc0e
Release 4.24.2
anthrotype May 20, 2021
afef274
Bump version: 4.24.2 → 4.24.3.dev0
anthrotype May 20, 2021
59258bc
README: add instructions on how to make a release
anthrotype May 20, 2021
099a207
make title underline long enough
anthrotype May 20, 2021
789a11b
mention release --minor, --major and --sign options
anthrotype May 20, 2021
490e9a8
otTables: ignore Format attribute in split.*Subst overflow-fixing met…
anthrotype May 20, 2021
870b767
otTables_test: mixed tabs and spaces
anthrotype May 20, 2021
4f96b4b
Update changelog [skip ci]
anthrotype May 20, 2021
01c87a2
Release 4.24.3
anthrotype May 20, 2021
5b2fb0b
Bump version: 4.24.3 → 4.24.4.dev0
anthrotype May 20, 2021
ec816ed
Parse variable scalars in feature files.
simoncozens Mar 18, 2021
2e86b2c
Build variable scalars for anchors/value records
simoncozens Mar 18, 2021
2e55709
Variable scalar tests
simoncozens Mar 18, 2021
1216eb2
Support variable scalars in pos A V (...);
simoncozens Mar 20, 2021
16afa35
Format bug
simoncozens May 18, 2021
b38bf4a
Useful property
simoncozens May 20, 2021
9a3fbac
Add support for the conditionset statement
simoncozens May 20, 2021
4165bb2
Parse variation blocks
simoncozens May 20, 2021
259204e
Round-trip FEA correctly
simoncozens May 20, 2021
301c17d
Store the conditional features in a dictionary until we work out what…
simoncozens May 20, 2021
f99b6fb
Rearrange featureVars so we can do *really* raw feature builds (by lo…
simoncozens May 24, 2021
1f758f2
Oops, leftover when testing something else
simoncozens May 24, 2021
f7589ca
A more generic interface, taking either GSUB or GPOS table
simoncozens May 24, 2021
635c29f
Normalize condition sets when storing them
simoncozens May 24, 2021
dcf985d
feature_variations_ is a better name than conditionalFeatures_
simoncozens May 24, 2021
c58ddae
Support building feature variations using the "condition" statement.
simoncozens May 24, 2021
3c19ae4
Put count fields in ttx
simoncozens May 24, 2021
778a7ca
Set count fields when building feature variations
simoncozens May 24, 2021
4639015
Allow float values in condition sets.
simoncozens May 25, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 8 additions & 8 deletions Doc/source/ttx.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ The TTX file format

The following tables are currently supported::

BASE, CBDT, CBLC, CFF, CFF2, COLR, CPAL, DSIG, EBDT, EBLC, FFTM,
Feat, GDEF, GMAP, GPKG, GPOS, GSUB, Glat, Gloc, HVAR, JSTF, LTSH,
MATH, META, MVAR, OS/2, SING, STAT, SVG, Silf, Sill, TSI0, TSI1,
TSI2, TSI3, TSI5, TSIB, TSIC, TSID, TSIJ, TSIP, TSIS, TSIV, TTFA,
VDMX, VORG, VVAR, ankr, avar, bsln, cidg, cmap, cvar, cvt, feat,
fpgm, fvar, gasp, gcid, glyf, gvar, hdmx, head, hhea, hmtx, kern,
lcar, loca, ltag, maxp, meta, mort, morx, name, opbd, post, prep,
prop, sbix, trak, vhea and vmtx
BASE, CBDT, CBLC, CFF, CFF2, COLR, CPAL, DSIG, Debg, EBDT, EBLC,
FFTM, Feat, GDEF, GMAP, GPKG, GPOS, GSUB, Glat, Gloc, HVAR, JSTF,
LTSH, MATH, META, MVAR, OS/2, SING, STAT, SVG, Silf, Sill, TSI0,
TSI1, TSI2, TSI3, TSI5, TSIB, TSIC, TSID, TSIJ, TSIP, TSIS, TSIV,
TTFA, VDMX, VORG, VVAR, ankr, avar, bsln, cidg, cmap, cvar, cvt,
feat, fpgm, fvar, gasp, gcid, glyf, gvar, hdmx, head, hhea, hmtx,
kern, lcar, loca, ltag, maxp, meta, mort, morx, name, opbd, post,
prep, prop, sbix, trak, vhea and vmtx

.. end table list

Expand Down
94 changes: 91 additions & 3 deletions Doc/source/varLib/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,94 @@
######
varLib
######
##################################
varLib: OpenType Variation Support
##################################

The ``fontTools.varLib`` package contains a number of classes and routines
for handling, building and interpolating variable font data. These routines
rely on a common set of concepts, many of which are equivalent to concepts
in the OpenType Specification, but some of which are unique to ``varLib``.

Terminology
-----------

axis
"A designer-determined variable in a font face design that can be used to
derive multiple, variant designs within a family." (OpenType Specification)
An axis has a minimum value, a maximum value and a default value.

designspace
The n-dimensional space formed by the font's axes. (OpenType Specification
calls this the "design-variation space")

scalar
A value which is able to be varied at different points in the designspace:
for example, the horizontal advance width of the glyph "a" is a scalar.
However, see also *support scalar* below.

default location
A point in the designspace whose coordinates are the default value of
all axes.

location
A point in the designspace, specified as a set of coordinates on one or
more axes. In the context of ``varLib``, a location is a dictionary with
the keys being the axis tags and the values being the coordinates on the
respective axis. A ``varLib`` location dictionary may be "sparse", in the
sense that axes defined in the font may be omitted from the location's
coordinates, in which case the default value of the axis is assumed.
For example, given a font having a ``wght`` axis ranging from 200-1000
with default 400, and a ``wdth`` axis ranging 100-300 with default 150,
the location ``{"wdth": 200}`` represents the point ``wght=400,wdth=200``.

master
The value of a scalar at a given location. **Note that this is a
considerably more general concept than the usual type design sense of
the term "master".**

normalized location
While the range of an axis is determined by its minimum and maximum values
as set by the designer, locations are specified internally to the font binary
in the range -1 to 1, with 0 being the default, -1 being the minimum and
1 being the maximum. A normalized location is one which is scaled to the
range (-1,1) on all of its axes. Note that as the range from minimum to
default and from default to maximum on a given axis may differ (for
example, given ``wght min=200 default=500 max=1000``, the difference
between a normalized location -1 of a normalized location of 0 represents a
difference of 300 units while the difference between a normalized location
of 0 and a normalized location of 1 represents a difference of 700 units),
a location is scaled by a different factor depending on whether it is above
or below the axis' default value.

support
While designers tend to think in terms of masters - that is, a precise
location having a particular value - OpenType Variations specifies the
variation of scalars in terms of deltas which are themselves composed of
the combined contributions of a set of triangular regions, each having
a contribution value of 0 at its minimum value, rising linearly to its
full contribution at the *peak* and falling linearly to zero from the
peak to the maximum value. The OpenType Specification calls these "regions",
while ``varLib`` calls them "supports" (a mathematical term used in real
analysis) and expresses them as a dictionary mapping each axis tag to a
tuple ``(min, peak, max)``.

box
``varLib`` uses the term "box" to denote the minimum and maximum "corners" of
a support, ignoring its peak value.

delta
The term "delta" is used in OpenType Variations in two senses. In the
more general sense, a delta is the difference between a scalar at a
given location and its value at the default location. Additionally, inside
the font, variation data is stored as a mapping between supports and deltas.
The delta (in the first sense) is computed by summing the product of the
delta of each support by a factor representing the support's contribution
at this location (see "support scalar" below).

support scalar
When interpolating a set of variation data, the support scalar represents
the scalar multiplier of the support's contribution at this location. For
example, the support scalar will be 1 at the support's peak location, and
0 below its minimum or above its maximum.


.. toctree::
:maxdepth: 2
Expand Down
3 changes: 1 addition & 2 deletions Lib/fontTools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from fontTools.misc.py23 import *
import logging
from fontTools.misc.loggingTools import configLogger

log = logging.getLogger(__name__)

version = __version__ = "4.21.2.dev0"
version = __version__ = "4.24.4.dev0"

__all__ = ["version", "log", "configLogger"]
1 change: 0 additions & 1 deletion Lib/fontTools/afmLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"""


from fontTools.misc.py23 import *
import re

# every single line starts with a "word"
Expand Down
8 changes: 4 additions & 4 deletions Lib/fontTools/agl.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
doesn't include any (e.g. format 3.0 post tables).
"""

from fontTools.misc.py23 import *
from fontTools.misc.py23 import tostr
import re


Expand Down Expand Up @@ -5140,7 +5140,7 @@ def _glyphComponentToUnicode(component, isZapfDingbats):
# to the corresponding character in that list.
uchars = LEGACY_AGL2UV.get(component)
if uchars:
return "".join(map(unichr, uchars))
return "".join(map(chr, uchars))

# Otherwise, if the component is of the form "uni" (U+0075,
# U+006E, and U+0069) followed by a sequence of uppercase
Expand Down Expand Up @@ -5210,7 +5210,7 @@ def _uniToUnicode(component):
if any(c >= 0xD800 and c <= 0xDFFF for c in chars):
# The AGL specification explicitly excluded surrogate pairs.
return None
return ''.join([unichr(c) for c in chars])
return ''.join([chr(c) for c in chars])


_re_u = re.compile("^u([0-9A-F]{4,6})$")
Expand All @@ -5228,5 +5228,5 @@ def _uToUnicode(component):
return None
if ((value >= 0x0000 and value <= 0xD7FF) or
(value >= 0xE000 and value <= 0x10FFFF)):
return unichr(value)
return chr(value)
return None
31 changes: 17 additions & 14 deletions Lib/fontTools/cffLib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

"""

from fontTools.misc.py23 import *
from fontTools.misc.py23 import bytechr, byteord, bytesjoin, tobytes, tostr
from fontTools.misc import sstruct
from fontTools.misc import psCharStrings
from fontTools.misc.arrayTools import unionRect, intRect
Expand All @@ -20,6 +20,7 @@
from fontTools.ttLib.tables.otBase import OTTableWriter
from fontTools.ttLib.tables.otBase import OTTableReader
from fontTools.ttLib.tables import otTables as ot
from io import BytesIO
import struct
import logging
import re
Expand Down Expand Up @@ -118,7 +119,7 @@ def __getitem__(self, nameOrIndex):
"""
if hasattr(nameOrIndex, "__index__"):
index = nameOrIndex.__index__()
elif isinstance(nameOrIndex, basestring):
elif isinstance(nameOrIndex, str):
name = nameOrIndex
try:
index = self.fontNames.index(name)
Expand Down Expand Up @@ -261,7 +262,7 @@ def fromXML(self, name, attrs, content, otFont=None):
self.topDictIndex = TopDictIndex(None, cff2GetGlyphOrder, None)
self.topDictIndex.append(topDict)
for element in content:
if isinstance(element, basestring):
if isinstance(element, str):
continue
name, attrs, content = element
topDict.fromXML(name, attrs, content)
Expand All @@ -277,7 +278,7 @@ def fromXML(self, name, attrs, content, otFont=None):
if not hasattr(self, "GlobalSubrs"):
self.GlobalSubrs = GlobalSubrsIndex()
for element in content:
if isinstance(element, basestring):
if isinstance(element, str):
continue
name, attrs, content = element
subr = subrCharStringClass()
Expand Down Expand Up @@ -879,7 +880,7 @@ def fromXML(self, name, attrs, content):
return
fontDict = FontDict()
for element in content:
if isinstance(element, basestring):
if isinstance(element, str):
continue
name, attrs, content = element
fontDict.fromXML(name, attrs, content)
Expand Down Expand Up @@ -1106,7 +1107,7 @@ def toXML(self, xmlWriter):

def fromXML(self, name, attrs, content):
for element in content:
if isinstance(element, basestring):
if isinstance(element, str):
continue
name, attrs, content = element
if name != "CharString":
Expand Down Expand Up @@ -1245,7 +1246,7 @@ def write(self, parent, value):
return tobytes(value, encoding='ascii')

def xmlWrite(self, xmlWriter, name, value):
xmlWriter.simpletag(name, value=tounicode(value, encoding="ascii"))
xmlWriter.simpletag(name, value=tostr(value, encoding="ascii"))
xmlWriter.newline()

def xmlRead(self, name, attrs, content, parent):
Expand All @@ -1261,7 +1262,7 @@ def write(self, parent, value):
return tobytes(value, encoding='latin1')

def xmlWrite(self, xmlWriter, name, value):
value = tounicode(value, encoding="latin1")
value = tostr(value, encoding="latin1")
if name in ['Notice', 'Copyright']:
value = re.sub(r"[\r\n]\s+", " ", value)
xmlWriter.simpletag(name, value=value)
Expand All @@ -1282,7 +1283,7 @@ def parseNum(s):
def parseBlendList(s):
valueList = []
for element in s:
if isinstance(element, basestring):
if isinstance(element, str):
continue
name, attrs, content = element
blendList = attrs["value"].split()
Expand Down Expand Up @@ -1358,7 +1359,7 @@ def xmlWrite(self, xmlWriter, name, value):
def xmlRead(self, name, attrs, content, parent):
ob = self.getClass()()
for element in content:
if isinstance(element, basestring):
if isinstance(element, str):
continue
name, attrs, content = element
ob.fromXML(name, attrs, content)
Expand Down Expand Up @@ -1650,7 +1651,7 @@ def parseCharset(numGlyphs, file, strings, isCID, fmt):
class EncodingCompiler(object):

def __init__(self, strings, encoding, parent):
assert not isinstance(encoding, basestring)
assert not isinstance(encoding, str)
data0 = packEncoding0(parent.dictObj.charset, encoding, parent.strings)
data1 = packEncoding1(parent.dictObj.charset, encoding, parent.strings)
if len(data0) < len(data1):
Expand Down Expand Up @@ -1721,7 +1722,7 @@ def xmlRead(self, name, attrs, content, parent):
return attrs["name"]
encoding = [".notdef"] * 256
for element in content:
if isinstance(element, basestring):
if isinstance(element, str):
continue
name, attrs, content = element
code = safeEval(attrs["code"])
Expand Down Expand Up @@ -1833,7 +1834,7 @@ def write(self, parent, value):
def xmlRead(self, name, attrs, content, parent):
fdArray = FDArrayIndex()
for element in content:
if isinstance(element, basestring):
if isinstance(element, str):
continue
name, attrs, content = element
fdArray.fromXML(name, attrs, content)
Expand Down Expand Up @@ -2105,6 +2106,8 @@ def xmlRead(self, name, attrs, content, parent):
(11, 'StdVW', 'number', None, None),
((12, 12), 'StemSnapH', 'delta', None, None),
((12, 13), 'StemSnapV', 'delta', None, None),
((12, 17), 'LanguageGroup', 'number', 0, None),
((12, 18), 'ExpansionFactor', 'number', 0.06, None),
(19, 'Subrs', 'number', None, SubrsConverter()),
]

Expand Down Expand Up @@ -2332,7 +2335,7 @@ def getChildren(self, strings):
self.rawDict["charset"] = charsetCode
if hasattr(self.dictObj, "Encoding") and self.dictObj.Encoding:
encoding = self.dictObj.Encoding
if not isinstance(encoding, basestring):
if not isinstance(encoding, str):
children.append(EncodingCompiler(strings, encoding, self))
else:
if hasattr(self.dictObj, "VarStore"):
Expand Down
5 changes: 2 additions & 3 deletions Lib/fontTools/cffLib/specializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@

"""

from fontTools.misc.py23 import *
from fontTools.cffLib import maxStackLimit


def stringToProgram(string):
if isinstance(string, basestring):
if isinstance(string, str):
string = string.split()
program = []
for token in string:
Expand Down Expand Up @@ -70,7 +69,7 @@ def programToCommands(program, getNumRegions=None):
it = iter(program)

for token in it:
if not isinstance(token, basestring):
if not isinstance(token, str):
stack.append(token)
continue

Expand Down
5 changes: 2 additions & 3 deletions Lib/fontTools/cffLib/width.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
This module determines the optimum ``defaultWidthX`` and ``nominalWidthX``
values for a font, when provided with a list of glyph widths."""

from fontTools.misc.py23 import *
from fontTools.ttLib import TTFont, getTableClass
from fontTools.ttLib import TTFont
from collections import defaultdict
from operator import add
from functools import partial, reduce
from functools import reduce


class missingdict(dict):
Expand Down