Skip to content

Commit 4cc8772

Browse files
committed
Enabled anti aliasing and font smoothing. Using findHighlightColor instead of a custom color.
1 parent 3edf6dc commit 4cc8772

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

Sources/CodeEditTextView/EmphasizeAPI/EmphasizeAPI.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class EmphasizeAPI {
1313

1414
public private(set) var emphasizedRanges: [EmphasizedRange] = []
1515
public private(set) var emphasizedRangeIndex: Int?
16-
private let activeColor: NSColor = NSColor(hex: 0xFFFB00, alpha: 1)
16+
private let activeColor: NSColor = .findHighlightColor
1717
private let inactiveColor: NSColor = NSColor.lightGray.withAlphaComponent(0.4)
1818
private var activeTextLayer: CATextLayer?
1919
private var originalSelectionColor: NSColor?
@@ -88,7 +88,7 @@ public class EmphasizeAPI {
8888

8989
let removedLayer = emphasizedRanges[index].layer
9090
removedLayer.removeFromSuperlayer()
91-
91+
9292
// Remove text layer
9393
emphasizedRanges[index].textLayer?.removeFromSuperlayer()
9494

@@ -130,12 +130,12 @@ public class EmphasizeAPI {
130130
}
131131
emphasizedRanges.removeAll()
132132
emphasizedRangeIndex = nil
133-
133+
134134
// Restore original selection highlighting
135135
if let originalColor = originalSelectionColor {
136136
textView?.selectionManager.selectionBackgroundColor = originalColor
137137
}
138-
138+
139139
// Force a redraw to ensure colors update
140140
textView?.needsDisplay = true
141141
}

Sources/CodeEditTextView/TextLine/LineFragmentView.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,6 @@ final class LineFragmentView: NSView {
4242
}
4343
context.saveGState()
4444

45-
context.setAllowsAntialiasing(true)
46-
context.setShouldAntialias(true)
47-
context.setAllowsFontSmoothing(false)
48-
context.setShouldSmoothFonts(false)
49-
context.setAllowsFontSubpixelPositioning(true)
50-
context.setShouldSubpixelPositionFonts(true)
51-
context.setAllowsFontSubpixelQuantization(true)
52-
context.setShouldSubpixelQuantizeFonts(true)
53-
5445
ContextSetHiddenSmoothingStyle(context, 16)
5546

5647
context.textMatrix = .init(scaleX: 1, y: -1)

0 commit comments

Comments
 (0)