Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError('Index out of range') in the layout method #179

Closed
defue opened this issue Oct 27, 2018 · 1 comment
Closed

RangeError('Index out of range') in the layout method #179

defue opened this issue Oct 27, 2018 · 1 comment

Comments

@defue
Copy link
Contributor

defue commented Oct 27, 2018

Code:

const fontkit = require('fontkit');
const font = fontkit.openSync('simple_slum.ttf');
const run = font.layout("t’internet");

Output:

buffer.js:977
    throw new RangeError('Index out of range');
    ^

RangeError: Index out of range
    at checkOffset (buffer.js:977:11)
    at Buffer.readInt16BE (buffer.js:1121:5)
    at DecodeStream.(anonymous function) [as readInt16BE] (/home/user/temp/node_modules/restructure/src/DecodeStream.js:38:35)
    at NumberT.decode (/home/user/temp/node_modules/restructure/src/Number.js:24:38)
    at Struct._parseFields (/home/user/temp/node_modules/restructure/src/Struct.js:53:22)
    at Struct.decode (/home/user/temp/node_modules/restructure/src/Struct.js:18:12)
    at TTFGlyph._getCBox (/home/user/temp/node_modules/fontkit/index.js:11315:28)
    at TTFGlyph._getMetrics (/home/user/temp/node_modules/fontkit/index.js:11573:21)
    at TTFGlyph.get (/home/user/temp/node_modules/fontkit/index.js:11207:19)
    at TTFGlyph.descriptor.get (/home/user/temp/node_modules/fontkit/index.js:92:23)

fontkit v1.7.7
nodejs v8.10.0

The font is attached.
simple_slum.zip

@defue
Copy link
Contributor Author

defue commented Dec 30, 2022

The bug is still in place for v2.0.2 (node v12.22.9). Here is the output:

/home/user/bug/node_modules/restructure/dist/main.cjs:91
        const ret = this.view[key](this.pos, false);
                                  ^

RangeError: Offset is outside the bounds of the DataView
    at DataView.getInt16 (<anonymous>)
    at $8ae20583b93e4933$export$c18b354bac7948e9.<computed> [as readInt16BE] (/home/user/bug/node_modules/restructure/dist/main.cjs:91:35)
    at $af65abf7bf65ac42$export$fffa67e515d04022.decode (/home/user/bug/node_modules/restructure/dist/main.cjs:268:40)
    at $aa8b66bae6abe658$export$eabc71f011df675a._parseFields (/home/user/bug/node_modules/restructure/dist/main.cjs:732:29)
    at $aa8b66bae6abe658$export$eabc71f011df675a.decode (/home/user/bug/node_modules/restructure/dist/main.cjs:703:14)
    at $f680320fa07ef53d$export$2e2bcd8739ae039._getCBox (/home/user/bug/node_modules/fontkit/dist/main.cjs:10906:54)
    at $f680320fa07ef53d$export$2e2bcd8739ae039._getMetrics (/home/user/bug/node_modules/fontkit/dist/main.cjs:11074:25)
    at $f680320fa07ef53d$export$2e2bcd8739ae039.get advanceWidth (/home/user/bug/node_modules/fontkit/dist/main.cjs:10764:21)
    at $f680320fa07ef53d$export$2e2bcd8739ae039.descriptor.get (/home/user/bug/node_modules/fontkit/dist/main.cjs:92:29)
    at /home/user/bug/node_modules/fontkit/dist/main.cjs:10141:115

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant