ArtSabintsev/FontBlaster

FontBlaster hangs execution

gmarm opened this issue ยท 7 comments

gmarm commented

I'm trying to load a custom .ttf font, however as soon at the program reaches

let fontRef = CGFont(dataProvider)
, let fontRef = CGFont(dataProvider), the program just hangs.

No error, no exception.

I'm wondering whether this is an issue of FontBlaster or the font itself.

gmarm commented

Wow just letting you know this is probably not an issue with FontBlaster.

I set my custom font directly in a UIButton in a storyboard and for some reason this caused that line to hang the program.

Is there some improvement to be made or is this something that should simply be avoided?

To be honest, no clue. I'd just load an existing font in the button, and swap it out at runtime to the FontBlaster loaded font.

Closing this issue as you've deemed it to be unrelated.

Hey! @gmarm, got exactly the same hang situation. Xcode 8.2.1 and iOS 10.2 Simulator. Reproducible every time.

After some research discovered it is apparently a known iOS bug and related SO question

Thankfully with also known workaround of calling _ = UIFont() before the deadlocking code in loadFont solves the issue.

The issue is real and probably a workaround should be introduced inside FontBlaster. I'll leave it to you @ArtSabintsev where you'd like to make the call to UIFont().

Wow, what a weird bug. I'll incorporate the fix very soon.

Thanks for finding the solution.

Fixed and available via all package managers: https://github.com/ArtSabintsev/FontBlaster/releases/tag/3.0.1

Thanks guys!

Looks like this fix breaks Swift Package Manager support (#23)

cc @sshhawwnn

Oh, it's because I didnt' explicitly add an import UIKit as Xcode usually takes care of that for iOS projects, but looks like building via Swift PM, does not.

Fix incoming for #23, @sshhawwnn. Sorry to ping everyone else in this thread, but thought it might be interesting.