Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use more than one font in a Mac Catalyst app #249

Open
DerekK19 opened this issue Mar 24, 2020 · 0 comments
Open

Unable to use more than one font in a Mac Catalyst app #249

DerekK19 opened this issue Mar 24, 2020 · 0 comments

Comments

@DerekK19
Copy link

DerekK19 commented Mar 24, 2020

In a Mac Catalyst app, the call to UIFont.fontNames(forFamilyName: "Font Awesome 5 Free") only returns one font even if more than one font is loaded. If two styles are used in an app, and the second one is used more than once the code will attempt to load the font again. The following unit test will fail (with an NSInternalConsistencyError tracing back to line 255 on FontAwesome.swift. the errors description reads "The file has already been registered in the specified scope". the regular style is used twice (at different sizes) and the code tries to load it twice.

This ONLY happens when running the tests in a Mac device (not in an iOS device) and is possibly due to a Mac Catalyst bug. It does mean however that Mac Catalyst applications will fail if they use more than one FontAwesome font.

     func testFontsShouldBeLoadedIfFontUsedTwice() {
        let solidFont = UIFont.fontAwesome(ofSize: 200, style: .solid)
        let regularFont = UIFont.fontAwesome(ofSize: 200, style: .regular)
        let regularFontSmaller = UIFont.fontAwesome(ofSize: 100, style: .regular)
        XCTAssertNotNil(solidFont, "Solid font should be loaded.")
        XCTAssertNotNil(regularFont, "Regular font should be loaded.")
        XCTAssertNotNil(regularFontSmaller, "Smaller regular font should be loaded.")
    }

The unit test crashes on the 'let regularFontSmaller =' line

chriszielinski added a commit to chriszielinski/FontAwesome.swift that referenced this issue Mar 29, 2020
christophertrudel pushed a commit to christophertrudel/FontAwesome.swift that referenced this issue Mar 10, 2021
christophertrudel pushed a commit to christophertrudel/FontAwesome.swift that referenced this issue Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant