glyphr-studio / Glyphr-Studio-2

Glyphr Studio v1 is more than a decade old. V2 is here to save the day.
https://www.glyphrstudio.com/v2
116 stars 14 forks source link

Crash while attempting to navigate to Kerning screen: `TypeError: r.substr is not a function` #152

Closed ThePaSch closed 7 months ago

ThePaSch commented 7 months ago

Describe the bug & what the expected behavior should be: While attempting to navigate to the Kerning screen to adjust my font's kerning groups, the application crashes gracefully (showing the "Oops, Navigation Failed" screen) with the following stacktrace:

TypeError: r.substr is not a function
    at bn (https://www.glyphrstudio.com/v2/app/assets/index-x0F-tG4Z.js:8:1222550)
    at mc (https://www.glyphrstudio.com/v2/app/assets/index-x0F-tG4Z.js:559:521)
    at https://www.glyphrstudio.com/v2/app/assets/index-x0F-tG4Z.js:559:481
    at Array.forEach (<anonymous>)
    at fn (https://www.glyphrstudio.com/v2/app/assets/index-x0F-tG4Z.js:559:455)
    at Bc (https://www.glyphrstudio.com/v2/app/assets/index-x0F-tG4Z.js:560:232)
    at Fc (https://www.glyphrstudio.com/v2/app/assets/index-x0F-tG4Z.js:560:581)
    at Re (https://www.glyphrstudio.com/v2/app/assets/index-x0F-tG4Z.js:777:5560)
    at Object.Cc [as pageMaker] (https://www.glyphrstudio.com/v2/app/assets/index-x0F-tG4Z.js:419:986)
    at Ah.makePageContent (https://www.glyphrstudio.com/v2/app/assets/index-x0F-tG4Z.js:48874:1613)

Steps to reproduce the bug:

  1. Open this Glyphr project in the v2 app.

  2. Attempt to navigate to the Kerning screen.

Other notes & screenshots: Navigating to the kerning screen seems to work fine for other projects I've tried. The project was initially started in v1 and then migrated to v2, though I've tried doing this with another project as well and everything works as expected.

mattlag commented 7 months ago

Fantastic, thank you for attaching the project file. I was able to reproduce the bug in the non-minified src, and tracked down the issue.

For my reference:

TypeError: codePoint.substr is not a function
    at getUnicodeName (http://localhost:5173/v2/app/lib/unicode/unicode_names.js:17:34)
    at makeCharChip (http://localhost:5173/v2/app/pages/kerning.js:623:13)
    at http://localhost:5173/v2/app/pages/kerning.js:612:23
    at Array.forEach (<anonymous>)
    at makeKernGroupCharChips (http://localhost:5173/v2/app/pages/kerning.js:610:8)
    at makeCard_kernGroup (http://localhost:5173/v2/app/panels/card_kern_group.js:24:18)
    at makePanel_KernGroupAttributes (http://localhost:5173/v2/app/panels/attributes_kern.js:13:3)
    at makePanel (http://localhost:5173/v2/app/panels/panels.js:28:61)
    at Object.makePage_Kerning [as pageMaker] (http://localhost:5173/v2/app/pages/kerning.js:122:20)
    at Navigator.makePageContent (http://localhost:5173/v2/app/project_editor/navigator.js:155:50)
mattlag commented 7 months ago

Actually, would you send me the v1 version of the project? All the kern groups just have false as group members, so it seems more like a v1 to v2 conversion bug than a kern bug.

    "kern-1": {
      "leftGroup": [
        false
      ],
      "rightGroup": [
        false
      ],
      "value": 120
    },
ThePaSch commented 7 months ago

Sorry, I don't have the original file anymore; I inadvertently overwrote it with the v2 save data.

mattlag commented 7 months ago

No worries, I'll try to reverse-engineer the bug. At least I know where to look - thanks!

faqro commented 7 months ago

Running into the same issue when importing fonts with kerns. The font in question is here

mattlag commented 7 months ago

This was just fixed in 2.0.1!