26 Commits

Author SHA1 Message Date
Khaled Hosny
101ff1508c [removeOverlaps] Pass None to T2CharStringPen if widths equals defaultWidthX 2024-10-12 01:45:32 +03:00
Khaled Hosny
40b525c1e3 [removeOverlaps] Fix CFF CharString width
The width argument of `T2CharStringPen()` is inserted directly into the
CharString program, so it must be relative to Private.nominalWidthX, but
CharString.width is a calculated absolute value.

Some implementations, notably Adobe’s, will use the width from the CFF
CharString instead of the one from hmtx table.

Fixes https://github.com/fonttools/fonttools/issues/3658
2024-10-12 01:22:17 +03:00
Khaled Hosny
246bede217 [ttLib.removeOverlaps] Force calling new arguments by name 2024-05-25 19:08:18 +03:00
Khaled Hosny
525ab7733a [ttLib.removeOverlaps] Add removeUnusedSubroutines, default to True 2024-05-25 18:41:36 +03:00
Khaled Hosny
945bedd891 [ttLib.removeOverlaps] Do nothing if no glyphs were modified 2024-05-25 18:36:07 +03:00
Khaled Hosny
44b15b41f6 [ttLib.removeOverlaps] Remove unused subroutines 2024-05-25 18:32:01 +03:00
Khaled Hosny
ce8fcfcc4f [ttLib.removeOverlaps] Add all options to CLI 2024-05-25 18:29:10 +03:00
Khaled Hosny
9268e1cdee [ttLib.removeOverlaps] Use argparse 2024-05-25 18:25:03 +03:00
Khaled Hosny
2da78ba158 [ttLib.removeOverlaps] Handle removeHinting for CFF table 2024-05-25 18:16:05 +03:00
Khaled Hosny
2f9033b22d [ttLib.removeOverlaps] Support CFF table 2024-05-25 18:11:30 +03:00
Behdad Esfahbod
a25e584955 [removeOverlaps] Show in --help 2024-04-30 13:13:53 -06:00
Khaled Hosny
cf08265cd5 Black 2024-02-06 15:47:35 +02:00
Cosimo Lupo
971043374e instancer: add --ignore-overlap-errors option
This is to be able to ignore tricky glyphs that sometimes trip up Skia PathOps.Simplify operation.
We have no idea how to fix this upstream (short of having the glyphs redrawn), and perfect is the enemy of good..
2021-07-29 16:59:04 +02:00
Cosimo Lupo
b0e24384c2 minor refactorings following review comment
https://github.com/fonttools/fonttools/pull/2288#discussion_r627907922
2021-05-07 09:49:40 +01:00
Cosimo Lupo
d4d3d95414 split simplify logic to separate func for easier unit-testing 2021-05-06 20:23:56 +01:00
Cosimo Lupo
84b851398b removeOverlaps: try rounding to ints before simplify to workaround skia bug
Fixes https://github.com/google/fonts/issues/3365

See https://bugs.chromium.org/p/skia/issues/detail?id=11958 for details
2021-05-06 14:16:01 +01:00
Cosimo Lupo
e13b781526 removeOverlaps: print glyph name when pathops.simplify fails
Sometimes skia-pathops simplify may fail (for unknown reasons which I'm still trying to debug).
It's a good idea to know the name of the offending glyph
https://github.com/google/fonts/issues/3365
2021-05-04 17:08:59 +01:00
Cosimo Lupo
7f9462dfa6
compare paths independently of contour order
the order of contours modified by Skia is not stable and may change. So when we compare the original and the modified paths, we compare the paths as unordered sets of contours.

The order of contours doesn't produce any visible difference, but we try to keep the changes to the minimum here to avoid unnecessary diffs
2020-09-30 13:40:01 +01:00
Cosimo Lupo
66a0d91bf9
remove hinting from all glyphs, whether overlaps are removed or not 2020-09-30 13:36:28 +01:00
Cosimo Lupo
e94098606b
log modified glyps 2020-09-30 13:35:05 +01:00
Cosimo Lupo
7b9da7602c
skip empty paths with no contours
https://github.com/fonttools/fonttools/pull/2068#pullrequestreview-498472660
2020-09-29 16:24:17 +01:00
Cosimo Lupo
e1ad83add7
minor edit to comment [skip ci] 2020-09-29 14:44:51 +01:00
Cosimo Lupo
da439c7c57
decompose composites only if components intersect; let pathops.PathPen decompose components
requires https://github.com/fonttools/skia-pathops/pull/32
2020-09-29 14:14:55 +01:00
Cosimo Lupo
015d8265d2
use pathops.simplify() and remember if original path direction
pathops.simplify() returns a copy so we don't need to make a copy ourselves.

'clockwise' option is defined in https://github.com/fonttools/skia-pathops/pull/31
2020-09-27 17:31:30 +01:00
Cosimo Lupo
0ceb146196
process simple glyphs before composites
to avoid decomposing only because a component's base glyph contains overlaps.
2020-09-27 17:29:25 +01:00
Cosimo Lupo
2bcc103c36
move it to ttLib.removeOverlaps module 2020-09-23 19:13:58 +01:00