File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Sources/YMatterType/Typography Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,15 @@ extension Typography {
4747 )
4848 scaledLineHeight = metrics. scaledValue ( for: lineHeight, compatibleWith: traitCollection)
4949 }
50+ } else if fontFamily is SystemFontFamily {
51+ // In case of a fixed System font, we still need to "scale" the font
52+ // to adjust it to the correct traits.
53+ let metrics = UIFontMetrics ( forTextStyle: textStyle)
54+ font = metrics. scaledFont (
55+ for: font,
56+ maximumPointSize: fontSize, // no change in size
57+ compatibleWith: traitCollection
58+ )
5059 }
5160
5261 // We need to adjust the baseline so that the text will appear vertically centered
@@ -128,7 +137,7 @@ extension Typography {
128137private extension Typography {
129138 func generateFixedFont( compatibleWith traitCollection: UITraitCollection ? ) -> UIFont {
130139 var traits = traitCollection
131- if !isFixed && fontFamily is SystemFontFamily {
140+ if fontFamily is SystemFontFamily {
132141 // System font already considers accessibility BoldText when
133142 // we get the scaled font via `UIFontMetrics.scaledFont(for:compatibleWith:)`,
134143 // so we pass a non-bold trait collection when generating the fixed font, so
You can’t perform that action at this time.
0 commit comments