201 Commits

Author SHA1 Message Date
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
45fa26b28c Set propagated counts while reading XML
Now reading XML and immediately writing it back to XML should be fully
supported and generate the same XML.

Code is a bit hacky (we don't have the reader object, so abuse font for
passing state down tree...).
2017-01-02 23:23:44 -05:00
Behdad Esfahbod
1eb8afbfa3 When reading from XML, populate all members that are computed
Not really all... Propagated counts are still not populated.
Most of mti_tests pass again.  Four failing now.

NB: In the code being removed in this commit, this line:

"setattr(self, conv.repeat, len(seq)+conv.aux)"

had the wrong sign for conv.aux.  Should have been a minus.
2017-01-02 23:23:44 -05:00
Behdad Esfahbod
495c6831e1 Don't ignore Lookup.LookupType
A while back I changed code such that Lookup.LookupType is written as a
comment in XML, and ignored when compiling.  The LookupType from type
of actual subtables in a lookup were used during compilation instead.
This caused the problem where an empty lookup (one with no subtables)
would lose its lookup types, among other subtle problems.

With this change we revert above behavior, but keep the benefits: if
Lookup.LookupType is different from actual lookup type of the subtables,
compilation raises an exception.  Setting LookupType on Lookup object
or in XML is optional now, but written out by default in XML (instead
of as a comment).

This changes XML output for all GSUB/GPOS tables.  I'm sorry for the
noise.  Please update your sources.

Fixes https://github.com/fonttools/fonttools/issues/789
2016-12-28 20:11:57 -05:00
Behdad Esfahbod
293ede97a3 Try to set Count variables when importing XML
This does it for the simple cases, but not propagated ones.

Also, when writing to XML, if a Count or otherwise-computed value is
not set, don't write it out.
2016-12-28 16:45:24 -05:00
Behdad Esfahbod
d9e915c925 Fix compile of MVAR and STAT tables 2016-12-19 18:21:11 -06:00
Behdad Esfahbod
b4d53811e9 Implement MVAR table 2016-12-18 21:55:45 -06:00
Sascha Brawer
84da076bb9 [STAT] Fix one test case 2016-12-02 14:54:03 -08:00
Behdad Esfahbod
d80bb58723 More STAT 2016-12-02 14:14:48 -08:00
Behdad Esfahbod
913b3c477c Finish STAT table
Test needs fix.
2016-12-02 14:06:13 -08:00
Sascha Brawer
59368c424a WIP: Implement STAT table 2016-12-02 13:37:42 -08:00
moyogo
6e85a6c4fb otConverters: use fixedTools fixedToVersion() and versionToFixed() 2016-10-18 18:18:09 +02:00
Sascha Brawer
0588502771 Add otConverters.NameID (#708)
When writing XML, this produces a comment with the English name.
If the name ID is missing from the name table, it logs a warning.
2016-10-14 21:04:35 +02:00
Behdad Esfahbod
402d726692 [ot] Change Version to be an integer instead of float
API Change:
This will change XML output for GSUB/GPOS/GDEF/MATH/BASE/JSTF/...
Scripts that set the Version for those to 1.0 or other float values
also need fixing.  A warning is emitted when code or XML needs fix.
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
0c577bb7da [ot] Add support for long counts 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
846d969209 [varLib] Remove unused VarAxisID 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
47a7dde070 [varLib] Make VarData.NumShorts automatic 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
f11414c93b [varLib] Implement new VarData, aka. ItemVariationData, table 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
38c88f6996 [varLib] Rename VarTuple to VarRegion 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
35a401f04d [varLib] Add support for VarIdxMap, aka. DeltaSetIndexMap.
Update HVAR / VVAR to latest draft.
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
a174aa76af [ot] Implement template converters
Eg. "OffsetTo(TypeName)"
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
c1717224da [varLib] Generate direct HVAR 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
e2da17e032 [opentype-gx/varLib] More work towards VariationStore
And HVAR/VVAR tables.
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
4d7b5f6472 [varLib] Start implementing VariationStore 2016-09-27 19:49:41 +02:00
Behdad Esfahbod
1085d8973d [ot] Minor 2016-02-10 17:28:56 +07:00
Cosimo Lupo
6f8e1502ff [otConverters] replace print with logger 2016-01-27 19:02:48 +00:00
Behdad Esfahbod
e0d27461be [XML] Assume None where an attribute is missing
This is what the compile() does, so do the same in toXML(), such that
we can save to XML whatever can be saved to binary.  Eg. saving what
we read through XML!

Fixes https://github.com/behdad/fonttools/issues/298
Also relevant to https://github.com/behdad/fonttools/issues/447
2016-01-13 19:05:45 +00:00
Behdad Esfahbod
f0eb7e98ca [otTables] Don't create a subclass for equivalent types
Before, equivalent types, eg. otTables.BacktrackCoverage, etc,
where a subclass of their equivalent parent type, eg. otTables.Coverage
With this change, they are the same type.

The otBase and otConverters changes were needed to make the above
happen and still generate correct XML for SubTable type.
2016-01-13 16:44:52 +00:00
Sascha Brawer
582852119c Implement OTTableReader.readUShortArray()
There is currently only one single call site in the codebase,
but this function will be needed a lot for parsing `morx` and
other AAT tables.
2015-10-17 06:47:52 +02:00
Sascha Brawer
520918375f [otTables] Support uint8 type in otTables 2015-10-16 00:17:22 +02:00
Cosimo Lupo
df06ce4981 [otConverters] use enumerate in writeArray, as sets don't support indexing
the feaLib parser returns glyph classes as set objects
2015-09-09 18:16:44 +01:00
Behdad Esfahbod
c7187c3b20 Optimize reading array of GlyphIDs 2015-07-03 01:15:16 -07:00
Behdad Esfahbod
7d38ebb143 Minor 2015-07-03 01:01:10 -07:00
Behdad Esfahbod
0097e40ced Minor 2015-07-03 00:55:54 -07:00
Behdad Esfahbod
089241a587 Minor 2015-07-03 00:53:15 -07:00
Behdad Esfahbod
a7e9d634d7 Minor 2015-07-03 00:50:34 -07:00
Behdad Esfahbod
1fbbbdd358 Micro-optimization for previous commit 2015-07-03 00:49:28 -07:00
Behdad Esfahbod
754a20d987 Implement lazy array for loading otData-driven arrays
Speeds up subsetting of GPOS table with many pairs by huge factor
(counted 5).
2015-07-02 18:00:41 -07:00
Behdad Esfahbod
92093990cc [ot] Minor 2015-07-02 15:01:20 -07:00
Behdad Esfahbod
aa9b3b6d43 [ot] Add readArray() and writeArray()
To be used soon to optimize partial / glyph array loading.
2015-07-02 15:01:15 -07:00
Behdad Esfahbod
f588727554 Fixup; ouch! 2015-04-26 02:06:36 -04:00
Behdad Esfahbod
b30e12ae00 More whitespace 2015-04-26 02:01:01 -04:00
Behdad Esfahbod
bd67253118 Some more whitespace fixes from pep8 tool 2015-04-26 01:59:01 -04:00
Behdad Esfahbod
b9ac90a8f9 [GX] Add 'fvar' table support
I might change the table format in the future, but it's functional now.
2015-03-11 15:29:35 -07:00
Behdad Esfahbod
730bedd3d1 [AAT] Add support for 'feat' table
Reusing the otData machinery.

See discussion at:
https://github.com/behdad/fonttools/issues/178
https://github.com/behdad/fonttools/pull/180
2014-09-30 19:04:16 -04:00
Behdad Esfahbod
5dd64deacb [otData] add ULong types
In preparation for implementing AAT tables (slowly).
2014-09-30 18:55:57 -04:00
Behdad Esfahbod
d65b587708 Minor 2014-06-05 17:58:15 -04:00
Behdad Esfahbod
1ae29591ef from __future__ import absolute_import
Such that our Python 2 is closer to Python 3.

Part of https://github.com/behdad/fonttools/issues/77
2014-01-14 15:07:50 +08:00
Behdad Esfahbod
6ed2eb4092 Write LookupType as a comment
We compute LookupType from the type of the subtables, so write it out
as an informative comment in XML as opposed to an element.
2013-12-17 02:57:29 -05:00
Behdad Esfahbod
5fec22bfcd Compute correct LookupType when compiling font
Also ensures that all subtables of a lookup have the same
lookup type.
2013-12-17 02:42:18 -05:00