166 Commits

Author SHA1 Message Date
Nikolaus Waxweiler
cf43ff5d22 Apply avar to variable locations 2023-03-15 16:19:39 +00:00
Nikolaus Waxweiler
73e7aad1c3 Guard against missing avar entries 2023-03-15 16:18:47 +00:00
Nikolaus Waxweiler
c3a5e9ea1f Consult avar for normalizing user-space values in conditionsets 2023-03-15 09:16:06 +00:00
Khaled Hosny
253b4f9afc [feaLib] Further merge inline single substitutions
Fixes https://github.com/fonttools/fonttools/issues/2150 (see the
discussion there).
2023-01-28 09:51:49 -07:00
Khaled Hosny
eb93b7688e [feaLib] Fix handled of "ignore" with unmarked glyphs
Fixes https://github.com/fonttools/fonttools/issues/2949

- If there are no marked glyphs in an "ignore" statement, issue a
  warning. The spec disallows this but makeotf allows it. It is most
likely a typo, so a warning is warranted.
- Mark the first glyph not all the glyphs, this matches makeotf.
- In asFea() always mark the input glyph.
- Udpate the tests.
2023-01-10 16:26:12 +02:00
Colin Rofls
1987dbaa05 [feaLib] Remove rogue whitespace in GPOS_1_zero.ttx
In what I presume was error, this test case included a space on the line
immediately following the <ttFont> element; this space is not present in
any other ttx files.

For reasons that are unclear to me, and likely not worth investigating,
the presence (or absence) of this space does not influence the passing
or failure of this test case; however it *does* cause a failure in my
feature compiler, which is reusing this test suite, and so I would like
to fix it here, and simplify my own life somewhat.
2022-12-14 19:01:11 -05:00
Cosimo Lupo
c30a6355ff
Merge pull request #2925 from fonttools/blacken-code
Blacken code
2022-12-14 18:53:35 +00:00
Colin Rofls
4716f85731 [feaLib] Sort name table entries in builder
This patch ensures that feaLib always produces a name table with entries
sorted in the order proscribed by the spec: platform id, encoding id,
language id, name id.

This breaks some tests, and so I have manually updated the test data to
match the new outputs.
2022-12-13 10:39:33 -05:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Cosimo Lupo
41ff9511cc
otlLib: sort names after building STAT, set AxisValueCount=0 2022-10-20 16:44:02 +01:00
Simon Cozens
64fd837ca1
Allow multiple value record types in the same pairpos table (#2776)
* Use buildPairPosClassesSubtable's ability to promote value records (see #2772)

* Add tests for #2772
2022-09-05 14:44:50 +01:00
David Corbett
8ec37c4bb3 [feaLib] Let the parser set nameIDs 1 through 6 2022-07-02 15:23:03 -04:00
Simon Cozens
d224e1f73d
[feaLib] show all missing glyphs at once (#2665) 2022-06-23 15:04:59 +01:00
Simon Cozens
2d62a2ac9e
Disable GSUB5 optimization (#2540)
* Disable GSUB5/GPOS7 optimization

* Revert "Fixup test expectations"

This reverts commit 7db13c9872884772312727e3478fb36ed9883004.

* Revert "Rename GPOS8->GPOS7"

This reverts commit 6d4c5fe31c9199e6d3e46cd0808e7640d1610e75.

* Revert "Fix varlib test expectations - now badly named."

This reverts commit 4adea942cc73b6afe58e00278da6cb3795935970.

* Allow GSUB5, disable GPOS7

* Revert "Revert "Fixup test expectations""

This reverts commit 42993ae6917f8f6e4c31f4be123caca24d27d2da.

* Fix up expectations
2022-04-08 15:54:34 +01:00
Simon Cozens
af9dfc94e7
Forbid empty classes (take 2) (#2446) 2021-11-18 11:31:49 +00:00
Simon Cozens
563730f8ce
Support variable feature syntax (#2432) 2021-10-28 11:58:54 +01:00
Khaled Hosny
232b2ccbc4 Move the rest of py23 module to textTools
Change all imports to use textTools module, except the test_py23.py test
which is kept until we decide to remove the module (if ever).
2021-08-20 01:29:45 +02:00
Khaled Hosny
000bf81700 Default to "\n" for newlinestr instead of None
If newlinestr is None, os.linesep is used, bu it is the third millennium
and we don’t need or want different line endings per-platform.
2021-07-30 04:12:33 +02:00
Khaled Hosny
f6d2ff8d2a [feaLib] Allow substituting a glyph class with NULL
sub [a b c] by NULL; was producing errors, now it builds as multiple
statements.
2021-05-12 08:53:26 +02:00
Just van Rossum
9825ab0977
Fix for #2293: allow more than one lookahead glyph/class in contextual positioning with "value at end" (#2294)
* add test that fails for #2293

* fixing #2293: rewrite of contextual positioning logic, ensure len(suffix) > 1 yields the correct result; checking more edge cases and raising errors inspired by makeotf

* test error cases

* only check when we actually have a value

* catch one more case that makeotf errors on and we didn't
2021-05-08 09:22:30 +02:00
Cosimo Lupo
2830260a01 another test to check that empty lookups blocks are skipped 2021-04-26 10:07:36 +01:00
Cosimo Lupo
9b5bc9e18b feaLib: ignore empty named lookup reference
Fixes #2276
2021-04-22 13:11:57 +01:00
Cosimo Lupo
bd618d0117 add test to repro AttributeError when getAlternateGlyphs for empty lookups
https://github.com/fonttools/fonttools/issues/2276
2021-04-22 12:21:30 +01:00
Just van Rossum
5fc65d7168
Misc py23 cleanups (#2243)
* Replaced all from ...py23 import * with explicit name imports, or removed completely when possible.
* Replaced tounicode() with tostr()
* Changed all BytesIO ans StringIO imports to from io import ..., replaced all UnicodeIO with StringIO.
* Replaced all unichr() with chr()
* Misc minor tweaks and fixes
2021-03-29 11:45:58 +02:00
Behdad Esfahbod
d0aaf1bceb [feaLib] Set RangeStart/RangeEnd as float
Fixes the one failing test after previous commit.
2021-03-24 08:04:14 -07:00
Nikolaus Waxweiler
cc76169074 Test that G* table compilation does not change data 2021-03-24 07:58:42 -07:00
Nikolaus Waxweiler
30ade474dd Update test data 2021-03-22 14:45:24 +00:00
Kamile Demir
29ff42d15f
Reusing otlLib buildStatTable() in feaLib 2021-02-25 17:16:02 +00:00
Zachary Scheuren
0434b1a917
Add feaLib support for STAT table 2021-02-25 17:16:01 +00:00
Denis Moyogo Jacquerye
537fabcee9 [feaLib] update tests for indented anchors 2021-02-18 19:19:18 +00:00
Simon Cozens
d1e85cb888 Allow 'sub X by NULL;' sequence to delete a glyph 2021-02-03 14:12:46 +00:00
Simon Cozens
3e964ad8da
Merge pull request #2101 from simoncozens/alternate-contextual-representations
[otlLib] Build format 1 and format 2 contextual lookups
2020-11-18 07:34:04 -08:00
Simon Cozens
a99bd4296a Tests for GSUB5/GSUB6 formats 1, 2 and 3 2020-11-17 15:17:02 +00:00
Simon Cozens
db37b3bd9a Update test expectations 2020-11-16 13:42:22 +00:00
Simon Cozens
7135255d4a Style nits 2020-09-11 09:35:45 +01:00
Simon Cozens
70b514270e Add debug tests 2020-09-10 08:29:04 +01:00
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