@@ -92,12 +92,12 @@ public class TextLayoutManager: NSObject {
9292
9393 /// The maximum width available to lay out lines in, used to determine how much space is available for laying out
9494 /// lines. Evals to `.greatestFiniteMagnitude` when ``wrapLines`` is `false`.
95- var maxLineLayoutWidth : CGFloat {
95+ public var maxLineLayoutWidth : CGFloat {
9696 wrapLines ? wrapLinesWidth : . greatestFiniteMagnitude
9797 }
9898
9999 /// The width of the space available to draw text fragments when wrapping lines.
100- var wrapLinesWidth : CGFloat {
100+ public var wrapLinesWidth : CGFloat {
101101 ( delegate? . textViewportSize ( ) . width ?? . greatestFiniteMagnitude) - edgeInsets. horizontal
102102 }
103103
@@ -169,6 +169,9 @@ public class TextLayoutManager: NSObject {
169169 public func estimateLineHeight( ) -> CGFloat {
170170 if let _estimateLineHeight {
171171 return _estimateLineHeight
172+ } else if let estimate = renderDelegate? . estimatedLineHeight ( ) {
173+ _estimateLineHeight = estimate
174+ return estimate
172175 } else {
173176 let string = NSAttributedString ( string: " 0 " , attributes: delegate? . layoutManagerTypingAttributes ( ) ?? [ : ] )
174177 let typesetter = CTTypesetterCreateWithAttributedString ( string)
@@ -177,8 +180,9 @@ public class TextLayoutManager: NSObject {
177180 var descent : CGFloat = 0
178181 var leading : CGFloat = 0
179182 CTLineGetTypographicBounds ( ctLine, & ascent, & descent, & leading)
180- _estimateLineHeight = ( ascent + descent + leading) * lineHeightMultiplier
181- return _estimateLineHeight!
183+ let height = ( ascent + descent + leading) * lineHeightMultiplier
184+ _estimateLineHeight = height
185+ return height
182186 }
183187 }
184188
0 commit comments