summaryrefslogtreecommitdiff
path: root/src/anim/root.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/anim/root.zig')
-rw-r--r--src/anim/root.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/anim/root.zig b/src/anim/root.zig
index 00e9362..a676f38 100644
--- a/src/anim/root.zig
+++ b/src/anim/root.zig
@@ -186,6 +186,18 @@ pub const Placed = struct {
f.text(at[0], at[1], scale * p.scale, bytes, p.faded(ink));
}
+ /// `text` in another face (`sk.Face`: bold or italic mono, the sans).
+ pub fn textIn(p: Placed, f: *sk.Frame, face: sk.Face, x: f32, y: f32, scale: f32, bytes: []const u8, ink: sk.Color) void {
+ const at = p.xf.apply(.{ x, y });
+ f.textIn(face, at[0], at[1], scale * p.scale, bytes, p.faded(ink));
+ }
+
+ /// The width and line height `textIn` covers, in the object's units.
+ pub fn textSizeIn(p: Placed, f: *sk.Frame, face: sk.Face, scale: f32, bytes: []const u8) [2]f32 {
+ const size = f.host.textSizeIn(face, scale * p.scale, bytes);
+ return .{ size[0] / p.scale, size[1] / p.scale };
+ }
+
/// The width and line height `text` covers, in the object's units.
pub fn textSize(p: Placed, f: *sk.Frame, scale: f32, bytes: []const u8) [2]f32 {
const size = f.host.textSize(scale * p.scale, bytes);