9304 Commits

Author SHA1 Message Date
Cosimo Lupo
27e4052380 encode bytes before fromstring; decode to str after tostring
when decompiled from binary, the SVG.docList contains (unicode) strings, decoded as UTF-8. lxml fromstring accepts either bytes or str, but when given str with the xml header declaring an explicit encoding, it rejects them (since the header is lying). So we encode to bytes before calling fromstring in case the SVG contains an explicit encoding (UTF-8 is the only one allowed anyway). When serializing to XML with tostring, we similarly decode to str as UTF-8. Not only to match SVG decompile (which gives us str), but if we didn't do that, then attempting to dump to XML would fail, because XMLWriter.writecdata expects str, not bytes.
2021-11-15 19:06:38 +00:00
Cosimo Lupo
1d19cc6e23 add comment for reason not to short-circuit with any() 2021-11-15 18:17:19 +00:00
Cosimo Lupo
12ed8b752c simplify and do el.attrib.get('id') as per review 2021-11-15 17:46:42 +00:00
Cosimo Lupo
92470ea361 rename parmeter ids => retained_ids for clarity as per review 2021-11-15 17:41:42 +00:00
Cosimo Lupo
863c9de57c subset/svg_test: test more complex document with cross-references 2021-11-15 17:08:55 +00:00
Cosimo Lupo
a7216ae766 subset: drop svg doc if subsetted to empty 2021-11-15 17:08:55 +00:00
Cosimo Lupo
d1f2481fa0 fix invalid escape sequence in GID_RE pattern 2021-11-15 17:08:55 +00:00
Cosimo Lupo
361544ffe2 bump lxml==4.6.4 version to latest 2021-11-15 17:08:55 +00:00
Cosimo Lupo
a79106d09a add simple subset/svg_test.py 2021-11-15 17:08:55 +00:00
Cosimo Lupo
a4df567718 subset/svg: support resolving cross-references and pruning elements
With this I can finally follow xlink:href and url(#...) sort of
references within the SVG doc and subset the elements accordingly so
that only those that are reachable from the initial set of glyph
elements are kept.
2021-11-15 16:07:18 +00:00
Cosimo Lupo
05e6d577cd subset: add --pretty-svg option to enable lxml pretty_print
False (more compact) by default
2021-11-15 16:07:18 +00:00
Cosimo Lupo
0dc2be3e78 require lxml to subset SVG
support for namespaces and xpath is insufficient in built-in ElementTree; supporting both lxml and ElementTree is too complicated, let's simply require lxml to be able to subset SVG for now
2021-11-15 16:07:18 +00:00
Cosimo Lupo
d44af9f2d7 basic subset.svg impl that simply remaps id='glyphXXX'
this drops svg document records when they no longer intersect the subset. It keeps them in their entirety (for now) when they still intersect the subset, only renaming all the id='glyphXXX' to point to the new glyph indices after subsetting. Unused, unreferenced elements are not pruned yet.
2021-11-15 16:07:18 +00:00
Cosimo Lupo
16249d1fb8 subset: store original glyphOrder and map from old to new indexes in Subsetter instance
so that SVG tables' subset_glyphs method can use it to get glyph names from GISs and to remap from old to new GIDs
2021-11-15 16:07:18 +00:00
Cosimo Lupo
bd47bdae97 subset: don't drop SVG table, add WIP subset/svg.py stub
simply  pass-through for now
2021-11-15 16:07:18 +00:00
Cosimo Lupo
425e1afd36 subset: move _add_method and _uniq_sort to subset/util submodule 2021-11-15 16:07:18 +00:00
Cosimo Lupo
0dc2f820bd cu2qu/cli: latest ufoLib2 no longer does Font(path); must use Font.open(path)
https://github.com/fonttools/fonttools/runs/4211314586?check_suite_focus=true#step:5:598
2021-11-15 12:22:33 +00:00
Cosimo Lupo
2e6b010834
Update requirements.txt 2021-11-15 12:06:51 +00:00
Antonio Cavedoni
e3338bc837 Removed comment about missing “start” optional argument to calcChecksum 2021-11-11 10:09:19 +01:00
Simon Cozens
b29ae8003b
[docs] Add interrogate configuration (#2443) 2021-11-10 10:55:06 +00:00
Cosimo Lupo
8c6930810b Bump version: 4.28.1 → 4.28.2.dev0 2021-11-08 12:51:44 +00:00
Cosimo Lupo
497c449db1 Release 4.28.1 2021-11-08 12:51:44 +00:00
Cosimo Lupo
e605706c07 Update NEWS.rst [skip ci] 2021-11-08 12:50:41 +00:00
Cosimo Lupo
8d6a7617a2 minor: fix 4-space indentation from PR 2441 2021-11-08 12:27:26 +00:00
Cosimo Lupo
de58709fd3
Merge pull request #2441 from fonttools/i2438
Traverse when there is no layer list
2021-11-08 12:24:13 +00:00
Rod S
7dd3488732 Traverse when there is no layer list 2021-11-06 14:26:27 -07:00
David Corbett
cfa69f245f [otlLib] Remove duplicates when building coverage 2021-11-06 13:32:43 -04:00
Cosimo Lupo
a2990a25df Bump version: 4.28.0 → 4.28.1.dev0 2021-11-05 13:20:50 +00:00
Cosimo Lupo
c7109c1a02 Release 4.28.0 2021-11-05 13:20:49 +00:00
Cosimo Lupo
63fbd15982 Updated NEWS.rst [skip ci] 2021-11-05 13:19:19 +00:00
Cosimo Lupo
63738938fa
Merge pull request #2439 from fonttools/i2438
Don't crash if there is no layer list
2021-11-03 09:01:01 +00:00
Rod S
6144202cd9 Don't crash if there is no layer list 2021-11-02 15:59:30 -07:00
Khaled Hosny
b11d6f79ba
Merge pull request #2437 from medicalwei/unicode-14
update to unicode 14.0
2021-10-31 19:02:42 +02:00
Yao Wei (魏銘廷)
390640a357
update to unicode 14.0 2021-10-31 23:24:18 +08:00
Simon Cozens
563730f8ce
Support variable feature syntax (#2432) 2021-10-28 11:58:54 +01:00
Cosimo Lupo
c194a18be7 update codecov gh action to v2
apparently v1 is deprecated now
https://github.com/codecov/codecov-action#%EF%B8%8F--deprecration-of-v1

hopefully fixes #2435
2021-10-25 17:29:50 +02:00
Cosimo Lupo
91d7877420 ci: pin python to 3.9 for test-cython job
at least until scipy is not available for 3.10, or else it fails with

https://github.com/fonttools/fonttools/runs/3997161938?check_suite_focus=true#step:5:23
2021-10-25 16:33:44 +02:00
Cosimo Lupo
941179eb60 fonttools help: only show first line of main()'s docstring
mtiLib.main() contained a multiline string in __doc__ and it didn't look in line with the rest of the --help
2021-10-19 14:22:09 +02:00
Cosimo Lupo
d36ac5ca28 requirements.txt: use brotlicffi on pypy
brotlipy was renamed to brotlicffi, we changed imports and setup.py'
s install_requires in https://github.com/fonttools/fonttools/pull/2117 but forgot to update the requirements.txt file.
2021-10-19 10:43:49 +02:00
Khaled Hosny
3181edaecc
Merge pull request #2431 from fonttools/pyup-scheduled-update-2021-10-18
Scheduled weekly dependency update for week 42
2021-10-18 18:26:37 +02:00
pyup-bot
2cda43e8bf Update pyobjc from 6.2.2 to 7.3 2021-10-18 17:07:07 +01:00
pyup-bot
f1ddecc055 Update ufolib2 from 0.6.2 to 0.11.4 2021-10-18 17:07:06 +01:00
pyup-bot
49d0bf3b6b Update skia-pathops from 0.5.1.post1 to 0.7.1 2021-10-18 17:07:06 +01:00
pyup-bot
ee7bed7d16 Update fs from 2.4.11 to 2.4.13 2021-10-18 17:07:05 +01:00
pyup-bot
77832aef27 Update zopfli from 0.1.6 to 0.1.8 2021-10-18 17:07:05 +01:00
pyup-bot
4e325d0b8b Update scipy from 1.5.4 to 1.7.1 2021-10-18 17:07:05 +01:00
pyup-bot
559e1aa3b5 Update reportlab from 3.5.55 to 3.6.2 2021-10-18 17:07:04 +01:00
pyup-bot
a767774056 Update sphinx_rtd_theme from 0.5.0 to 1.0.0 2021-10-18 17:07:04 +01:00
pyup-bot
5772775235 Update sphinx from 3.3.1 to 4.2.0 2021-10-18 17:07:03 +01:00
Cosimo Lupo
20188a0e36
Merge pull request #2430 from fonttools/svg-compile-reuse-offset
[SVG] reuse SVG doc offsets on compile; remove deprecated version-1 support
2021-10-18 16:08:17 +01:00