44 Commits

Author SHA1 Message Date
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
Simon Cozens
584555a344 fix tests 2020-11-20 11:18:54 +00:00
Simon Cozens
392149ac1d Tidy up output, add machine readable JSON option
Example text output:

```
Glyph D was not compatible:
    Node 1 incompatible in path 0: curveTo in Coolangatta-Regular, lineTo in Coolangatta-Bold
    Node count differs in path 1: 7 in Coolangatta-Regular, 6 in Coolangatta-Bold
Glyph N was not compatible:
    Node 11 incompatible in path 0: curveTo in Coolangatta-Regular, lineTo in Coolangatta-Bold
Glyph v was not compatible:
    Node 7 incompatible in path 0: lineTo in Coolangatta-Regular, curveTo in Coolangatta-Bold
```

Example JSON output:

```
{
  "D": [
    {
      "type": "node_incompatibility",
      "path": 0,
      "node": 1,
      "master_1": "Coolangatta-Regular",
      "master_2": "Coolangatta-Bold",
      "value_1": "curveTo",
      "value_2": "lineTo"
    },
    {
      "type": "node_count",
      "path": 1,
      "master_1": "Coolangatta-Regular",
      "master_2": "Coolangatta-Bold",
      "value_1": 7,
      "value_2": 6
    }
  ],
  "N": [
    {
      "type": "node_incompatibility",
      "path": 0,
      "node": 9,
      "master_1": "Coolangatta-Regular",
      "master_2": "Coolangatta-Bold",
      "value_1": "curveTo",
      "value_2": "lineTo"
    }
  ],
  "v": [
    {
      "type": "node_incompatibility",
      "path": 0,
      "node": 7,
      "master_1": "Coolangatta-Regular",
      "master_2": "Coolangatta-Bold",
      "value_1": "lineTo",
      "value_2": "curveTo"
    }
  ]
}
```
2020-11-20 11:18:54 +00:00
Simon Cozens
08e2a6cdc1 Reformat with black 2020-11-20 11:18:54 +00:00
Simon Cozens
129e2413a0 Gracefully handle glyphset mismatches 2020-11-20 11:18:53 +00:00
Simon Cozens
fdbe0763df Catch explosion on open paths 2020-11-20 11:18:53 +00:00
Simon Cozens
61814d41f5 Allow UFO files to be used in varLib.interpolatable
The joys of well-defined interfaces.
2020-11-20 11:18:53 +00:00
Simon Cozens
a2e3e9dce2
Apply suggestions from code review
Co-authored-by: Cosimo Lupo <cosimo@anthrotype.com>
2020-09-09 15:28:20 +01:00
Simon Cozens
bc9c7b6b14 [varLib] Test for interpolatability of paths
* Checks node count of each path
* Checks operation type of each path node
2020-09-03 11:24:58 +01:00
Simon Cozens
089f24da6b
Ensure all fonttools CLI tools have help documentation (#1948)
Note UI change : `fonttools varLib.models` now takes prefixed options `-d` or `-l` instead of guessing the intended feature from the number of arguments.

We have a number of command line tools which are somewhat opaque. (varLib.models in particular was very confusing.) This ensures that they all use argparse to have a consistent interface, and all have --help documentation which at least details their parameters, and hopefully therefore gives more of a clue about what they do. Those which use logging have had a command-line logging parameter added.
2020-05-12 15:11:30 +01:00
Simon Cozens
2cef07af80
[doc] Add help options to fonttools CLI (#1920)
This adds a `help` verb (and `--help` option) to the `fonttools` command line tool. Submodules will be listed in the help text if they have an importable `main` function with a docstring, and `main`'s docstring will be used as the one-line description for the help text.
2020-05-12 06:31:13 +01:00
Nikolaus Waxweiler
68a5ceac6d varLib: Remove py23 imports 2019-08-10 15:39:02 +01:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
28bb992c1f replace int(round(...)) with round(...)
We don't need to cast to int when using the round function from py23,
as this is a backport of python3's built-in round and thus it returns
an int when called with a single argument.
2017-10-22 12:03:52 +01:00
Behdad Esfahbod
b9ff863b2c Move Snippets/interpolatable.py to fontTools.varLib.interpolatable 2017-02-26 10:43:11 -08:00