@craft-native/ios 0.0.502 → 0.0.503
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/package.json
CHANGED
|
@@ -11632,10 +11632,14 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
|
|
|
11632
11632
|
if let spacing = styleNumber(style["letterSpacing"]) { attributes[.kern] = spacing }
|
|
11633
11633
|
addTextDecorationAttributes(style, to: &attributes)
|
|
11634
11634
|
if let shadow = textShadow(style) { attributes[.shadow] = shadow }
|
|
11635
|
+
// A CSS line box may be shorter than its font while glyphs paint outside
|
|
11636
|
+
// it. UIKit clips that same paragraph inside a UILabel. Preserve the
|
|
11637
|
+
// resolved font metrics for layout and drawing, including custom faces
|
|
11638
|
+
// whose ascenders exceed their point size and Dynamic Type scaling.
|
|
11635
11639
|
if let lineHeight = styleNumber(style["lineHeight"]) {
|
|
11636
11640
|
let paragraph = NSMutableParagraphStyle()
|
|
11637
|
-
paragraph.minimumLineHeight = lineHeight
|
|
11638
|
-
paragraph.maximumLineHeight = lineHeight
|
|
11641
|
+
paragraph.minimumLineHeight = max(lineHeight, label.font.lineHeight)
|
|
11642
|
+
paragraph.maximumLineHeight = max(lineHeight, label.font.lineHeight)
|
|
11639
11643
|
paragraph.alignment = label.textAlignment
|
|
11640
11644
|
attributes[.paragraphStyle] = paragraph
|
|
11641
11645
|
}
|
|
@@ -11689,8 +11693,8 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
|
|
|
11689
11693
|
if let spacing = styleNumber(style["letterSpacing"]) { attributes[.kern] = spacing }
|
|
11690
11694
|
if let lineHeight = styleNumber(style["lineHeight"]) {
|
|
11691
11695
|
let paragraph = NSMutableParagraphStyle()
|
|
11692
|
-
paragraph.minimumLineHeight = lineHeight
|
|
11693
|
-
paragraph.maximumLineHeight = lineHeight
|
|
11696
|
+
paragraph.minimumLineHeight = max(lineHeight, font.lineHeight)
|
|
11697
|
+
paragraph.maximumLineHeight = max(lineHeight, font.lineHeight)
|
|
11694
11698
|
attributes[.paragraphStyle] = paragraph
|
|
11695
11699
|
}
|
|
11696
11700
|
addTextDecorationAttributes(style, to: &attributes)
|
|
@@ -11717,8 +11721,8 @@ final class CraftNativeScreenController: UIViewController, UIScrollViewDelegate,
|
|
|
11717
11721
|
// then paints a second line outside the field instead of scrolling.
|
|
11718
11722
|
if singleLine { paragraph.lineBreakMode = .byClipping }
|
|
11719
11723
|
if let lineHeight = styleNumber(style["lineHeight"]) {
|
|
11720
|
-
paragraph.minimumLineHeight = lineHeight
|
|
11721
|
-
paragraph.maximumLineHeight = lineHeight
|
|
11724
|
+
paragraph.minimumLineHeight = max(lineHeight, font.lineHeight)
|
|
11725
|
+
paragraph.maximumLineHeight = max(lineHeight, font.lineHeight)
|
|
11722
11726
|
}
|
|
11723
11727
|
attributes[.paragraphStyle] = paragraph
|
|
11724
11728
|
addTextDecorationAttributes(style, to: &attributes)
|