diff options
Diffstat (limited to 'src/host/Host.zig')
| -rw-r--r-- | src/host/Host.zig | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/host/Host.zig b/src/host/Host.zig index ede02df..9a2c0fa 100644 --- a/src/host/Host.zig +++ b/src/host/Host.zig @@ -1065,7 +1065,8 @@ const api: abi.Host.VTable = .{ .freeBuffer = apiFreeBuffer, .writeBuffer = apiWriteBuffer, .imageSize = apiImageSize, - .textSize = apiTextSize, + .textRun = apiTextRun, + .font = apiFont, .loadSound = apiLoadSound, .decodeSound = apiDecodeSound, .newSound = apiNewSound, @@ -1127,9 +1128,12 @@ fn apiSamples(ctx: *anyopaque, audio: abi.Audio) []const f32 { fn apiImageSize(ctx: *anyopaque, image: abi.Image) [2]u32 { return hostOf(ctx).images.size(image); } -fn apiTextSize(ctx: *anyopaque, scale: f32, bytes: []const u8, face: abi.Face) [2]f32 { - _ = ctx; - return gfx.textSize(scale, bytes, face); +fn apiTextRun(_: *anyopaque, face: abi.Face, scale: f32, bytes: []const u8, xs: []f32) abi.TextRun { + return gfx.textRun(face, scale, bytes, xs); +} +fn apiFont(_: *anyopaque, bytes: []const u8) ?abi.Face { + const face = c.sk_text_font(bytes.ptr, bytes.len); + return if (face < 0) null else @enumFromInt(face); } fn apiLoadSound(ctx: *anyopaque, path: []const u8) abi.Audio { return hostOf(ctx).audio.load(path); |
