Overview
The SDK provides a utility to load fonts from multiple sources, including system fonts and custom fonts stored in the app’s bundle. This ensures that your selected fonts are applied correctly, even with varying font styles or weights.Font Sources and Resolution Order
TheUIFont extension in the SDK retrieves fonts using the following order:
- Default System Fonts: Default iOS fonts such as Default, Serif, Rounded, and Monospaced.
- Custom Fonts in Bundle: Fonts registered in the app’s
main.bundle. - System Fonts: Default iOS fonts such as SF Pro, Helvetica, and others.
Font Weight Handling
The SDK interprets symbolic traits such asbold or italic to create the desired font weight. A helper method, systemFont(for:fontWeight:size:), ensures the appropriate weight is applied to system fonts when no custom font is available.
Dynamic Type Support
TheUIFontMetrics utility scales fonts dynamically based on text styles like .body or .title1. This ensures accessibility and consistent typography across different devices and user settings.