Khaled Hosny
7db9ba6ef6
[feaLib] Allow anonymous glyphclass in LookupFlags
...
Almost everywhere else when a glyph class name is accepted, anonymous
glyph classes are also accepted. This is rather inconsistent and
inconvenient.
2020-08-07 19:57:31 +02:00
Simon Cozens
0b39745890
Restore test for chaining version
2020-07-11 19:56:29 +01:00
Simon Cozens
7db13c9872
Fixup test expectations
2020-07-07 13:24:41 +01:00
Simon Cozens
e8798059f2
Rename test
2020-07-07 13:20:57 +01:00
Simon Cozens
2cf9f681a2
Fix test expectation. Test is now badly named.
2020-07-07 13:19:50 +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
Nikolaus Waxweiler
fe17d5937a
[feaLib] Builder.build(): proper error msg on unsupported tables ( #1976 )
...
Raise NotImplementedError instead of an assertion error.
2020-05-29 16:44:19 +01:00
Nikolaus Waxweiler
0e7a4460f3
[feaLib] Introduce includeDir on Parser and IncludingLexer ( #1973 )
...
This makes the directory to search for included files explicit.
Also use Python 3's FileNotFoundError to catch non-existant files instead of a workaround for Python 2.
2020-05-28 17:43:19 +01:00
Simon Cozens
b299bfb389
[feaLib] Support multiple lookups per glyph position ( #1905 )
...
This allows for more than one "lookup ..." chaining statements at each glyph position in a chaining contextual substitution or positioning rule: e.g.
sub a b c' lookup lookup1 lookup lookup2 d;
The corresponding change in the Adobe OpenType Feature File Specification (and implementation in makeotf) happened in adobe-type-tools/afdko#1132 .
2020-05-12 06:28:25 +01:00
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
f6cbc45a6a
add test files triggering the AttributeError: 'NoneType' object has no attribute 'getAlternateGlyphs'
...
https://github.com/googlefonts/fontmake/issues/648
2020-04-17 17:12:00 +01:00
Cosimo Lupo
1cbb28acd8
Merge pull request #1870 from anthrotype/fealib-parser-no-glyphnames
...
feaLib: without glyphNames, warn but don't parse hyphens as ranges
2020-04-16 16:16:29 +01:00
Tom
c70395fbdb
[feaLib] Raise exception when GSUB statement doesn't match a rule. ( #1876 )
...
* [feaLib] Raise exception when substitute statement doesnt match any of the rules. Add tests that trigger said exception.
2020-04-16 16:10:03 +01:00
David Corbett
c97956672e
[feaLib] Emit CID ranges with CIDs not glyph names
2020-04-03 19:40:22 -04:00
David Corbett
ec4273bbfd
[feaLib] Emit spaces around hyphens in ranges
2020-04-03 17:36:34 -04:00
Cosimo Lupo
c1af75b803
feaLib.parser: check that glyph name is actually ambiguous
...
https://github.com/fonttools/fonttools/pull/1870#discussion_r403259450
2020-04-03 21:17:02 +01:00
Cosimo Lupo
a913431ecd
feaLib.parser: if no glyphNames, treat dash as names, not ranges
...
But print a warning about the possible ambiguity.
Fixes https://github.com/fonttools/fonttools/issues/1768
2020-04-03 12:42:22 +01:00
Cosimo Lupo
be77f3eeab
feaLib/parser_test: rename {Unicode,String}IO, remove misc.py23
2020-04-03 11:46:36 +01:00
Simon Cozens
8fac69b0ea
Also output mark attachment class
2020-03-11 13:59:05 +00:00
Simon Cozens
d6d21e067d
Someone wrote more tests while I wasn't looking
2020-03-10 21:48:45 +00:00
Simon Cozens
ab075a9957
Annotate LookupFlag ttx dump
2020-03-10 21:42:28 +00:00
Nikolaus Waxweiler
36c64087a8
Add a proper message to IncludedFeaNotFound
...
Also, minor f-string refactor.
2020-02-27 18:13:45 +00:00
Nikolaus Waxweiler
5cda8381f9
[feaLib] Check that glyph names referenced in the feature file are part of the glyph set ( #1828 )
...
This checks that glyph names that appear in a feature file are actually
in the glyph set provided in glyphNames. If the set is empty, no check
is done. This preempts a KeyError later during saving of a TTFont object
and makes this case much more easily catchable.
Closes #1723 .
2020-02-13 14:47:29 +00:00
Nikolaus Waxweiler
ef2742593c
Compare realpath against realpath
...
On Windows, tests may be run in the user's temp directory, so the previous code
may compare C:\Users\nikolaus.waxweiler\ against C:\Users\NIKOLA~1.WAX\.
2020-02-04 11:08:45 +00: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
42b51f084f
Merge pull request #1814 from khaledhosny/fealib-mult-fix
...
[feaLib] fix mixed single/multiple substitutions
2020-01-30 13:02:39 +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
Khaled Hosny
22bfc305ee
[feaLib] fix mixed single/multiple substitutions
...
If the single substitution involved a glyph class, we were incorrectly
using only the first glyph in the class.
Broken since ec6ff821f0e72022d7aec8794b6bb589d8f81808, apparently no one
else uses this feature!
2020-01-29 22:36:54 +02:00
David Corbett
62ed43ddb9
Do not fail on duplicate multiple substitutions
2020-01-26 10:30:17 -05:00
Jens Kutilek
67da54fb5f
Add a simple test
2019-12-18 11:09:23 +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
Khaled Hosny
197b36fef4
[feaLib] Don’t accept hex/octal numbers everywhere
...
Only in name, nameid, sizemenuname and Character.
2019-08-17 13:43:18 +02:00
Khaled Hosny
ae239722d4
[feaLib] Correctly handle octal numbers
...
From https://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html#9.e :
> Decimal numbers must begin with a non-0 digit, octal numbers with a 0
> digit, and hexadecimal numbers with a 0x prefix to numbers and
> hexadecimal letters a-f or A-F.
Fixes https://github.com/fonttools/fonttools/issues/1541
2019-08-17 13:43:18 +02:00
Nikolaus Waxweiler
01328213c7
Remove __future__ imports
2019-08-09 12:20:13 +01:00
Cosimo Lupo
6ea99e4569
feaLib/builder_test: use CapturingLogHandler instead of assertLogs
2019-06-11 13:14:47 +01:00
Khaled Hosny
41c7760be3
[feaLib] don’t write None in ast.ValueRecord.asFea()
...
The code tries to write the short format when some values as None, but
when writing the long format it would write any None value as is which
is invalid, use 0 for None values instead.
2019-05-03 00:53:09 +02:00
Cosimo Lupo
b1d055b133
Merge pull request #1539 from silnrsi/bugfix3
...
Compress type 1 GPOS tables better
2019-04-15 09:34:37 +01:00
Miguel Sousa
ddff29cb5d
Fix DeprecationWarning: invalid escape sequence
2019-04-01 14:04:14 -07:00
Khaled Hosny
45861a15ca
[feaLib] Reject invalid lookupflag without a value
...
Fixes https://github.com/fonttools/fonttools/issues/1538
2019-03-15 14:13:46 +02:00
Khaled Hosny
250eac4cae
[feaLib] Correctly handle lookupflag 0 in asFea()
...
Part of https://github.com/fonttools/fonttools/issues/1538
2019-03-15 14:13:46 +02:00
Martin Hosken
27d8d1bda0
Update tests
2019-03-15 11:16:51 +07:00
justvanrossum
e22453c933
followup to #1531
2019-03-06 16:47:16 +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
226f5518b7
[feaLib] "subtable" in single substitutions
2019-03-01 01:48:48 +02:00
Khaled Hosny
d9893ab05a
[feaLib] "subtable" in multiple substitutions
2019-03-01 01:48:48 +02:00