문제

I am trying to use CTFontDescriptorMatchFontDescriptorsWithProgressHandler to download a font. As same as the example provided by Apple: https://developer.apple.com/library/ios/samplecode/DownloadFont/Listings/DownloadFont_ViewController_m.html

It works fine, and I can display the downloaded font in my application, but after I restart my application I can not create the UIFont with fontWithName:size:, and [UIFont familyNames] does not include the downloaded font. To solve this problem, I record the font path and use CTFontManagerRegisterFontsForURL to register the font when start the application. After doing this, everything is OK on simulator, but not works on device!!! Help!!!

도움이 되었습니까?

해결책

Finally, I found the problem is that CTFontManagerRegisterFontsForURL will fail when the font file url is something like: /var/mobile/.../XXX.ttc, and after I fixed the url to be file:///var/mobile/.../XXX.ttc, everything will be OK.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top