7
7
8
8
import AppKit
9
9
import CodeEditTextView
10
+ import CodeEditTextViewObjC
10
11
11
12
public protocol GutterViewDelegate : AnyObject {
12
13
func gutterViewWidthDidUpdate( newWidth: CGFloat )
@@ -55,10 +56,6 @@ public class GutterView: NSView {
55
56
true
56
57
}
57
58
58
- override public var wantsDefaultClipping : Bool {
59
- false
60
- }
61
-
62
59
public init (
63
60
font: NSFont ,
64
61
textColor: NSColor ,
@@ -71,11 +68,11 @@ public class GutterView: NSView {
71
68
self . delegate = delegate
72
69
73
70
super. init ( frame: . zero)
74
- clipsToBounds = false
71
+ clipsToBounds = true
75
72
wantsLayer = true
76
73
layerContentsRedrawPolicy = . onSetNeedsDisplay
77
74
translatesAutoresizingMaskIntoConstraints = false
78
- layer? . masksToBounds = false
75
+ layer? . masksToBounds = true
79
76
80
77
NotificationCenter . default. addObserver (
81
78
forName: TextSelectionManager . selectionChangedNotification,
@@ -165,6 +162,16 @@ public class GutterView: NSView {
165
162
}
166
163
167
164
context. saveGState ( )
165
+
166
+ context. setAllowsAntialiasing ( true )
167
+ context. setShouldAntialias ( true )
168
+ context. setAllowsFontSmoothing ( false )
169
+ context. setAllowsFontSubpixelPositioning ( true )
170
+ context. setShouldSubpixelPositionFonts ( true )
171
+ context. setAllowsFontSubpixelQuantization ( true )
172
+ context. setShouldSubpixelQuantizeFonts ( true )
173
+ ContextSetHiddenSmoothingStyle ( context, 16 )
174
+
168
175
context. textMatrix = CGAffineTransform ( scaleX: 1 , y: - 1 )
169
176
for linePosition in textView. layoutManager. visibleLines ( ) {
170
177
if selectionRangeMap. intersects ( integersIn: linePosition. range) {
0 commit comments