Skip to content
This repository has been archived by the owner on Sep 6, 2018. It is now read-only.

Fonts: Only one 'register' called per font family #78

Closed
mortenbekditlevsen opened this issue Aug 23, 2017 · 2 comments
Closed

Fonts: Only one 'register' called per font family #78

mortenbekditlevsen opened this issue Aug 23, 2017 · 2 comments

Comments

@mortenbekditlevsen
Copy link

I am not certain if it is possible to have an entire font family in the same file, but in case you have each font weight in a separate file (like RobotoSlab-Light.ttf, RobotoSlab-Bold.ttf, etc.) then only the first one will be registered - since the test for registering only queries to see if the font family is present.

For iOS/Swift 3 this can be fixed by changing the Font convenience initializer in the fonts/swift3.stencil to have the following check:

if !UIFont.fontNames(forFamilyName: font.family).contains(font.name) {
  font.register()
}

Do you agree that this is a sensible way to perform the check? If so, I can create a pull request with changes for all swift versions and both iOS/macOS.

@mortenbekditlevsen
Copy link
Author

Haha, just saw that this exact change was committed 11 hours ago, so the issue is already resolved. Closing.

@AliSoftware
Copy link
Collaborator

Thanks for reporting the issue!

Actually the problem was already reported and the PR submitted and merged so should be included in the next release 😉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants