How to parse the PingFangUI.ttc on iOS 18?

I've noticed that the font file PingFang.ttc is no longer in /System/Library/Fonts/LanguageSupport/ on iOS 18. And I use CoreText APIs get the new font file, which is int the FontServices.framework and named PingFangUI.ttc.

But it doesn't seem to be a regular TrueType font collection. It can't be parsed correctly by stb_truetype. I copied this file to my mac, and it can't be opened by Font.app either, which says it doesn't contain installable fonts. It also can’t pass font validation (Font.app → File → Verify File), saying “System validation failed”, I don't know what that means.

So I tried to read the binary of that file. I've noticed that the ‘CFF ‘ table is missing in the new font file, and there is a new table 'hvgl'. But I can't find any documentation for this table. Maybe this is a new format. And what confuses me is that the TTC header of the new font file has not changed, same as the old PingFang.ttc file, with a ‘ttcf’ tag, and majorVersion is 2 minorVersion is 0.

Please tell me how to parse the new format, so maybe I can modify stb_truetype to get our app to work.

Thanks!

I am also running into this issue as well.

Not sure why this was necessary but it also means we can no longer access this font to raster any of its glyphs in Freetype for example.

I used libfreetype to parse it, and the error code is

FT_ERRORDEF_( Locations_Missing,                           0x90,
                "locations (loca) table missing" )

Look like it is missing loca table.

It would be nice if apple could share the specification of the hvgl table.

How to parse the PingFangUI.ttc on iOS 18?
 
 
Q