You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Oddly enough, it looks like with macOS there's yet another Awesome.bundle in fontBundle. Changing the load code to the following appears to work on iOS and macOS.
staticfunc load(type:AwesomeFont, from bundle:Bundle?=nil){
guard !Font.fontNames(forFamilyName: type.description).contains(type.memberName)else{return}letfontBundle:Bundle!
if bundle ==nil{
fontBundle =Bundle(for:Fonts.self)}else{
fontBundle = bundle
}varawesomeBundle= fontBundle!
while true {
guard
let url = awesomeBundle.url(forResource:"Awesome", withExtension:"bundle"),let subBundle =Bundle(url: url)else{
break
}
awesomeBundle = subBundle
}letfontURL= awesomeBundle.url(forResource: type.file, withExtension:"ttf")
guard let url = fontURL else{return}letdata=try!Data(contentsOf: url asURL)letprovider=CGDataProvider(data: data asCFData)letfont=CGFont(provider!)varerror:Unmanaged<CFError>?
if CTFontManagerRegisterGraphicsFont(font!,&error)== false {leterrorDescription:CFString=CFErrorCopyDescription(error!.takeUnretainedValue())letnsError= error!.takeUnretainedValue()asAnyObjectas!NSErrorNSException(name:NSExceptionName.internalInconsistencyException, reason: errorDescription asString, userInfo:[NSUnderlyingErrorKey: nsError]).raise()}}
In iOS everything works great with using cocoapods, but when using Awesome in a mac app I get the exception
Is there a step that I'm missing?
In
Fonts.swift
the following code returnsnil
.The text was updated successfully, but these errors were encountered: