Fix layout issue with title font sizing in attributed strings
Fixes a critical bug where title labels (icon and "Welcome to" text) were rendering at approximately 1/4 screen size on iPad when using attributed strings without explicit font attributes.
Problem
The updateFontSize(_:) method in UIOnboardingTitleLabel was calculating font size multipliers incorrectly when attributed strings didn't have font attributes pre-set. This caused the title labels to render at the wrong size on iPad.
Root Cause
The original implementation (from PR #27) captured originalFont = font before updating the label's font property, then used this stale value to calculate multipliers. When attributed strings had no font attributes set, the multiplier calculation would use mismatched font sizes, resulting in incorrect rendering.
Additionally, the method only updated fonts that were already present in the attributed string, leaving ranges without font attributes unstyled.
Solution
Updated updateFontSize(_:) to:
- Update the label's base font first - Sets
self.fontto the target size before any calculations - Handle attributed strings with font attributes - Calculates multipliers using the updated base font, preserving PR #27's multi-font feature
- Handle attributed strings without font attributes - Explicitly applies the base font to ranges that don't have a font set
Screenshots
Before
After