64 Commits

Author SHA1 Message Date
Behdad Esfahbod
6e1f55b0c8 [varLib.interpolatable] black
Oops.
2023-10-20 16:43:24 -06:00
Behdad Esfahbod
77dea10e5f [varLib.interpolatable] Speed up _rot_list() 2023-10-20 16:03:40 -06:00
Behdad Esfahbod
9ae5918806 [varLib.interpolatable] Help improvement 2023-10-19 09:49:30 -06:00
Behdad Esfahbod
1d0a180b9d [varLib.interpolatable] One other micro-optimization
Residual from 4714c37028f462b29159ef7f7186e51ef68c20e1
2023-10-16 17:53:15 -06:00
Behdad Esfahbod
872ae47536 [varLib.interpolatable] Fix subclass base 2023-10-16 17:00:43 -06:00
Behdad Esfahbod
c306836488 [varLib.interpolatable] Another micro-optimization
Don't know why the previous code was written that way!
2023-10-16 14:55:10 -06:00
Behdad Esfahbod
b3a45f9f79 [varLib.interpolatable] Micro-optimize by reusing a list 2023-10-16 14:37:16 -06:00
Behdad Esfahbod
2a855f8bd6 Revert "[varLib.interpolatable] Cythonize"
This reverts commit 0914c6c0eefb1317aba95779fb469e138b19f365.
2023-10-14 18:58:53 -04:00
Behdad Esfahbod
0914c6c0ee [varLib.interpolatable] Cythonize
Doesn't save much; only 5% in RobotoFlex.  Probably going to revert.
2023-10-14 18:58:49 -04:00
Behdad Esfahbod
b01fbf2785 [varLib.interpolatable] Skip comparing contour orders if only 0 or 1 2023-10-14 17:43:45 -04:00
Behdad Esfahbod
4714c37028 [varLib.interpolatable] Speed up m0idx finding
Don't use list.index() which would compare vectors...
2023-10-14 17:25:52 -04:00
Behdad Esfahbod
d29856b2e4 [varLib.interpolatable] Micro-optimize a check 2023-10-14 17:09:27 -04:00
Behdad Esfahbod
9f42783d6f [varLib.interpolatable] Reduce imports in bipartite-matching
Choose the right implementation upfront
2023-10-14 17:01:08 -04:00
Behdad Esfahbod
54bf9723a8 [varLib.interpolatable] Sort glyphs by glyphname by default 2023-10-12 20:57:28 -04:00
Behdad Esfahbod
ca11333bab [varLib.interpolatable] Close over component glyphs
...when processing variable font.

Continuation of 636295a7ee558c5712a719c632a91d6c65bfc6d8

Part of fixing https://github.com/fonttools/fontbakery/discussions/4301
2023-10-12 20:45:23 -04:00
Behdad Esfahbod
89b6b95ba9 [varLib.interpolatable] Combine vdiff() and vlen()
Faster.
2023-10-12 20:07:57 -04:00
Behdad Esfahbod
5eff55e654 [varLib.interpolatable] Don't iterate over all glyphs if not needed 2023-10-12 19:23:51 -04:00
Behdad Esfahbod
408dea84bc [varLib.interpolatable] Speed up complex_vlen() 2023-10-12 19:15:29 -04:00
Behdad Esfahbod
739868f78e [varLib.interpolatable] Skip "drawing" glyphs with only one master
Speeds up Handjet another 10x.

Part of fixing https://github.com/fonttools/fontbakery/discussions/4301
2023-10-12 18:49:58 -04:00
Behdad Esfahbod
636295a7ee [varLib.interpolatable] Speed up working on variable fonts
Only check each glyph at its own "master" locations instead of at
all master locations across the font.

Incomplete.

Fixes https://github.com/fonttools/fontbakery/discussions/4301
2023-10-12 16:03:22 -06:00
Behdad Esfahbod
46086cdb66 [interpolatable] Add --glyphs 2023-06-27 16:59:05 -06:00
Behdad Esfahbod
b5899772c7 [interpolatable] Use math.sqrt() 2023-04-22 14:10:11 -06:00
Colin M. Ford
edc3584d5b
Using set comprehension
Suggestion by anthrotype

Co-authored-by: Cosimo Lupo <cosimo@anthrotype.com>
2023-04-06 10:34:48 -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
491bd74f4b Missed a m0idx 2023-04-05 18:22:21 -04:00
Colin M. Ford
9c1380be96 Oops, UFOLib's getGlyphSet does not have an items function 2023-04-05 18:21:17 -04:00
Colin M. Ford
4a991d1d89 Comment corrections 2023-04-05 17:12:43 -04:00
Colin M. Ford
208c36800b Oops, any could potentially block a list like [None, [], []], which is not what we want 2023-04-05 17:11:30 -04:00
Colin M. Ford
7a86dd325e Rewriting varLib.interpolatable to allow for sparse masters + tests 2023-04-05 16:35:03 -04:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Behdad Esfahbod
c04afbedaf [varLib.interpolatable] Fix naming of varfont masters 2022-08-29 17:08:30 -06:00
Behdad Esfahbod
250cec869e [interpolatable] Compare all masters to first master
Reduces number of errors reported.
2022-08-29 17:03:11 -06:00
Behdad Esfahbod
2d5a3576d1 [varLib.interpolatable] Report index of contour in error message 2022-08-25 14:15:58 -06:00
Behdad Esfahbod
dc99ab6b3f [ttGlyphSet] Address review comments 2022-08-15 11:06:51 -06:00
Behdad Esfahbod
125dbc64b5 [varLib.interpolatable] Use new ttGlyphSet var feature to open varfont 2022-08-14 12:08:12 -06:00
Behdad Esfahbod
21d22ae30f
Merge pull request #2716 from fonttools/interpolatable-opener
Interpolatable opener
2022-07-29 14:42:58 -06:00
Behdad Esfahbod
3e6b9c8c08 [varLib.interpolatable] Open .glyphs files as well 2022-07-29 11:19:27 -06:00
Behdad Esfahbod
10aecc029a [varLib.interpolatable] Support reading .designspace file 2022-07-29 11:19:22 -06:00
Behdad Esfahbod
aa509b6df2 [varLib.interpolatable] Fix mix of space & tab 2022-07-28 14:01:15 -06:00
Behdad Esfahbod
f0214415cc [interpolatable] Fix assert 2022-04-01 14:36:03 -06:00
Behdad Esfahbod
86b5d7103d [interpolatable] Downgrade assert 2022-04-01 14:00:22 -06:00
Behdad Esfahbod
6b4e2e7147 [ufoLib / interpolatable] Wire up outputImpliedClosingLine parameter
ufoLib's glyph draw() was passing outputImpliedClosingLine=False to
PointToSegmentPen(). This was causing incompatible nodes in
interpolatable tool for certain fonts, like this in NotoSansDevanagari:

Glyph dabhadeva was not compatible:
    Node count differs in path 1: 23 in NotoSansDevanagari-Bold, 24 in NotoSansDevanagari-CondensedBold
    Node count differs in path 1: 24 in NotoSansDevanagari-CondensedBold, 23 in NotoSansDevanagari-CondensedLight

Because a final lineto before a closepath was being elided or not in
some masters but not others.  Wire up the parameter and control it
from interpolatable tool to fix this.
2022-04-01 13:14:39 -06:00
Behdad Esfahbod
3165cc132a [interpolatable] Add mirrored rotated contour for starting-point check
This further found an issue in NotoSansArabic which I visually verified:

Glyph qafLamAlefMaksuraabove-ar was not compatible:
    Contour start point differs: NotoSansArabic-CondensedLight, NotoSansArabic-CondensedSemiBold
    Contour start point differs: NotoSansArabic-CondensedLight, NotoSansArabic-CondensedSemiBold
    Contour start point differs: NotoSansArabic-CondensedSemiBold, NotoSansArabic-Condensed
    Contour start point differs: NotoSansArabic-CondensedSemiBold, NotoSansArabic-Condensed
2022-03-31 20:23:54 -06:00
Behdad Esfahbod
9e96b95467 [interpolatable] Don't keep contour-start-point index 2022-03-31 20:18:44 -06:00
Behdad Esfahbod
b705bcdc8f [interpolatable] When checking for contour start point error allow for 5% error 2022-03-31 20:16:55 -06:00
Behdad Esfahbod
745631d16b [interpolatable] In diff-contour-order, allow for 5% cost difference
Reduces false-positives, as in this one in NotoSansArabic:

Glyph asteriskArt-ar was not compatible:
    Contour order differs: [0, 1, 2, 3, 4, 5] in NotoSansArabic-CondensedBold, [0, 3, 2, 1, 4, 5] in NotoSansArabic-CondensedLight
2022-03-31 19:52:48 -06:00
Behdad Esfahbod
3a846a5389 [interpolatable] Remove the empirical high-cost error
This was very empirical and has no theoretical background. Experiment
shows that this is mostly false-positive.
2022-03-31 19:37:00 -06:00
Behdad Esfahbod
d0d8039bd3 [varLib.interpolatable] Check for wrong contour starting point
This seems to work already. Detects the example in the issue.
I also ran this on master-compatible UFOs built from Noto Sans,
and detected several issues. Confirmed visuall in AxisPraxis that
theta.sc for example has wrong starting point in that font:

Glyph theta.sc was not compatible:
    Contour start point differs: NotoSans-DisplayRegular, NotoSans-DisplaySemiBoldCondensed
    Contour start point differs: NotoSans-DisplayRegular, NotoSans-DisplaySemiBoldCondensed
    Contour start point differs: NotoSans-DisplaySemiBoldCondensed, NotoSans-DisplaySemiBold
    Contour start point differs: NotoSans-DisplaySemiBoldCondensed, NotoSans-DisplaySemiBold

There's a TODO item left to be done, which is to check for mirrored
contours and rotations thereof.

Towards fixing https://github.com/fonttools/fonttools/issues/1801
2022-03-31 19:17:22 -06:00
Simon Cozens
72291031ac Tidy up add_problem 2020-11-21 08:00:07 +00:00
Simon Cozens
c6e5a7ab93 Catch open contours more explicitly 2020-11-21 07:59:39 +00:00