Post

Replies

Boosts

Views

Activity

Reply to Registering custom fonts from a framework in a widget extension
I had this same issue - I was using essentially the exact same code, registering the font with CTFontManagerRegisterGraphicsFont, which worked just fine in my app, but when I tried to use the font in my widget view, it caused the entire view to not render. Eventually I stumbled across this thread - as suggested there, I switched to using CTFontManagerRegisterFontsForURL and it worked - it rendered properly in both the app and the widget extension. While I don't have context on exactly the difference between the two methods, Apple documentation does note that Fonts that are backed by files should be registered using CTFontManagerRegisterFontsForURL(_:_:_:), which seems to suggest CTFontManagerRegisterFontsForURL is the appropriate method to use here in any case.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Apr ’22