diff --git a/example/app.ts b/example/app.ts index 2199e858f..d7a749b7c 100644 --- a/example/app.ts +++ b/example/app.ts @@ -57,7 +57,7 @@ fetch(url.href) }; // Create our config - const config_str = makeStr("font-family = monospace"); + const config_str = makeStr("font-family = monospace\nfont-size 32\n"); old(results); run(config_str.ptr, config_str.len); }) diff --git a/src/font/face/web_canvas.zig b/src/font/face/web_canvas.zig index 8b04fe947..163e45f34 100644 --- a/src/font/face/web_canvas.zig +++ b/src/font/face/web_canvas.zig @@ -419,7 +419,7 @@ pub const Face = struct { // Get the width and height of the render const metrics_2 = try measure_ctx.call(js.Object, "measureText", .{glyph_str}); const top_desc = try metrics_2.get(f32, "actualBoundingBoxDescent") + 1; - const y_offset = @as(i32, @intFromFloat(top_desc)) - @as(i32, @intCast(height)); + const y_offset = @as(i32, @intCast(height)) - @as(i32, @intFromFloat(top_desc)); ctx_temp.deinit(); // Note: width and height both get "+ 1" added to them above. This diff --git a/src/main_wasm.zig b/src/main_wasm.zig index 7ff03f30b..3f4006eb4 100644 --- a/src/main_wasm.zig +++ b/src/main_wasm.zig @@ -32,6 +32,8 @@ fn run_(str: []const u8) !void { var iter = cli.args.lineIterator(fbs.reader()); try cli.args.parse(Config, alloc, &config, &iter); try config.finalize(); + std.log.err("font-size {}", .{config.@"font-size"}); + config.@"font-size" = 32; const app = try App.create(alloc); // Create our runtime app var app_runtime = try apprt.App.init(app, .{}); @@ -40,10 +42,8 @@ fn run_(str: []const u8) !void { try surface.init(alloc, &config, app, &app_runtime, apprt_surface); std.log.err("{}", .{surface.size}); try surface.renderer.setScreenSize(surface.size); - try surface.renderer_state.terminal.printString( - \\M_hello - ); - surface.renderer_state.terminal.setCursorPos(2, 2); + try surface.renderer_state.terminal.printString("M_yhelloaaaaaaaaa\nšŸ\nšŸ‘šŸ½\nM_ghostty"); + surface.renderer_state.terminal.setCursorPos(4, 2); try surface.renderer_state.terminal.setAttribute(.{ .direct_color_bg = .{ .r = 240, .g = 40,