1518 Commits

Author SHA1 Message Date
Cosimo Lupo
9bb3b652b0
fontBuilder_test: test error with cubics but glyf format 0 2023-05-23 12:56:09 +01:00
Simon Cozens
65bc6105f7
[feaLib] Allow empty aalt features (#3110)
* Demote "feature has not been defined" to a warning

* Rework test

* Not my black
2023-05-17 15:08:08 +01:00
David Corbett
bd00fe24f1 feaLib: Test deduped multiple substitution lookups 2023-05-14 09:35:53 -04:00
Khaled Hosny
88885ba9fc feaLib: handle singleton class as a single glyph in multiple subst
This how GlyphsApp handles it and how it is handled in single
substitution.
2023-05-09 17:33:36 +03:00
خالد حسني (Khaled Hosny)
b6209e0510
Merge pull request #3103 from fonttools/multiple-subst-classes
feaLib: support multiple substitution with classes
2023-05-09 16:15:33 +03:00
Khaled Hosny
f642a2aac4 feaLib: support multiple substitution with classes
This is a GlyphsApp extension, (partially) documented [here][1], but it is a
useful one as it allows concise glyph insertion using decomposition
without having to maintain the list of glyphs in two places. E.g.

```fea
@upper = [A-Z];

lookup insert {
  sub @upper by @upper connector;
} insert;

feature ccmp {
  sub @upper' lookup insert x;
} ccmp;
```

As apposed to:

```fea
@upper = [A-Z];

lookup insert {
  sub A by A connector;
  sub B by B connector;
  sub C by C connector;
  sub D by D connector;
  sub E by E connector;
  sub F by F connector;
  sub G by G connector;
  sub H by H connector;
  sub I by I connector;
  sub J by J connector;
  sub K by K connector;
  sub L by L connector;
  sub M by M connector;
  sub N by N connector;
  sub O by O connector;
  sub P by P connector;
  sub R by R connector;
  sub S by S connector;
  sub T by T connector;
  sub U by U connector;
  sub V by V connector;
  sub W by W connector;
  sub X by X connector;
  sub Y by Y connector;
  sub Z by Z connector;
} insert;

feature ccmp {
  sub @upper' lookup insert x;
} ccmp;
```

1. http://handbook.glyphsapp.com/en/layout/multiple-substitution-with-classes/
2023-05-09 14:06:12 +03:00
Behdad Esfahbod
5b96fff9ce [featureVars] Process lookups for features other than rvrn last
Fixes https://github.com/fonttools/fonttools/issues/3097
2023-05-02 10:57:43 -06:00
Jens Kutilek
85c80be6b6
Fix missing composite instructions in ttx (#3092)
* Fix calculation of haveInstructions
* Add test
2023-04-25 16:21:24 +02:00
Cosimo Lupo
df42e9d1e4
ttLib_main.py: test directly __main__.main(), coverage-py doesn't collect in subprocess 2023-04-24 11:48:36 +01:00
Cosimo Lupo
cb5aa96702
add missing __main__.py file to ttLib package, plus some tests
Fixes https://github.com/fonttools/fonttools/issues/17
2023-04-24 11:22:53 +01:00
Behdad Esfahbod
57c7792477
[merge] Handle differing default/nominalWidthX in CFF (#3070)
* [merge] Handle None GDEF.table.MarkGlyphSetsDef

* [merge] Handle differing CFF nominal/defaultWidthX

Fixes https://github.com/fonttools/fonttools/issues/3069

* Update Lib/fontTools/merge/tables.py

Co-authored-by: Cosimo Lupo <clupo@google.com>

---------

Co-authored-by: Cosimo Lupo <clupo@google.com>
2023-04-19 12:14:41 -06:00
Colin M. Ford
52f522525a lastly, removing lib cruft from glyphs file 2023-04-06 11:04:47 -04:00
Colin M. Ford
ab7628b3f5 adding importerskip for glyphsapp tests 2023-04-06 10:58:31 -04:00
Colin M. Ford
e7c9616c48 Removing UFO cruft 2023-04-06 10:44:10 -04:00
Colin M. Ford
579d0dce31 one more try with black 2023-04-06 10:08:42 -04:00
Colin M. Ford
9656e3faf1 formatting with black to get lint to pass 2023-04-05 22:33:38 -04:00
Colin M. Ford
45d1d01f66 adding more tests for varlib.interpolatable 2023-04-05 20:48:34 -04:00
Colin M. Ford
7a86dd325e Rewriting varLib.interpolatable to allow for sparse masters + tests 2023-04-05 16:35:03 -04:00
Cosimo Lupo
8859d8669d
ttFont_test: add tests for unseekable input file with lazy=True 2023-03-21 18:15:02 +00:00
Cosimo Lupo
1d5feb81e5
ttFont_test: add reproducer for SpooledTemporaryFile has no seekable
Reproduces https://github.com/fonttools/fonttools/issues/3052
2023-03-21 18:08:21 +00:00
Cosimo Lupo
5abdd83318
Merge pull request #3043 from fonttools/fealib-more-avar
Apply `avar` also to variable locations
2023-03-16 12:35:51 +00:00
Cosimo Lupo
5d0432a813
Merge pull request #3029 from daltonmaag/wrap-glif-xml-errors
[glifLib] Wrap XML library exceptions with glifLib types when parsing glifs
2023-03-16 11:46:45 +00:00
Behdad Esfahbod
05872d6878
Merge pull request #2679 from fonttools/avar2
Avar2
2023-03-15 11:56:30 -06:00
Behdad Esfahbod
2edbbc1b32 [avar2] Test xml for equality 2023-03-15 11:46:57 -06:00
Behdad Esfahbod
b009e63733 [avar2] Use fl2fi in test 2023-03-15 11:40:24 -06:00
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
Behdad Esfahbod
1deed38b8d [avar2] Add compile test 2023-03-14 14:09:32 -06:00
Harry Dalton
70ca6dec9b Identify the culprit glif in read errors with a loose backport of PEP678
This commit annotates errors from GlyphSet.readGlyph() with the details
of the glyph that originated them (e.g. name, path to glif). This is
implemented with a loose backport of PEP678, to avoid adding a wrapper
error that would be less specific and would break API compatibility.

In addition, this commit adds a test to ensure that the new details are
present (specifically, in the case of parsing invalid XML).
2023-03-14 15:58:18 +00:00
Jens Kutilek
f1a75bacb2
Handle string input to Program.fromAssembly() (#3038)
* Add tests for fromAssembly() output (#3036)
* Handle string input to fromAssembly() (Fixes #3036)
* Fixups suggested by @anthrotype
* Add some more typing annotations
* Program.assembly always returns List[str] now
* Add annotation for bytecode
* Move code from setter to fromAssembly
* Remove property
* Fix attribute names
2023-03-14 14:51:16 +01:00
Khaled Hosny
fd6c81585f [otlib] Add a config option to write GPOS 7 lookups
See the inline comment and option documentation
2023-03-13 16:34:33 +02:00
Cosimo Lupo
3c9aa76893
Merge pull request #3027 from fonttools/colr-clipboxes
[COLRv1] Add method to automatically compute ClipBoxes, w/ optional quantization
2023-03-10 15:43:35 +00:00
Cosimo Lupo
c5e464ad8f
C_O_L_R_test: add tests for computeClipBoxes
using a subset from test_glyphs font from the googlefonts/color-fonts repository
2023-03-10 15:23:30 +00:00
Cosimo Lupo
d64ee127be
ttFont_test: another test for missing glyph name that doesn't match 'glyph\d+' pattern 2023-03-10 11:44:52 +00:00
Cosimo Lupo
d77c8901c8
ttFont_test: add test for getGlyphID 2023-03-10 11:37:07 +00:00
Harry Dalton
1f3380300b Wrap XML library exceptions with glifLib types when parsing glifs
This allows dependent projects to catch errors parsing glifs without
requiring logic to account for which XML library fonttools is using
internally (e.g. for implementing fonttools/ufoLib2#264).

This commit also adds tests to ensure that the exception we expose when
glifs have invalid syntax remains stable across future releases.
2023-03-09 16:11:32 +00:00
Behdad Esfahbod
43b16df8db [avar] Update test expectations 2023-03-08 11:10:07 -07:00
Behdad Esfahbod
2b5686205e [avar] Support previous API in compile/decompile
Using the otData mechanism with handcoded shim.
2023-03-08 09:29:58 -07:00
Cosimo Lupo
1a202ab1be
Merge pull request #3024 from fonttools/no-overwrite-stat
[varLib] Don't overwrite pre-existing STAT
2023-03-08 13:00:34 +00:00
Cosimo Lupo
d9570826ad
varLib_test: test build_many doesn't overwrite pre-existing STAT 2023-03-08 12:40:43 +00:00
Cosimo Lupo
5955a47f42
[varLib] build_many(DSv5) from main(); add --output-dir & --variable-fonts options
Fixes https://github.com/fonttools/fonttools/issues/2659
2023-03-07 18:13:28 +00:00
Cosimo Lupo
8f3d697faa
mtiLib: check for FONTTOOLS_LOOKUP_DEBUGGING env var
We do the same for feaLib.builder to decide whether to build a Debg table or not: i.e. we check if FONTTOOLS_LOOKUP_DEBUGGING environment variable is defined and if so we go on to build one, otherwise we don't.

Fixes https://github.com/fonttools/fonttools/pull/3018
2023-03-07 12:02:45 +00:00
Cosimo Lupo
ea8b9b85d7
mti_test: convert to pytest-style test module 2023-03-07 12:00:50 +00:00
Cosimo Lupo
c24558c57b
Merge pull request #3018 from fonttools/mtilib-debg
[mtiLib] Add debug info
2023-03-06 12:23:24 +00:00
Cosimo Lupo
8d546623d1
update mtiLib expected test files 2023-03-06 12:09:01 +00:00
Cosimo Lupo
1d6326ea61
ttx_test: test dumping and compiling from stdin to stdout 2023-03-03 16:30:23 +00:00
Jany Belluz
760c7376fe [subset] Compute xAvgCharWidth even when --no-prune-unicode-ranges is given 2023-03-01 16:28:51 +00:00
Cosimo Lupo
d4c5eac780
Merge pull request #3007 from kontur/name-sort-encode-warning-only
Make NameRecord comparison not fail on encoding errors #3006
2023-02-27 16:31:19 +00:00
Behdad Esfahbod
b7b4a3b090 [varLib.featureVars] Fix bug in overlayBox
See added test. Previously we were cutting remainder box
even if the intersection had dimensions not present in the
remainder box. Ouch!

Fixes https://github.com/fonttools/fonttools/issues/3003
2023-02-24 07:51:00 -07:00