214 Commits

Author SHA1 Message Date
Khaled Hosny
d24fd71934 [feaLib] Fix building chained alt substitutions
Support was added in db49f20d6b2629e1ba25c4afd3fb60817387f3d6, but there
was only a parser test and no builder test, fix the build and add a
builder test based on the existing parser one.

Fixes https://github.com/fonttools/fonttools/issues/1901
2020-04-28 14:29:50 +02:00
Khaled Hosny
e0c49a1d4a [feaLib] Improve exception message 2020-04-27 18:13:18 +02:00
Khaled Hosny
4526e164f1 [feaLib] Check lookup index in chaining lookups
Raise if lookup_index is None, which would happen only of the lookup
referenced belongs to the wrong table. The error message needs to be less
cryptic, though.

Fixes https://github.com/fonttools/fonttools/issues/1896
2020-04-27 02:39:33 +02:00
Khaled Hosny
259e586f5d [feaLib] Ignore superfluous script statements
Setting script that is the same as current language system should make
no effect. This is not documented in the spec, but it is what makeotf
does. This as the effect of preserving lookupflag when set before such a
script statement.

Fixes https://github.com/fonttools/fonttools/issues/1824
2020-04-20 23:45:45 +02:00
Khaled Hosny
6a24c8fed1 [feaLib] Raise for script/language in standalone lookup
They are not allowed per spec and makeotf, but currently we would fail
later with some cryptic error message.
2020-04-20 23:09:53 +02:00
Cosimo Lupo
5777c2e057
feaLib.builder: skip getAlternateGlyphs if lookup is None in ChainContextSubstBuilder
Fixes https://github.com/googlefonts/fontmake/issues/648
2020-04-17 17:22:45 +01:00
Khaled Hosny
014991d710
Merge pull request #1815 from khaledhosny/fealib-flag-fix
[feaLib] Don’t reset lookupflag in nested lookups
2020-01-30 13:06:42 +02:00
Khaled Hosny
eed252cb92 [feaLib] Don’t reset lookupflag in nested lookups
In makeotf, lookups defined inside feature blocks inherit the current
lookupflag of the feature, so don’t reset the lookupflag for such
lookups.
2020-01-29 23:46:40 +02:00
David Corbett
62ed43ddb9 Do not fail on duplicate multiple substitutions 2020-01-26 10:30:17 -05:00
Jens Kutilek
864945df0b Change log call 2019-12-18 14:12:02 +01:00
Jens Kutilek
b858f7bb3e Change log message, remove comments 2019-12-18 10:03:08 +01:00
Jens Kutilek
9c6b7d2e7a Log warning instead of raising an error when identical substitutions are added again 2019-12-02 17:05:59 +01:00
Khaled Hosny
b99ae0d469 [feaLib] Fix handing of duplicate LigatureCaret
The spec has been updated for a while to allow only one rule per glyph,
and makeotf uses the first and ignores the rest.

See https://github.com/adobe-type-tools/afdko/issues/95, and
https://github.com/adobe-type-tools/afdko/issues/155
2019-09-26 16:44:46 +02:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01: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
Cosimo Lupo
abae80d730 [feaLib] make 'forceChain' an optional kwarg for barkward compat
See discussion at:
https://github.com/fonttools/fonttools/pull/1511#issuecomment-472425283
2019-03-13 15:11:53 +00:00
justvanrossum
723e7a1d3c updated inline github issue URLs 2019-03-06 16:01:28 +01:00
Khaled Hosny
c82fb8fa13 [feaLib] Support Python < 3.5 in previous commits 2019-03-01 01:48:48 +02:00
Khaled Hosny
7d03e93e67 [feaLib] Make unsupported "subtable" a warning
AFDKO’s makeotf warns and ignores the statement, so do the same. I’m
abusing FeatureLibError() as a lazy way to keep reporting the location.
2019-03-01 01:48:48 +02:00
Khaled Hosny
10cad7be3a [feaLib] Refactor almost duplicated subtable code
Also make the code a little less ugly.
2019-03-01 01:48:48 +02:00
Khaled Hosny
226f5518b7 [feaLib] "subtable" in single substitutions 2019-03-01 01:48:48 +02:00
Khaled Hosny
3be73365a5 [feaLib] Reverse chain need not handle subtable 2019-03-01 01:48:48 +02:00
Khaled Hosny
d9893ab05a [feaLib] "subtable" in multiple substitutions 2019-03-01 01:48:48 +02:00
Khaled Hosny
c87e5cf4ad [feaLib] "subtable" in alternate lookups 2019-03-01 01:48:48 +02:00
Khaled Hosny
7454a3eb48 [feaLib] "subtable" in ligature lookups 2019-03-01 01:48:48 +02:00
Khaled Hosny
cc1b6baff7 [feaLib] "subtable" in contextual positioning 2019-03-01 01:48:48 +02:00
Khaled Hosny
47d30499a5 [feaLib] "subtable" in contextual substitution 2019-03-01 01:48:48 +02:00
Khaled Hosny
6bb0545655 [feaLib] Don’t hard-code "subtable" support
Allow for making more lookups support subtabe breaks. Although AFDKO’s
makeotf supports subtable breaks only in pair pos lookups, I believe
that is an implementation limit that we don’t have to follow; all
OpenType lookups has subtables and it should be possible to code that in
the feature files.
2019-03-01 01:48:48 +02:00
Khaled Hosny
1a0aec4c56 [feaLib] Add forceChain to MultipleSubstStatement
For consistency with other substitution statements.
2019-02-19 18:59:58 +02:00
Cosimo Lupo
23f0b5f5b1
[feaLib.builder] do not make <NULL> ValueRecord 2019-01-19 12:11:14 +00:00
Khaled Hosny
baf4f560bb [feaLib] Skip noop class PairPos subtables
If Coverage is None then the subtable is a noop that does nothing and
there is no point in building it. As a bonus, it makes OTS happy since
it will reject subtables where coverageOffset is NULL (0) and the spec
does not say whether this is allowed or not.
2018-09-16 12:23:34 +02:00
Cosimo Lupo
9536541aba
feaLib: demote warning about redefined kern pairs to debug message
https://github.com/fonttools/fonttools/issues/1147#issuecomment-421539956
2018-09-15 10:09:49 +02:00
Martin Hosken
59a4e934ee Get the fix we want 2018-09-07 15:37:33 +07:00
Martin Hosken
0902cea8b6 Fix default lookups for a language 2018-08-17 10:32:55 +07:00
Cosimo Lupo
83f9156f8d
Merge pull request #1302 from moyogo/fix-subtable-break
Fix subtable break
2018-07-26 11:16:58 +01:00
Denis Moyogo Jacquerye
18ad93fb41 feaLib: reset forceSubtableBreak_ to False 2018-07-26 11:06:24 +01:00
Cosimo Lupo
68951b7c3d
feaLib: when name table not selected, skip building featureNames blocks
ufo2ft feature writer calls feaLib builder with tables=[GSUB] first, to run closure
over glyph substitutions; if the GSUB features contains 'featureNames' blocks, then
an AssertionError will be raised; in this case, we can simply skip building the
FeatureParams tables as we haven't build the name records they point to.
2018-07-26 10:51:37 +01:00
Cosimo Lupo
9456ae9485
feaLib: support explicit 'subtable' statements in PairPos lookups
Fixes https://github.com/fonttools/fonttools/issues/1279
2018-07-24 17:13:52 +01:00
Cosimo Lupo
d3229d5777
feaLib: ensure languagesystems using 'DFLT' script tag precede all others
https://github.com/fonttools/fonttools/pull/1292#issuecomment-407427544

this is to match makeotf's behavior

https://github.com/adobe-type-tools/afdko/pull/498/files#diff-17824930b3cdfb707ae56e1f42bccec6R2305
2018-07-24 16:17:23 +01:00
Martin Hosken
d5a1e5257e Simplify code for language statement 2018-07-09 21:10:46 +01:00
Martin Hosken
d76f447775 More depths to allowing languages in DFLT 2018-07-09 16:41:54 +01:00
Martin Hosken
1ae0bf87a0 Allow any languages under DFLT script 2018-06-20 09:42:46 +01:00
Miguel Sousa
ce5cebfef2
[feaLib] Use tuple for dict key
https://github.com/fonttools/fonttools/pull/1169#discussion_r170218517
2018-03-01 10:25:24 +00:00
Miguel Sousa
d0fd2759d4
[feaLib] Build cvParameters block 2018-03-01 10:25:23 +00:00
Miguel Sousa
7bad066995
[feaLib] Simplify builder.add_featureName() 2018-03-01 10:22:09 +00:00
Cosimo Lupo
bdc82fb7f5
feaLib: LookupListIndex must be list, not tuple
all otData arrays are decompiled as lists (see otConverters.BaseConverter.readArray).
If one tries to call the subsetter on a GSUB table that was not read from file
but was just built from feaLib, it crases with a TypeError because it's expecting
list but finds tuples.

Traceback (most recent call last):
  File /home/clupo/Github/fonttools/Lib/fontTools/subset/__init__.py, line 1462, in prune_lookups
    lookup_indices = self.table.FeatureList.collect_lookups(feature_indices)
  File /home/clupo/Github/fonttools/Lib/fontTools/subset/__init__.py, line 1263, in collect_lookups
    if i < self.FeatureCount), [])
TypeError: can only concatenate list (not tuple) to list
2018-01-25 12:35:17 -08:00
Cosimo Lupo
241384ab21
[feaLib] allow to build from pre-parsed ast.FeatureFile object 2018-01-25 09:53:42 -08:00
Cosimo Lupo
803530b281
[feaLib] assert all requested tables are supported
better than just warn
2018-01-24 15:07:34 -08:00
Cosimo Lupo
b2da85cffd
[feaLib] add tables argument to only build some tables (e.g. GSUB)
`tables=None` by default will build all supported tables;
To build only some of these and ignore the others, one can pass a
subset of supported tables tags: .e.g. `tables={'GSUB'}` will only
build the GSUB, even if the feature file may contain e.g. GPOS
related features.
2018-01-24 15:07:34 -08:00
Cosimo Lupo
95030cb788
minor: unused variables 2018-01-15 19:50:34 +00:00