mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
fix y_offset
This commit is contained in:
@ -57,7 +57,7 @@ fetch(url.href)
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Create our config
|
// Create our config
|
||||||
const config_str = makeStr("font-family = monospace");
|
const config_str = makeStr("font-family = monospace\nfont-size 32\n");
|
||||||
old(results);
|
old(results);
|
||||||
run(config_str.ptr, config_str.len);
|
run(config_str.ptr, config_str.len);
|
||||||
})
|
})
|
||||||
|
@ -419,7 +419,7 @@ pub const Face = struct {
|
|||||||
// Get the width and height of the render
|
// Get the width and height of the render
|
||||||
const metrics_2 = try measure_ctx.call(js.Object, "measureText", .{glyph_str});
|
const metrics_2 = try measure_ctx.call(js.Object, "measureText", .{glyph_str});
|
||||||
const top_desc = try metrics_2.get(f32, "actualBoundingBoxDescent") + 1;
|
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();
|
ctx_temp.deinit();
|
||||||
|
|
||||||
// Note: width and height both get "+ 1" added to them above. This
|
// Note: width and height both get "+ 1" added to them above. This
|
||||||
|
@ -32,6 +32,8 @@ fn run_(str: []const u8) !void {
|
|||||||
var iter = cli.args.lineIterator(fbs.reader());
|
var iter = cli.args.lineIterator(fbs.reader());
|
||||||
try cli.args.parse(Config, alloc, &config, &iter);
|
try cli.args.parse(Config, alloc, &config, &iter);
|
||||||
try config.finalize();
|
try config.finalize();
|
||||||
|
std.log.err("font-size {}", .{config.@"font-size"});
|
||||||
|
config.@"font-size" = 32;
|
||||||
const app = try App.create(alloc);
|
const app = try App.create(alloc);
|
||||||
// Create our runtime app
|
// Create our runtime app
|
||||||
var app_runtime = try apprt.App.init(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);
|
try surface.init(alloc, &config, app, &app_runtime, apprt_surface);
|
||||||
std.log.err("{}", .{surface.size});
|
std.log.err("{}", .{surface.size});
|
||||||
try surface.renderer.setScreenSize(surface.size);
|
try surface.renderer.setScreenSize(surface.size);
|
||||||
try surface.renderer_state.terminal.printString(
|
try surface.renderer_state.terminal.printString("M_yhelloaaaaaaaaa\n🐏\n👍🏽\nM_ghostty");
|
||||||
\\M_hello
|
surface.renderer_state.terminal.setCursorPos(4, 2);
|
||||||
);
|
|
||||||
surface.renderer_state.terminal.setCursorPos(2, 2);
|
|
||||||
try surface.renderer_state.terminal.setAttribute(.{ .direct_color_bg = .{
|
try surface.renderer_state.terminal.setAttribute(.{ .direct_color_bg = .{
|
||||||
.r = 240,
|
.r = 240,
|
||||||
.g = 40,
|
.g = 40,
|
||||||
|
Reference in New Issue
Block a user