184 Commits

Author SHA1 Message Date
Simon Cozens
50e1105604 Parse Debg info in LookupList 2020-08-25 20:19:31 +01:00
Cosimo Lupo
5f18d9891c
rename BaseGlyphV1Array to BaseGlyphV1List
As suggested by Peter Constable in https://github.com/googlefonts/colr-gradients-spec/issues/14 and https://github.com/googlefonts/colr-gradients-spec/issues/18
2020-07-01 18:16:07 +01:00
Cosimo Lupo
c42c4162c2
add otConverter for namedtuples and use it for Variable{Scalar,Position,Distance}
in COLRv1 all scalar values have associated varIdx to support variations. I want to load them as
immutable namedtuples, and also I want to dump them as simple XML tags with 'value' and 'varIdx'
attributes, instead of normal otTables (i.e. with nested Value and VarIdx sub-elements) as
that would make them too verbose in the XML dump.
So I made a custom _NamedTupleConverter, as a base class for VariableScalar, etc.; sub-classes
must provide a tupleClass and a list of converterClasses for each namedtuple field.

The ExtendMode enum has also a custom converter to dump it as string in the XML, and load it
as IntEnum.

fixup
2020-03-06 18:35:32 +00:00
Cosimo Lupo
8e48c57a00
otTables: initialize a CountReference for LayerRecordCount in COLR.preWrite 2020-02-04 17:14:52 +00:00
Cosimo Lupo
145bcd62bd
otTables: add COLR subclass to decompile LayerRecordCount before the rest 2020-02-04 17:03:40 +00:00
Cosimo Lupo
504450e053
otTables: update MarkRecord.Class in splitMarkBasePos
Fixes https://github.com/googlefonts/noto-source/issues/145
2020-01-07 13:24:40 +00:00
Cosimo Lupo
ebadcd96e6
set pre-initialized CountReference in VarRegionList.preWrite with fvar.axisCount
so we can reuse CountReference class, as suggested in https://github.com/fonttools/fonttools/pull/1752#issuecomment-547113944

The patch is no shorter though.
2019-10-29 12:52:42 +00:00
Cosimo Lupo
e8f5bbcc6a
renamed LiteralCount to StaticCount
makes it clearer what it is
2019-10-24 15:42:09 +01:00
Cosimo Lupo
adc5b2997e
[otBase|otTables] enforce VarStore RegionAxisCount == fvar.AxisCount
even when there are no Regions and thus we can't take the length of VarRegionAxis array.
This is to appease older versions of OTS which blindly enforce this rule and
reject a VF that has, e.g., an empty HVAR table with no regions if the
HVAR.VarStore.VarRegionList.RegionAxisCount != fvar.AxisCount.

Fixes https://github.com/fonttools/fonttools/issues/1670

Related:
https://github.com/fonttools/fonttools/pull/1671
https://github.com/googlefonts/fontmake/issues/565
https://github.com/khaledhosny/ots/pull/192
2019-10-24 12:54:16 +01:00
David Corbett
bb51167fba Fix MultipleSubst subtable overflows 2019-08-24 13:29:53 -04:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
5a7fe0556f
otTables: set CompCount in LigatureSubst.fromXML
https://github.com/fonttools/fonttools/issues/1584#issuecomment-485140779
2019-04-20 17:45:38 +01:00
Miguel Sousa
ddff29cb5d Fix DeprecationWarning: invalid escape sequence 2019-04-01 14:04:14 -07:00
justvanrossum
26b986e7c9 removed unused import 2019-03-03 13:03:58 +01:00
justvanrossum
7c6239ac84 Changed map(operator...) into explicit for loop 2019-03-03 13:02:27 +01:00
Sascha Brawer
2011ccf6ec [morx] Clean up compilation of AAT action tables; add more tests 2018-09-24 20:15:54 +02:00
Sascha Brawer
4a1871ff62 [morx] Support AAT action type to insert glyphs 2018-09-24 18:14:01 +02:00
Behdad Esfahbod
05f95f0f58 [otBase] Try ExtensionLookup if other offset-overflow methods fail
If offset overflow happens other than between Lookup and SubTable, or
within SubTable, then we don't know how to fix it currently.  Now we
try to put that lookup in an Extension lookup anyway, since that will
isolate it and sharing with other lookups won't happen, hopefully
avoiding the overflow.

This is really a bandaid... What we want is the 99proof branch to
be finished and replace our current packing algorithm.

Fixes https://github.com/fonttools/fonttools/issues/1296
2018-07-25 11:06:44 -07:00
Cosimo Lupo
6e8e431dee
otTables: try to fix MarkBasePos subtable overflows
Fixes https://github.com/googlei18n/fontmake/issues/450
2018-07-19 17:52:00 +01:00
Cosimo Lupo
2798bf6d1f
otTables: print subtable type when can't split in fixSubTableOverFlows 2018-07-19 17:50:43 +01:00
Cosimo Lupo
dde854d285
Allow decompiling bad ClassDef tables with invalid format
Fixes https://github.com/fonttools/fonttools/issues/1235
2018-04-13 12:58:29 +02:00
Cosimo Lupo
6b6c34ab1a
otTables: fix IndexError while pruning of HVAR pre-write 2018-04-03 10:28:27 +01:00
Behdad Esfahbod
54fd71f73c [varLib/subset] Fix subsetting of GPOS variation data
Was not picking up ValueRecord Device objects. Ouch!
2018-02-27 18:52:07 -08:00
Behdad Esfahbod
38a0ffb815 Accept old version of HVAR XML
21cbab8ce9 (commitcomment-27649836)
2018-02-20 17:42:49 -08:00
Behdad Esfahbod
ef5c9cb2ab Fix pruning of HVAR pre-write 2018-02-18 22:59:43 -08:00
Behdad Esfahbod
21cbab8ce9 Fix read/write of VarIdxMap to use glyph names
Was relying on glyph IDs. Ouch.
2018-02-18 22:33:32 -08:00
Behdad Esfahbod
1aafae816d Allow decompiling fonts with bad Coverage format number 2017-12-14 19:03:54 -08:00
Sascha Brawer
d54f14e0a2 [morx] Cosmetic renaming of ligAction to action
Beyond composing ligatures, AAT finite-state transducers can also
execute insertion actions without rewriting existing glyphs. The
corresponding actions have almost the same structure as ligature
actions, so we can share a lot of the plumbing within fonttools.

This renaming is in preparation of a larger change to support `morx`
ables with insertions.
2017-10-31 16:25:41 +01:00
Sascha Brawer
5f03a64a57 [morx] Implement InsertionMorphAction 2017-10-31 14:34:12 +01:00
Sascha Brawer
86454e79de [morx] Compile ligature actions subtable for AAT ligatures
Tests fail because other subtables still need to be implemented.
2017-10-25 15:35:56 +02:00
Sascha Brawer
d373808341 [AAT] Decode the morx ligature actions table 2017-10-25 15:35:56 +02:00
Sascha Brawer
a7ddb0b609 [AAT] Decode morx tables with ligature substitutions
Only handling those parts that are shared with other substitution types.
The actualy ligature actions are not implemented yet.
2017-10-25 15:35:56 +02:00
Sascha Brawer
ee1662e57e [AAT] Support morx tables with contextual substitution 2017-09-05 23:01:21 +02:00
Sascha Brawer
31b02d0bed [AAT] Support morx tables with Rearrangement subtables 2017-09-04 21:26:53 +02:00
Sascha Brawer
90f257cc60 [AAT] Support mort and morx tables with non-contextual substitutions
Other metamorphosis types are not yet supported and will raise an error
upon decompilation. The TTX tool catches the error and continues to emit
a hexdump of the table contents, just as before this change.
2017-08-30 14:46:34 +02:00
Sascha Brawer
f56b71937d Add missing parts from morx branch
After this change, the `morx` table in Zapfino.ttf can be ttx'ed again.
2017-08-14 21:34:15 +02:00
Behdad Esfahbod
e5a9fd7faa [otTables] When splitting PairPos subtable, don't set class=0
Doesn't matter when compiling to binary, but makes Python objects cleaner.
2017-04-06 15:34:00 +02:00
Cosimo Lupo
23511fd302
[varLib.merger] set ClassDef{1,2}.Format using same logic as otTables.ClassDef.preWrite 2017-03-14 16:14:08 +00:00
Cosimo Lupo
7562115fc4
move calculation of NumShorts from otTables to varLib.builder 2017-03-01 17:27:41 +00:00
Sascha Brawer
706858646a Preserve ordering of glyph alternates when round-tripping through TTX
Also fixes a bug where glyph alternates in MTI feature files were
wrongly sorted by glyph name. After this change, the output is using
the same ordering as in the input MTI feature file.

Fixes https://github.com/fonttools/fonttools/issues/833.
2017-02-11 17:08:56 +01:00
Behdad Esfahbod
e45297bf4b Populate defaults even for tables that have postRead
Implement custom populateDefaults for them.
2017-02-03 14:33:57 -08:00
Behdad Esfahbod
b887860b65 Fix compiling of MultipleSubstFormat1 with zero out glyphs
str.split('') returns [''], whereas we expect [].
Fix that.
2017-02-02 15:49:09 -08:00
Behdad Esfahbod
3e5335d335 When promoting a lookup to Extension type, set LookupType
Fixes https://github.com/fonttools/fonttools/issues/798
2017-01-09 19:52:32 -08:00
Behdad Esfahbod
aeafda539b Oops! 2017-01-09 00:38:46 -08:00
Behdad Esfahbod
e4d88b5a38 Extra protection
Fixes https://github.com/fonttools/fonttools/issues/797
Although for the XML->binary case, that bug was already fixed
on master because of the XML populate-default changes.
This adds extra protection!
2017-01-08 23:47:29 -08:00
Behdad Esfahbod
2d3610bb6b Ignore class=0 when reading & writing ClassDef objects
class=0 items might be added as an optimization.  They have no semantic value.
Ignore them.

Fixes the last of mtiLib tests.
2016-12-26 17:26:14 -05:00
Behdad Esfahbod
904b1c5942 Support splitting PairPosFormat1 tables
Fixes https://github.com/googlei18n/fontmake/issues/143
2016-11-01 18:15:21 -07:00
Behdad Esfahbod
fb22f64ab1 [varLib] Add TODO item 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
caa353d5dd [varStore] Generate variation for Anchors and store in GDEF
Finally!  Phew...
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
687c2c1812 [varLib] Build indirect advance-width in HVAR
Fixes VarIdxMap implementation as well.
2016-09-27 19:49:41 +02:00