Error "Cannot read property 'y' of undefined" in the file ShapePath.js
See original GitHub issueIf in the file Font.js in the function createPath
value glyph.o
ends with text "m {number} {number} z "
(e.g. "m 167 878 z "
) then in the file ShapePath.js in the function isPointInsidePolygon
occurs this error:
This happens, for example, when I use character “Ö” of font Calibri.
In the file ShapePath.js in the function toShapes
this code:
} else {
newShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );
should be changed to this code:
} else if ( tmpPoints.length ) {
newShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >ERROR Cannot read properties of undefined PATH
From the error message: "message": "Cannot read properties of undefined (reading 'path')". -> Somewhere in the code, we read the property ...
Read more >Uncaught TypeError : Cannot read properties of undefined
Looking for ways to handle Uncaught TypeError: Cannot read property of undefined in JavaScript? This guide will help you to catch errors.
Read more >Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError : Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an...
Read more >TypeError: "x" is (not) "y" - JavaScript - MDN Web Docs - Mozilla
Oftentimes, unexpected undefined or null values. Message. TypeError: Cannot read properties of undefined (reading 'x') (V8-based) TypeError: "x" is ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Closing for now. The issue can be reopened if it’s proven that
facetype.js
works as intended.The JSON file used in jsfiddle was generated using generator http://gero3.github.io/facetype.js/ and using TTF file downloaded from https://www.fontmirror.com/calibri.
I have replaced all texts
"m {number} {number} z "
with text"z"
and now there is no error and the character “Ö” seems to be fine: https://jsfiddle.net/blizzard_mindfloat/6smn8heb/2