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.

opentype.js having problem processing ttf font extracted from ttc

See original GitHub issue

OK, I will admit this is a confusing case, but this is what we believe we know so far:

  • OS X El Capitan comes with a new default system font for Chinese users, aka PingFang. So I am trying to analyze it with opentype.js’ Font Inspector.
  • Between their Developer Preview Beta1 and Beta2, Apple made some changes to this font, naturally, I want to see what’s the difference.

The steps I use is as following:

  1. get the font from /System/Library/Fonts/
  2. unpack with ttc2ttf https://gist.github.com/kayahr/2479682
  3. load using http://nodebox.github.io/opentype.js/font-inspector.html

Problem is: while the resulting ttf from DP1 works, the ones from DP2 font doesn’t, font inspector gives us TypeError: Cannot read property 'glyphIndexMap' of null which I believe is an error from opentype.js, not just the Font Inspector script.

Initially we believe this is a problem with ttc2ttf, because DP2 ttc is using some kind of offsets to give the same ttf payload 2 different names (apologize in advance for using the wrong terms, don’t know the spec well enough myself), ie. both DP1 and DP2 PingFang.ttc contains only 12 actual font files, but DP2 adds extra alias to each fonts, so 24 names show up.

But using fonttools and Apple Font Book we are not able to find any faults with these files.

So I have a theory, somewhere in opentype.js, there is a bug that’s only triggered under this scenario. Would you take a look when available?

I will share the DP2 PingFang.ttc here in case you need it (probably against its font license, but hopefully for a good cause)

https://www.dropbox.com/s/qnfy6q41zkji330/PingFang_DP2.ttc.zip?dl=0

For an introduction on PingFang, see my blog post: http://bitinn.net/11280/

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
blackgearcommented, Aug 2, 2016

@Jolg42 “Synalyze It! - much more than a Hex Editor for Mac OS X”

0reactions
Jolg42commented, Aug 2, 2016

@blackgear Thank you 😉 It works well! I will update the awesome-typography repo asap!

Read more comments on GitHub >

github_iconTop Results From Across the Web

opentype.js having problem processing ttf font extracted from ttc
OS X El Capitan comes with a new default system font for Chinese users, aka PingFang . So I am trying to analyze...
Read more >
c# - Open type font collections are causing errors with ...
I've tried converting the .ttc to a .ttf file with a website. Since the c stands for collection, it should be possible to...
Read more >
@react-pdf/fontkit - npm
An advanced font engine for Node and the browser. ... They all inherit from the TTFFont class and have the same public API,...
Read more >
Fonts | Everything I know - My Knowledge Wiki
Source Sans Pro - Set of OpenType fonts that have been designed to work well in ... Getfonts - Extract and meaningfully name...
Read more >
Truetype font software - Luc Devroye
Fontdue is a simple, no_std (does not use the standard library for portability), pure Rust, TrueType (.ttf/.ttc) & OpenType (.otf) font ...
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