diff --git a/VDS/Components/Label/Attributes/TextStyleLabelAttribute.swift b/VDS/Components/Label/Attributes/TextStyleLabelAttribute.swift index a161d580..5dcdccf9 100644 --- a/VDS/Components/Label/Attributes/TextStyleLabelAttribute.swift +++ b/VDS/Components/Label/Attributes/TextStyleLabelAttribute.swift @@ -63,18 +63,15 @@ public struct TextStyleLabelAttribute: LabelAttributeModel { //set lineHeight if textStyle.lineHeight > 0.0 { - let lineHeight = textStyle.lineHeight - let adjustment = lineHeight > textStyle.font.lineHeight ? 2.0 : 1.0 - let baselineOffset = (lineHeight - textStyle.font.lineHeight) / 2.0 / adjustment + let lineHeight = textStyle.lineHeight + abs(textStyle.edgeInsets.bottom) + abs(textStyle.edgeInsets.top) let paragraph = NSMutableParagraphStyle().with { - $0.maximumLineHeight = lineHeight + $0.maximumLineHeight = lineHeight $0.minimumLineHeight = lineHeight $0.alignment = textPosition.value $0.lineBreakMode = lineBreakMode } attributedString.removeAttribute(.baselineOffset, range: range) attributedString.removeAttribute(.paragraphStyle, range: range) - attributedString.addAttribute(.baselineOffset, value: baselineOffset, range: range) attributedString.addAttribute(.paragraphStyle, value: paragraph, range: range) } else if textPosition != .left { @@ -87,3 +84,4 @@ public struct TextStyleLabelAttribute: LabelAttributeModel { } } } +