13 Commits

Author SHA1 Message Date
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
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
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Nikolaus Waxweiler
a7e4d86540 Use a set for file names for clash checking 2021-10-07 12:03:47 +01:00
Nikolaus Waxweiler
8d2a3ae6d2 Add expectContentsFile parameter to GlyphSet
For use when reading existing UFOs, to comply with the specification stating that a contents.plist file must exist in a glyph set.

Closes https://github.com/fonttools/fonttools/issues/2111.
2020-11-23 13:57:32 +00:00
Nikolaus Waxweiler
04e1269b41 [glifLib] Hard-require x and y coordinates 2020-10-03 12:43:28 +01:00
Cosimo Lupo
dc2ee4e082
glifLib_test: check case insensitive filenames are unique
tests for https://github.com/fonttools/fonttools/pull/2002
2020-07-03 11:37:17 +01:00
Cosimo Lupo
b617ac798e
glifLib_test: add tests for GLIF format version as tuple 2020-05-07 16:53:38 +01:00
Cosimo Lupo
70c3eccb4e
glifLib_test: test xml containing <!-- comment --> 2019-12-16 12:01:40 +00:00
Nikolaus Waxweiler
14bb52a616 Upgrade Tests/ufoLib to Python 3.6+ syntax 2019-09-13 18:27:05 +01:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
8081bf57fa
etree/plistlib/glifLib: using (default) single quotes in XML_DECLARATION
https://github.com/fonttools/fonttools/pull/1335#issuecomment-431118568
2018-10-18 19:49:52 +01:00
Cosimo Lupo
2cc1f418c7
rename Tests/ufoLib/test_*.py to Tests/ufoLib/*_test.py
for constency with the rest of fontTools tests.
Also, in setup.cfg we tell pytest to only search for modules named like these
2018-10-17 17:50:06 +01:00