Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/platform/macos/appkit_host.m
Original file line number Diff line number Diff line change
Expand Up @@ -4501,6 +4501,17 @@ - (BOOL)ensureCanvasCompositor {
if (!bitmap) return nil;
CGContextSetAllowsAntialiasing(bitmap, true);
CGContextSetShouldAntialias(bitmap, true);
/* Font smoothing is macOS's stem darkening for text, and it is OFF by
* default on a transparent backing. Every glyph this host draws lands in
* a CGBitmapContext like this one, so leaving it off renders ALL text
* systematically thin - measured at 35% fewer fully-solid stem pixels
* (2341 vs 3164 at 13pt/scale 2) with the bundled JetBrains Mono NL.
* Measure with phux-cockpit's scripts/measure-glyph-smoothing.m before
* changing this; the deficit is invisible in the CPU reference renderer,
* which never touches CoreText, so no reference screenshot can catch a
* regression here. Allows- must precede Should-: the former gates it. */
CGContextSetAllowsFontSmoothing(bitmap, true);
CGContextSetShouldSmoothFonts(bitmap, true);
CGContextTranslateCTM(bitmap, 0, (CGFloat)rasterHeight);
CGContextScaleCTM(bitmap, scale, -scale);
CGContextTranslateCTM(bitmap, -minX / scale, -minY / scale);
Expand Down Expand Up @@ -5177,6 +5188,11 @@ - (NativeSdkPacketCommandRaster *)rasterCacheBuildEntryForCommand:(NSDictionary
if (!bitmap) return nil;
CGContextSetAllowsAntialiasing(bitmap, true);
CGContextSetShouldAntialias(bitmap, true);
/* Stem darkening for text; see the raster path above for why and for how
* to measure it. This is the CACHED command raster, so a glyph rasterized
* thin here stays thin for the life of the cache entry. */
CGContextSetAllowsFontSmoothing(bitmap, true);
CGContextSetShouldSmoothFonts(bitmap, true);
CGContextTranslateCTM(bitmap, 0, (CGFloat)rasterHeight);
CGContextScaleCTM(bitmap, scale, -scale);
CGContextTranslateCTM(bitmap, -minX / scale, -minY / scale);
Expand Down Expand Up @@ -5390,6 +5406,12 @@ - (NSInteger)drawPacketCommands:(NSArray *)commands keys:(NSArray *)keys pixels:

CGContextSetAllowsAntialiasing(context, true);
CGContextSetShouldAntialias(context, true);
/* Stem darkening for text; see the raster path above for why and for how
* to measure it. This is the MAIN per-present surface pass - the one that
* draws the terminal cell grid - so it is the site the faint-text report
* was actually about. */
CGContextSetAllowsFontSmoothing(context, true);
CGContextSetShouldSmoothFonts(context, true);
CGContextTranslateCTM(context, 0, (CGFloat)pixelHeight);
CGContextScaleCTM(context, scale, -scale);

Expand Down