question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some fonts causes load error "already has key" with Safari

See original GitHub issue

Loading MuseoSans300Italic.otf or BrandonText_Medium.otf causes the entriesToObject method to crash.

Current Behavior

entriesToObject, in Safari seems to fail if it gets an entries list with numbered keys out of order. Eg.

entries = 
[
[0, [380]],
[1, [647]],
[1200, [648]],
[2, [649]]
]

will crash when trying to add key = 2 (last in array). It seems like Safari has an error that when adding o[1200]= [648], it also adds o[2] = NaN. This causes o.hasOwnProperty(key) to trigger an error.

Possible Solution

Is the o.hasOwnProperty(key) test necessary? Can it be expanded to do o.hasOwnProperty(key) && !isNaN(o[key])? Both work for the font I’ve encountered problems with.

Your Environment

  • Version used: 0.6.9
  • Font used: MuseoSans300Italic.otf, BrandonText_Medium.otf
  • Browser Name and version: Safari 10.1
  • Operating System and version (desktop or mobile): Macos 10.12.4

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
neiltroncommented, Apr 28, 2017

I’m also seeing this issue in Safari using Regina Black. It seems to be happening when calling opentype.load twice on the same font (though I’ve only seen it happen with this one font). @casperno’s proposed fix works for me.

Edit: I submitted a preemptive PR in case you decide this is an acceptable solution.

0reactions
fdbcommented, Jul 18, 2017

I was on holiday in the last weeks. I just fixed this, and release 0.7.3, which contains the fix, should appear on npm soon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Safari fonts messed up - Apple Community
A while ago I changed something about Safari that caused displayed fonts to get all messed up. Now I want to reset it...
Read more >
How to fix font problems on your Mac that can make Safari and ...
Open Font Book, click on All Fonts, then click on any of them in the list and press Command-A to Select All. Then...
Read more >
[troika-three-text] IOS Safari Loading Issues #88 - GitHub
Anyways I've recently put this on a site I'm still working on and noticed some inconsistencies on mobile. Sometimes everything would load but...
Read more >
Fix font size issue on Mobile Safari (iPhone) where text is ...
1) Visit http://www.panabee.com. 2) Conduct a search for a domain name. The boxes on the left side show the incorrect font sizes.
Read more >
Troubleshooting Connect Fonts for Safari Extension - Extensis
Make sure Connect Fonts for Safari Has Been Enabled in the Browser Itself · In Safari, navigate to Safari>Preferences>Websites · In the Extensions ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found