77
88import AppKit
99import CodeEditTextView
10+ import CodeEditTextViewObjC
1011
1112public protocol GutterViewDelegate : AnyObject {
1213 func gutterViewWidthDidUpdate( newWidth: CGFloat )
@@ -55,10 +56,6 @@ public class GutterView: NSView {
5556 true
5657 }
5758
58- override public var wantsDefaultClipping : Bool {
59- false
60- }
61-
6259 public init (
6360 font: NSFont ,
6461 textColor: NSColor ,
@@ -71,11 +68,11 @@ public class GutterView: NSView {
7168 self . delegate = delegate
7269
7370 super. init ( frame: . zero)
74- clipsToBounds = false
71+ clipsToBounds = true
7572 wantsLayer = true
7673 layerContentsRedrawPolicy = . onSetNeedsDisplay
7774 translatesAutoresizingMaskIntoConstraints = false
78- layer? . masksToBounds = false
75+ layer? . masksToBounds = true
7976
8077 NotificationCenter . default. addObserver (
8178 forName: TextSelectionManager . selectionChangedNotification,
@@ -165,6 +162,16 @@ public class GutterView: NSView {
165162 }
166163
167164 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+
168175 context. textMatrix = CGAffineTransform ( scaleX: 1 , y: - 1 )
169176 for linePosition in textView. layoutManager. visibleLines ( ) {
170177 if selectionRangeMap. intersects ( integersIn: linePosition. range) {
0 commit comments