Closed matthewnaples closed 9 months ago
Hello,
For Orbit icons to work, it is necessary to call Font.registerOrbitFonts()
anywhere during the app start (or SwiftUI preview) once.
The following tutorial covers this part with the optional custom fonts used for Orbit text components.
https://kiwicom.github.io/orbit-swiftui/tutorials/orbit/01-01-hello_orbit
Just to add to this, while this is correct the documentation also states:
If you omit this optional step, Orbit components will use default iOS system fonts.
If you're not licensed to use this font and would like to use custom or the system fonts you also don't get the icons as they are loaded as a font as part of the registerOrbitFonts()
call.
How does one use default fonts and continue to use the bundled icons?
I managed to work around this by manually calling the following in my app code:
if let iconsFontURL = Bundle.orbit.url(forResource: "Icons.ttf", withExtension: nil) {
_ = Font.registerFont(at: iconsFontURL)
}
But I think it would help if the loading of the icons was decoupled from the loading of the licensed fonts.
Thanks for pointing that out.
The original assumption was that Orbit Icons would be mostly suitable in combination with matching Orbit fonts (otherwise, SF Symbols might be a better choice). But it indeed makes sense to decouple it.
Hello, when I run the storybook in the simulator (haven't checked on device), the icons don't seem to be encoded properly. This also happens when I attempt to use the icons in another project.
Is there something I need to update on my end to make sure they encode properly? Thanks!