coretext: initially fill grey

This commit is contained in:
Mitchell Hashimoto
2023-03-04 14:02:45 -08:00
parent 2a1cbb4f21
commit ef5d86ffb0

View File

@ -161,11 +161,23 @@ pub const Face = struct {
);
defer ctx.release();
// Perform an initial fill so that we're sure it starts as we want.
ctx.setGrayFillColor(0, 0);
ctx.fillRect(.{
.origin = .{ .x = 0, .y = 0 },
.size = .{
.width = @intToFloat(f64, width),
.height = @intToFloat(f64, height),
},
});
ctx.setAllowsAntialiasing(true);
ctx.setShouldAntialias(true);
ctx.setShouldSmoothFonts(true);
ctx.setGrayFillColor(1, 1);
ctx.setGrayStrokeColor(1, 1);
// With this set the text gets chunky. With it unset the text doesn't
// look right at small font sizes. Something isn't right.
// ctx.setGrayStrokeColor(1, 1);
ctx.setTextDrawingMode(.fill_stroke);
ctx.setTextMatrix(macos.graphics.AffineTransform.identity());
ctx.setTextPosition(0, 0);