diff options
Diffstat (limited to 'src/sketch/root.zig')
| -rw-r--r-- | src/sketch/root.zig | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sketch/root.zig b/src/sketch/root.zig index 33c9ba7..01aa977 100644 --- a/src/sketch/root.zig +++ b/src/sketch/root.zig @@ -57,6 +57,7 @@ pub const Buffer = abi.Buffer; pub const Cursor = abi.Cursor; pub const Voice = abi.Voice; pub const BlendMode = abi.BlendMode; +pub const Face = abi.Face; /// What `draw` receives: input, host services, memory by lifetime and the /// command list. Commands may be built from anything: the methods copy what @@ -146,6 +147,11 @@ pub const Frame = struct { pub fn text(f: *Frame, x: f32, y: f32, scale: f32, bytes: []const u8, color: anytype) void { f.emit(.{ .text = .{ .x = x, .y = y, .scale = scale, .color = paint(color), .bytes = f.keep(u8, bytes) } }); } + /// `text` in another face of the built-in family: bold or italic mono, + /// or the sans (`host.textSizeIn` measures it). + pub fn textIn(f: *Frame, face: Face, x: f32, y: f32, scale: f32, bytes: []const u8, color: anytype) void { + f.emit(.{ .text = .{ .x = x, .y = y, .scale = scale, .color = paint(color), .bytes = f.keep(u8, bytes), .face = face } }); + } pub fn print(f: *Frame, x: f32, y: f32, scale: f32, color: anytype, comptime fmt: []const u8, args: anytype) void { f.emit(.{ .text = .{ .x = x, .y = y, .scale = scale, .color = paint(color), .bytes = f.format(fmt, args) } }); } |
