From 45f705a5e590c3dfddc0a544e66beb9bf6205a4d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 12:53:22 -0300 Subject: sketchbook: text rasterized at one scale and drawn at another (f.textScaled), steady under a moving camera --- src/abi.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/abi.zig') diff --git a/src/abi.zig b/src/abi.zig index 327110d..cf7b838 100644 --- a/src/abi.zig +++ b/src/abi.zig @@ -346,8 +346,11 @@ pub const Command = union(enum) { /// The blend for the 2D commands after it (`rect`, `shape`, `image`; /// `text` and `clear` ignore it). Each frame starts with `alpha`. blend: BlendMode, - /// One line from its top left corner; scale 1 is a 13 px font. - text: struct { x: f32, y: f32, scale: f32, color: Color, bytes: []const u8, face: Face = .mono }, + /// One line from its top left corner; scale 1 is a 13 px font. With + /// `raster` (not 0) it is laid out and rasterized at that scale and + /// drawn at `scale`: steady under a moving camera, where text shaped + /// anew at every size would shift letter against letter. + text: struct { x: f32, y: f32, scale: f32, color: Color, bytes: []const u8, face: Face = .mono, raster: f32 = 0 }, clip: ?Rect, /// Logical canvas size; the host scales the window to fit. canvas: struct { w: u32, h: u32 }, -- cgit v1.3