Skip to content

Commit 49b9a5e

Browse files
committed
Comment on line drawing
1 parent 365addb commit 49b9a5e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Sources/CodeEditTextView/TextLine/LineFragmentView.swift

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

45+
// Removes jagged edges
46+
context.setAllowsAntialiasing(true)
47+
context.setShouldAntialias(true)
48+
49+
// Effectively increases the screen resolution by drawing text in each LED color pixel (R, G, or B), rather than
50+
// the triplet of pixels (RGB) for a regular pixel. This can increase text clarity, but loses effectiveness
51+
// in low-contrast settings.
52+
context.setAllowsFontSubpixelPositioning(true)
53+
context.setShouldSubpixelPositionFonts(true)
54+
55+
// Quantizes the position of each glyph, resulting in slightly less accurate positioning, and gaining higher
56+
// quality bitmaps and performance.
57+
context.setAllowsFontSubpixelQuantization(true)
58+
context.setShouldSubpixelQuantizeFonts(true)
59+
4560
ContextSetHiddenSmoothingStyle(context, 16)
4661

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

0 commit comments

Comments
 (0)