@momo-kits/native-kits 0.167.1-beta.17 → 0.167.1-beta.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ios/Title/Title.swift
CHANGED
|
@@ -155,7 +155,7 @@ public struct Title: View {
|
|
|
155
155
|
let fontSize = fontScale(titleFontSize)
|
|
156
156
|
// lineSpacing is added on top of the font's natural line height, not on top of fontSize.
|
|
157
157
|
let lineSpacing = max(0, fontScale(titleLineHeight)
|
|
158
|
-
- UIFont.systemFont(ofSize: fontSize
|
|
158
|
+
- UIFont.systemFont(ofSize: fontSize).lineHeight)
|
|
159
159
|
|
|
160
160
|
return SwiftUI.Text(title)
|
|
161
161
|
.font(.system(size: fontSize, weight: titleFontWeight))
|
|
@@ -123,27 +123,13 @@ private func momoFont(size: CGFloat, weight: Font.Weight, family: String) -> Fon
|
|
|
123
123
|
return .custom(name, fixedSize: size)
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
//
|
|
127
|
-
private func
|
|
128
|
-
if let name = momoFontName(family: family, weight:
|
|
126
|
+
// lineHeight is identical across weights of a family, so the regular face is enough.
|
|
127
|
+
private func momoLineHeight(size: CGFloat, family: String) -> CGFloat {
|
|
128
|
+
if let name = momoFontName(family: family, weight: .regular),
|
|
129
129
|
let font = UIFont(name: name, size: size) {
|
|
130
|
-
return font
|
|
131
|
-
}
|
|
132
|
-
return .systemFont(ofSize: size, weight: uiFontWeight(weight))
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
func uiFontWeight(_ weight: Font.Weight) -> UIFont.Weight {
|
|
136
|
-
switch weight {
|
|
137
|
-
case .ultraLight: return .ultraLight
|
|
138
|
-
case .thin: return .thin
|
|
139
|
-
case .light: return .light
|
|
140
|
-
case .medium: return .medium
|
|
141
|
-
case .semibold: return .semibold
|
|
142
|
-
case .bold: return .bold
|
|
143
|
-
case .heavy: return .heavy
|
|
144
|
-
case .black: return .black
|
|
145
|
-
default: return .regular
|
|
130
|
+
return font.lineHeight
|
|
146
131
|
}
|
|
132
|
+
return UIFont.systemFont(ofSize: size).lineHeight
|
|
147
133
|
}
|
|
148
134
|
|
|
149
135
|
public struct MomoText: View {
|
|
@@ -248,7 +234,7 @@ public struct MomoText: View {
|
|
|
248
234
|
let fontSize = fontScale(typography.fontSize)
|
|
249
235
|
// lineSpacing is added on top of the font's natural line height, not on top of fontSize.
|
|
250
236
|
let lineSpacing = max(0, fontScale(typography.lineHeight)
|
|
251
|
-
-
|
|
237
|
+
- momoLineHeight(size: fontSize, family: theme.font))
|
|
252
238
|
|
|
253
239
|
var text = baseText
|
|
254
240
|
.font(momoFont(size: fontSize, weight: typography.fontWeight, family: theme.font))
|
package/ios/native-kits.podspec
CHANGED