Rightpoint / BonMot

Beautiful, easy attributed strings in Swift
MIT License
3.54k stars 196 forks source link

Add AdaptiveStyle based on UIFontMetrics #361

Closed ndonald2 closed 5 years ago

ndonald2 commented 5 years ago

Purpose

Adds a new AdaptiveStyle enum case and adaptation implementation based on UIFontMetrics available in iOS 11+

Context

The existing AdaptiveStyle modes are all fantastic, but are in some part workarounds for UIKit's previous lack of support for adapting non-system fonts to the user's preferred content size category. This change adds a new AdaptiveStyle enum case and auto-scaling implementation compatible with the existing AdaptiveTextContainer system which adopts the UIFontMetrics API for scaling any font with the same size curve used by the built-in system text styles.

Guidance

Review from @ZevEisenberg or someone on the BonMot maintainers team. See inline notes for additional context.

Related to https://github.com/Rightpoint/BonMot/issues/293

PS - Hi @ZevEisenberg ! I hope things are well at Rightpoint. I've continued to be a big fan of BonMot since I parted ways with RZ.

ZevEisenberg commented 5 years ago

Hey, @ndonald2! Thanks so much for the PR! I've been wanting to update BonMot's adaptive font support since it was updated in iOS, so I'm excited to look at this. I'll see what I can do on my hack day this week.