Bug 186366 - [Cocoa] Allow app-bundled fonts to work in WKWebView
Summary: [Cocoa] Allow app-bundled fonts to work in WKWebView
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-06-06 15:48 PDT by Simon Fraser (smfr)
Modified: 2018-06-26 14:34 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2018-06-06 15:48:51 PDT
Trying to load a custom font (which starts off encrypted) by creating a CGFontRef with CGFontCreateWithDataProvider(), then registering it in the app with CGFontManagerRegisterGraphicsFont().

The CSS landed in the WKWebView references the font just via font-family, but this doesn't work.

We tried adding the font to the info.plist (under "Fonts provided by application") but this didn't' work (not clear if this is the PostScript name or the full name).

It seems like a 3rd party app should be able to do this. What's the best way?
Comment 1 Myles C. Maxfield 2018-06-18 15:37:03 PDT
iOS or macOS?
Comment 2 Myles C. Maxfield 2018-06-18 15:40:15 PDT
Are you sure you don't mean CTFontManagerRegisterGraphicsFont?
Comment 3 Myles C. Maxfield 2018-06-18 15:45:58 PDT
CTFontManagerRegisterGraphicsFont only registers it for the current process.

On macOS, there are tons of ways to register a font for multiple processes. On iOS, the current only way is with a configuration profile.

I do agree that it should be easier for an iOS application to register a font for its own process and the associated web processes, but not for unrelated other app processes.
Comment 4 Simon Fraser (smfr) 2018-06-19 15:31:10 PDT
iOS. And I do mean CGFontManagerRegisterGraphicsFont.
Comment 5 Simon Fraser (smfr) 2018-06-20 08:39:12 PDT
Oh, maybe I did mean CTFontManagerRegisterGraphicsFont(). I was confused by the fact that it takes a CGFontRef.
Comment 6 Radar WebKit Bug Importer 2018-06-20 16:50:20 PDT
<rdar://problem/41310405>
Comment 7 Myles C. Maxfield 2018-06-20 21:28:48 PDT
<rdar://problem/33725014>
Comment 8 Myles C. Maxfield 2018-06-26 14:34:14 PDT
<rdar://problem/20244953>