@@ -116,24 +116,24 @@ extension AutoScrollTextField {
116116 var transfrom = AffineTransform ( )
117117 transfrom. scale ( x: 1.0 , y: - 1.0 )
118118 transfrom. translate ( x: leftMargin- offsetX, y: - bounds . height + abs( font!. descender) )
119-
119+
120120 path. transform ( using: transfrom)
121-
121+
122122 let textColor = self . textColor ?? NSColor . labelColor
123-
123+
124124 let leftGradientStart = ( offsetX- leftMargin) / path. bounds. width
125125 let leftGradientEnd = offsetX / path. bounds. width
126-
126+
127127 let rightGradientStart = ( bounds. width - rightMargin - leftMargin + offsetX) / path. bounds. width
128128 let rightGradientEnd = ( bounds. width - leftMargin + offsetX) / path. bounds. width
129-
129+
130130 let gradient = NSGradient ( colorsAndLocations:
131131 ( textColor. withAlphaComponent ( 0 ) , leftGradientStart) ,
132132 ( textColor, leftGradientEnd) ,
133133 ( textColor, rightGradientStart) ,
134134 ( textColor. withAlphaComponent ( 0 ) , rightGradientEnd)
135135 )
136-
136+
137137 textColor. setFill ( )
138138 gradient? . draw ( in: path, angle: 0 )
139139 }
@@ -143,18 +143,25 @@ extension AutoScrollTextField {
143143final class BezierLayoutManager : NSLayoutManager {
144144
145145 var path : NSBezierPath ?
146-
146+
147147 // note: this method may call multiple times to show entity string
148- override func showCGGlyphs( _ glyphs: UnsafePointer < CGGlyph > , positions: UnsafePointer < NSPoint > , count glyphCount: Int , font: NSFont , matrix textMatrix: AffineTransform , attributes: [ NSAttributedString . Key : Any ] = [ : ] , in graphicsContext: NSGraphicsContext ) {
149-
148+ override func showCGGlyphs(
149+ _ glyphs: UnsafePointer < CGGlyph > ,
150+ positions: UnsafePointer < CGPoint > ,
151+ count glyphCount: Int ,
152+ font: NSFont ,
153+ textMatrix: CGAffineTransform ,
154+ attributes: [ NSAttributedString . Key : Any ] = [ : ] ,
155+ in CGContext: CGContext
156+ ) {
150157 if path == nil {
151158 path = NSBezierPath ( )
152159 path? . move ( to: . zero)
153160 }
154161
155162 path? . append ( withCGGlyphs: glyphs, count: glyphCount, in: font)
156163 }
157-
164+
158165}
159166
160167#if canImport(SwiftUI) && DEBUG
0 commit comments