Skip to content

ReferenceError: Cannot access 'c3x' before initialization #282

@fstrube

Description

@fstrube

Version 1.9.0-2.0.2 introduced a regression in the parse() function. I'm getting the following error and stack trace with the attached OTF font. It works fine in 1.8.1.

/test-fontkit/2.0.2/node_modules/fontkit/dist/main.cjs:11520
                                    c3x = c2x + stack.shift();
                                        ^

ReferenceError: Cannot access 'c3x' before initialization
    at parse (/test-fontkit/2.0.2/node_modules/fontkit/dist/main.cjs:11520:41)
    at $7ee0705195f3b047$export$2e2bcd8739ae039._getPath (/test-fontkit/2.0.2/node_modules/fontkit/dist/main.cjs:11570:9)
    at $7ee0705195f3b047$export$2e2bcd8739ae039.get path (/test-fontkit/2.0.2/node_modules/fontkit/dist/main.cjs:10750:21)
    at $7ee0705195f3b047$export$2e2bcd8739ae039.descriptor.get (/test-fontkit/2.0.2/node_modules/fontkit/dist/main.cjs:92:29)
    at $7ee0705195f3b047$export$2e2bcd8739ae039._getCBox (/test-fontkit/2.0.2/node_modules/fontkit/dist/main.cjs:10685:21)
    at $7ee0705195f3b047$export$2e2bcd8739ae039.get cbox (/test-fontkit/2.0.2/node_modules/fontkit/dist/main.cjs:10735:21)
    at $7ee0705195f3b047$export$2e2bcd8739ae039.descriptor.get (/test-fontkit/2.0.2/node_modules/fontkit/dist/main.cjs:92:29)
    at $7ee0705195f3b047$export$2e2bcd8739ae039._getMetrics (/test-fontkit/2.0.2/node_modules/fontkit/dist/main.cjs:10706:72)
    at $7ee0705195f3b047$export$2e2bcd8739ae039.get advanceWidth (/test-fontkit/2.0.2/node_modules/fontkit/dist/main.cjs:10764:21)
    at $7ee0705195f3b047$export$2e2bcd8739ae039.descriptor.get (/test-fontkit/2.0.2/node_modules/fontkit/dist/main.cjs:92:29)

KeplerStd-Bold.otf.zip

Use the following repo to reproduce: https://github.com/fstrube/fontkit-test

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions