Skip to content

fix: Cannot read properties of undefined (reading 'getTransform') #766

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/glyph-inspector.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ <h1>Free Software</h1>
html += '<dt>leftSideBearing</dt><dd>'+glyph.leftSideBearing+'</dd>';
}
html += '</dl>';
if (glyph.numberOfContours > 0) {
if (glyph.numberOfContours > 0 && window.font.variation) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But couldn't there be glyphs with multiple contours but no variation axes? So I think the check for window.font.variation should happen inside, and depending on its availability, either the regular glyph or the transformed variant should be used.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not very familiar with this professional knowledge. I only encountered this issue during use, so there might be some oversights in the fix. Thank you for pointing it out.

var contours = glyph.getContours(window.font.variation.getTransform(glyph, window.fontOptions.variation).points);
html += 'contours:<div id="glyph-contours">' + contours.map(contourToString).join('\n') + '</div>';
} else if (glyph.isComposite) {
Expand Down