Simon Cozens
db8948b654
Document otlLib.builder, high-level lookup builders.
...
Essentially the documentation from #1995 , incorporates @dscorbett
feedback.
2020-07-03 11:38:29 +01:00
Simon Cozens
6364d36633
[otlLib] Refactor chained contextual builders ( #2007 )
...
* Introduce a new subclass for chained contextual (sub and pos)
* Rename .substitutions to .rules in subst builders to allow for code reuse
* Make format of subtable break marker tuple common between sub/pos
Note that prior to this patch, add_subtable_break in a Subst builder adds:
(self.SUBTABLE_BREAK_, self.SUBTABLE_BREAK_, self.SUBTABLE_BREAK_, self.SUBTABLE_BREAK_)
while add_subtable_break in a Pos builder adds:
(self.SUBTABLE_BREAK_, self.SUBTABLE_BREAK_, self.SUBTABLE_BREAK_, [self.SUBTABLE_BREAK_])
This is messy. If we read the first element from the tuple instead of the last one to test if a rule is a subtable break, we can make the marker tuple the same.
* And now the subtable break code can be hoisted into superclass
* These helper methods will make the build routine common
* Hoist common build method to superclass
The diff doesn’t show it very clearly because it’s being too clever, but all I’ve done is moved one method. Everything works apart from the error message, which comes next.
* Fix the error message
2020-07-02 18:40:20 +01:00
Simon Cozens
ebfa4ba1fe
Move feature builders to otlLib
...
Refactors feaLib, moving code which builds OpenType lookups into otlLib. Note that this changes feaLib's concept of `location` from a tuple to an object.
2020-07-02 14:09:10 +01:00
Just van Rossum
90c7c7fae1
Fix for #1985 : ensure that the AxisNameID in the STAT table is > 255 ( #1986 )
...
Fix for #1985 :
* ensure that the AxisNameID in the STAT table is not less than 256. This needed an additional argument to the addMultiLingualName() name table method.
* fvar axis name IDs must also not be less than 256, just like STAT axis names.
2020-06-08 19:39:28 +02:00
Just van Rossum
d6bb38c7e6
[otlLib.builder] Add function to build STAT table from high-level description ( #1926 )
...
* added a function to build a STAT table: `fontTools.otlLib.builder.buildStatTable()`
* make `varLib._add_stat()` a client of `buildStatTable()`
2020-05-09 16:08:11 +02:00
Nikolaus Waxweiler
01328213c7
Remove __future__ imports
2019-08-09 12:20:13 +01:00
Cosimo Lupo
7f82d11156
otlLib: return namedtuple from _makeDeviceTuple
...
makes code slightly more readable.
2019-06-18 16:00:39 +01:00
ReadRoberts
b44c761526
[oltLib.builder] Fix bug in building a variation font.
...
The logic for building a Device subtable didn't know about the VariationIndex flavor of a ValueRecord Device subtable.
2019-06-12 14:31:38 -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
Martin Hosken
1a92b3c21d
Comment changes to help clarify
2019-04-15 14:24:25 +07:00
Martin Hosken
06ed699785
Compress type 1 GPOS tables better
2019-03-15 10:50:13 +07:00
Cosimo Lupo
78ad48eaf3
Move all *_test.py modules and test data to external Tests/ folder
2017-01-16 09:14:12 +00:00
Cosimo Lupo
49bcbb916b
consistently do sys.exit(unittest.main()) in all test modules
...
So that when run as scrips they report test failures with exit code
Follow up on b7bb391033ef3255c90134da3d7aef50d2d5326d
2017-01-11 13:05:35 +00:00
Cosimo Lupo
dd0cf31d4e
otlLib.builder: don't specialcase tuple as it's immutable and returns itself
...
https://github.com/fonttools/fonttools/pull/793#discussion_r94358989
2017-01-04 13:15:18 +01:00
Cosimo Lupo
3b3e74f90b
builder.py: only sort ClassDefBuilder input glyphs if they are unsorted
...
This fixes broken tests after 9e76d16, and should finally close https://github.com/fonttools/fonttools/issues/766
2016-12-31 15:51:53 +01:00
Cosimo Lupo
3ff25948ef
Revert "builder.py: try to fix non-deterministic ClassDef"
...
This reverts commit 9e76d1677cf955369f6f98755ac646dcf8af26b0.
2016-12-31 15:22:26 +01:00
Cosimo Lupo
9e76d1677c
builder.py: try to fix non-deterministic ClassDef
...
See:
https://github.com/fonttools/fonttools/issues/766#issuecomment-269858646
7d1ddb237e (commitcomment-20333287)
Should fix https://github.com/fonttools/fonttools/issues/766
2016-12-31 13:53:08 +01:00
Behdad Esfahbod
a0019a3e75
Minor
2016-12-30 19:18:15 -05:00
Cosimo Lupo
0e3c6eeaec
builder_test: test ClassDef sets with same length, to check deterministic sorting between python 2/3
...
See issue #766
2016-12-30 15:40:58 +00:00
Behdad Esfahbod
3eacc23868
Update tests for previous commit
...
The following sed command can be used to update TTX sources for the LookupType
change:
$ sed -i'~' 's/<!-- LookupType=\(.\) -->/<LookupType value="\1"\/>/g' *.ttx
2016-12-28 20:29:43 -05:00
Behdad Esfahbod
7d1ddb237e
[otlLib] Make ClassDef sorting deterministic
...
Fixes https://github.com/fonttools/fonttools/issues/766
2016-12-28 15:44:19 -05:00
Cosimo Lupo
689d0c3fe4
set maxDiff=None attribute only once, using setUpClass
method of unittest.TestCase
2016-12-21 13:57:44 +00:00
Cosimo Lupo
f112a05be2
adjust unit tests to expect a list of strings from getXML()
2016-12-21 13:57:44 +00:00
moyogo
f81e1411b3
[otlLib] glyph class as list and tuple instead of set and frozenset
2016-04-25 22:37:34 +01:00
Sascha Brawer
c64019b3c6
[otlLib] Move building of class-based PairPos sutables from feaLib to otlLib
2016-02-02 15:17:01 +01:00
Sascha Brawer
f9e859c213
[otlLib] Move helper for building ClassDef tables from feaLib to otlLib
2016-02-02 10:48:47 +01:00
Sascha Brawer
0f609592bb
[otlLib] Build multiple glyph-based PairPos subtables when needed
...
Before this change, feaLib would group glyph-based pair positionings
by value formats. After this change, this logic happens in otlLib.
But clients can still do their own grouping if they wish, by calling
the buildPairPosGlyphsSubtable() method directly.
2016-02-02 10:30:33 +01:00
Sascha Brawer
5095aa9ecf
[otlLib] Move building of glyph-based PairPos subtables from feaLib to otlLib
2016-02-02 09:35:31 +01:00
Behdad Esfahbod
929dada533
[otlLib] Minor
...
These count attrs are redundant and we might remove them in the
future. To simplify things, always write them as:
self.XXXCount = len(self.XXX)
2016-01-22 19:57:22 +01:00
Behdad Esfahbod
521d1d0e90
[otlLib] Remove duplicate points in buildAttachPoint()
2016-01-22 19:56:10 +01:00
Behdad Esfahbod
223a1c8499
[otlLib] Return None from buildAttachPoint()
2016-01-22 19:51:02 +01:00
Behdad Esfahbod
33eb68e21a
[otlLib] Disallow negative pixel-size in buildDevice()
...
These fields are USHORT.
2016-01-22 19:49:22 +01:00
Behdad Esfahbod
58b49a1a42
[otlLib] change buildDevice API to take dict
...
Makes more sense. feaLib can be simplified by storing a dict
as well, but for now just cast.
2016-01-22 19:45:56 +01:00
Behdad Esfahbod
e4328fb612
[otlLib] Return None in a few more places
2016-01-22 19:39:54 +01:00
Behdad Esfahbod
4e13a2268e
[otlLib] One more rename
2016-01-22 19:38:20 +01:00
Behdad Esfahbod
aea0ce9ae1
[otlLib] Adapt names to newly agreed scheme
2016-01-22 19:32:45 +01:00
Behdad Esfahbod
564af5a65c
[otlLib] Return None if coverage is empty
2016-01-22 19:27:33 +01:00
Sascha Brawer
af48e43371
[otlLib] Move building of MarkLigPos from feaLib to otlLib
2016-01-22 14:50:17 +01:00
Sascha Brawer
036e2ce497
[otlLib] Move building of LigatureArrays from feaLib to otlLib
...
Not sure if empty ComponentRecords can be optimized away.
For the time being, leaving the output unchanged so that
the refactoring has no effect on the generated files.
2016-01-22 14:14:47 +01:00
Behdad Esfahbod
59ee0618d7
[otlLib] Explicitly set Value to None if needed
...
Although the compiler (and now XML writer) assume None if an attribute
is not set, it's extremely frustrating for other code to have to check
before accessing an attribute. So, explicitly set please!
2016-01-22 13:43:05 +01:00
Sascha Brawer
1978194caf
[otlLib] Move building of LigatureAttach tables from feaLib to otlLib
2016-01-22 12:45:29 +01:00
Sascha Brawer
cf7c670e80
[otlLib] Move building of MarkBasePos from feaLib to otlLib
2016-01-22 11:53:34 +01:00
Sascha Brawer
50cbd5ca78
[otlLib] Move building of BaseArrays from feaLib to otlLib
2016-01-22 10:57:03 +01:00
Sascha Brawer
de24f4f0d4
[otlLib] Move building of BaseRecords from feaLib to otlLib
2016-01-21 17:23:36 +01:00
Sascha Brawer
08fa0f14dd
[otlLib] Move building of MarkArrays from feaLib to otlLib
2016-01-21 16:23:55 +01:00
Sascha Brawer
f09de4277d
[otlLib] Make otlLib compliant with PEP8
2016-01-21 15:23:41 +01:00
Sascha Brawer
f42d312580
[otlLib] Move building of ComponentRecords from feaLib to otlLib
2016-01-21 15:16:55 +01:00
Sascha Brawer
15ca8bb0a0
[otlLib] Move building of Mark2Records from feaLib to otlLib
2016-01-21 13:08:16 +01:00
Sascha Brawer
a4318a38c1
[otlLib] Build MarkRecords
2016-01-21 11:29:32 +01:00
Sascha Brawer
3c65e82307
[otlLib] Move building of otTables.Lookup from feaLib to otlLib
2016-01-20 19:25:41 +01:00