134 Commits

Author SHA1 Message Date
Behdad Esfahbod
32bd6bcc31 [varLib] Add optimizeVarData()
Though not really effective right now since we don't split into
multiple VarData sets.
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
35a401f04d [varLib] Add support for VarIdxMap, aka. DeltaSetIndexMap.
Update HVAR / VVAR to latest draft.
2016-09-27 19:49:41 +02:00
Behdad Esfahbod
e9fb97d858 Fix overflow-fixing of Extension subtables
Fixes https://github.com/behdad/fonttools/issues/574
This was broken by 319643ad.  Ouch!
Was quite a debugging session to pin it down.
2016-07-12 23:55:47 -07:00
Behdad Esfahbod
c794ff85d6 Fix typo in comments 2016-06-06 22:06:33 -07:00
justvanrossum
123d7c10b6 Found a font that has an empty SingleSubst mapping. While that's silly, it's not necessarily illegal. FontTools, however, would crash with an AssertionError upon compilation. Fixed. 2016-05-28 22:20:31 +09:00
Behdad Esfahbod
c4fe9c7c57 Before splitting subtables when overflow happens, try disabling table sharing
More bandaid for https://github.com/behdad/fonttools/issues/537
2016-04-13 16:34:14 -07:00
Behdad Esfahbod
4268e6345d Fix splitPairPos for TTFont loaded from XML
When loading from XML count variables are missing...

Fixes https://github.com/behdad/fonttools/issues/537#issuecomment-207849194
2016-04-13 16:17:05 -07:00
Behdad Esfahbod
c6facc99df When splitting a large class-kerning table, mark the old subtable as DontShare
Fixes https://github.com/behdad/fonttools/issues/537#issuecomment-196047070
2016-04-09 13:06:16 -07:00
justvanrossum
ad386ee477 Keep Format attribute for OT subtables. This value may be ignored by the compiler but is useful for debugging. Part of fixing #92. 2016-03-21 12:12:05 +01:00
Behdad Esfahbod
c1080d9796 Implement splitting PairPosFormat2 in case of overflow
Part of fixing https://github.com/behdad/fonttools/issues/537
2016-03-12 18:17:37 -08:00
Behdad Esfahbod
d87d6aa39e [ot] Make sure GSUB/GPOS top arrays don't share bytes
Fixes https://github.com/behdad/fonttools/issues/518
Fixes https://github.com/behdad/fonttools/issues/372
2016-02-10 18:00:48 +07:00
Cosimo Lupo
af91f9e791 [otTables] replace warnings with logger 2016-01-27 19:02:48 +00:00
Behdad Esfahbod
501480fa70 Revert "[ot] Instead of deleting unnecessary Format, set it to None"
This reverts commit 6851f66d1810a4d3f484f2a82e39960e1a677f42.

See https://github.com/typesupply/compositor/issues/7
Fixes https://github.com/behdad/fonttools/issues/475
2016-01-22 14:03:23 +01:00
Behdad Esfahbod
8a17e925bf Revert "[ot] Deprecate, and add properties for, count values"
This reverts commit d8803873f6d4efbcb227867fe0ac6bca370597bc.

The commit wasn't fully correct as it was not installing properties
for counts in format-switching subtables.
2016-01-14 12:55:42 +00:00
Behdad Esfahbod
d8803873f6 [ot] Deprecate, and add properties for, count values
Part of fixing https://github.com/behdad/fonttools/issues/447

Our own modules still set the counts.  Will fix in subsequent
commits.
2016-01-14 12:33:09 +00:00
Behdad Esfahbod
6851f66d18 [ot] Instead of deleting unnecessary Format, set it to None
Fixes https://github.com/typesupply/compositor/issues/7
2016-01-14 10:47:48 +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
Behdad Esfahbod
c65c16d3f6 Fix previous commit
Humm, no idea how I had committed it locally before.
2015-12-07 12:05:24 +01:00
Behdad Esfahbod
5a08924075 Add high-level API for LigatureSubst
Ala MultipleSubst and AlternateSubst.  For now, just support compiling it.
2015-12-07 12:01:42 +01:00
Behdad Esfahbod
d6e186d40f Simplify AlternateSubst slightly 2015-10-27 14:11:04 -07:00
Sascha Brawer
b5e29cca9a [GSUB] Parse old-syntax MultipleSubst that has no index attribute
Apparently, earlier versions of TTX had produced XML whose
MultipleSubst.Sequence element came without an index attribute.
Resolves https://github.com/behdad/fonttools/issues/385
2015-10-13 17:44:53 +02:00
Cosimo Lupo
258bd6d8f3 [otTables] skip if element is not tuple when parsing MultipleSubst XML
the content of XML elements can be strings as well as (name, attrs, content)
tuples, so we can't use list comprehension here
2015-09-11 11:41:14 +01:00
Sascha Brawer
96da5a0f71 Support TTX format for MultipleSubst of FontTools 3.0 and earlier
Fix a backwards compatibility problem introduced by
1356a6775b
(pull request https://github.com/behdad/fonttools/pull/364), where new versions
of FontTools would not be able to process `<MultipleSubst>` elements
in TTX files generated by older FontTools releases.

Resolves https://github.com/behdad/fonttools/issues/355.
2015-09-11 08:19:20 +02:00
Sascha Brawer
1356a6775b [otTables] Simplify API for MultipleSubst
Resolves https://github.com/behdad/fonttools/issues/355

For making sure that `pyftsubset` still works after this change,
I have done the following steps:

* invoked Adobe's `makeotf` tool to build a custom font with a
  MultipleSubst lookup. This lookup decomposes two two ligatures,
  `c_t` and `f_f_i`, into their respective components.

* invoked the `pyftsubset` tool to produce a subset font with just
  the `c_t` ligature;

* checked with `ttx` that the newly produced subset font contains
  the requested `c_t` ligature and its components `c` and `t`,
  but does not contain not any of `f_f_i`, `f`, or `i`.
2015-09-10 14:56:07 +02:00
Sascha Brawer
f38cc9f821 Write XML for alternate glyphs (GSUB lookup type 3) in deterministic order
Before this change, the XML output for GSUB lookups of type 3
was not deterministic; multiple runs of TTX on the same font
could therefore emit the alternates in a different order.

Since alternate glyphs are sets, this change makes no semantic
difference to the output. However, a deterministic ordering
is needed for tests that compare GSUB tables in TTX format.
2015-09-07 11:21:17 +02: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
108c5853ea Fixup 6c83fe4846c711123c38654e5eb83d0a595d56ea
Ouch!
2015-06-12 15:04:37 -07:00
Behdad Esfahbod
6c83fe4846 Really fix SingleSubst delta math
I had broken this in e06166b83aa82582dab2e011520b1a77f72aa9f9.

Fix that, and other issues.  Since I made that last commit, it has
become clear that SingleSubst works by adding delta and then doing
module 65536.

HarfBuzz was updated for this in 2011:
commit 52ebdff49d13f239efc886de935d47be9860f6e5
Author: Behdad Esfahbod <behdad@behdad.org>
Date:   Tue Sep 27 12:38:16 2011 -0400

    Fix GSUB lookuptype 1 subtype 1 delta wrapping
2015-06-12 10:27:04 -07: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
ced737e249 Allow ligatures with one component only 2014-06-05 17:03:31 -04:00
Behdad Esfahbod
319643ade2 Fix up regression in promoting lookups to extensions
Was broken by 6ed2eb409231a7fe3e0c2a135f9a89796206f639

Fixes https://github.com/behdad/fonttools/issues/110
2014-02-20 16:31:15 -05: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
f6502635b9 Minor 2013-12-17 05:59:05 -05:00
Behdad Esfahbod
e93e29125f Don't write Format for Coverage, ClassDef, Single/Alternate/LigatureSubst
The format values for those are automatically handled in
postRead/preWrite to choose optimal format.  As such, don't write them
in XML.  Reduces noise.

Part of https://github.com/behdad/fonttools/issues/73
2013-12-17 03:06:10 -05:00
Behdad Esfahbod
ea82d6dfd1 Handle NULL coverage table in ligature substitute
Just to be in line with Single and Alternate subst.
2013-12-17 01:58:26 -05:00
Behdad Esfahbod
f952a22af7 Implement MATH table
Fixes https://github.com/behdad/fonttools/issues/67
2013-12-09 00:40:48 -05:00
Behdad Esfahbod
d76fa68785 Allow specifying table type as converter
Needed for upcoming MATH table.
2013-12-09 00:40:24 -05:00
Behdad Esfahbod
b23b4cefda Fix ClassDef
Ouch.  Broke it in 63b257e677993295ee015e02b92ff438a5e91135.
2013-12-07 12:45:28 -05:00
Behdad Esfahbod
650a38fffc Relax some warnings 2013-12-04 22:52:57 -05:00
Behdad Esfahbod
e06166b83a Fix SingleSubstFormat1 modulo math 2013-12-04 22:46:11 -05:00
Behdad Esfahbod
9a980a8d2d Minor 2013-12-04 22:00:31 -05:00
Behdad Esfahbod
43f6e36347 Simplify Coverage table postRead 2013-12-04 21:54:12 -05:00
Behdad Esfahbod
63b257e677 Handle out-of-range glyphIDs in ClassDef 2013-12-04 21:49:00 -05:00
Behdad Esfahbod
dc87372c88 Use True/False instead of 1/0 2013-12-04 21:28:50 -05:00
Behdad Esfahbod
9e6ef94b55 Use "is None" instead of "== None"
The latter hits the __eq__ method and can fail because we now
do not allow comparing objects of different types.

For example, was failing subsetting Andika-R.ttf.
2013-12-04 16:35:10 -05:00
Behdad Esfahbod
83e2f34194 Implement compiling to ClassDef Format=1 2013-12-02 03:06:44 -05:00
Behdad Esfahbod
b7fd2e1913 py23 Remove uses of __cmp__ and cmp() 2013-11-28 17:32:42 -05:00
Behdad Esfahbod
32c10eecff py23 from __future__ import division and adjust divisions 2013-11-28 17:32:42 -05:00