mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
cli args fix stage1 miscompilation, add font families
This commit is contained in:
33
src/Grid.zig
33
src/Grid.zig
@ -174,8 +174,10 @@ pub fn init(
|
|||||||
.size = font_size.points,
|
.size = font_size.points,
|
||||||
});
|
});
|
||||||
defer disco_it.deinit();
|
defer disco_it.deinit();
|
||||||
if (try disco_it.next()) |face|
|
if (try disco_it.next()) |face| {
|
||||||
|
log.debug("font regular: {s}", .{try face.name()});
|
||||||
try group.addFace(alloc, .regular, face);
|
try group.addFace(alloc, .regular, face);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var disco_it = try disco.discover(.{
|
var disco_it = try disco.discover(.{
|
||||||
@ -184,8 +186,35 @@ pub fn init(
|
|||||||
.bold = true,
|
.bold = true,
|
||||||
});
|
});
|
||||||
defer disco_it.deinit();
|
defer disco_it.deinit();
|
||||||
if (try disco_it.next()) |face|
|
if (try disco_it.next()) |face| {
|
||||||
|
log.debug("font bold: {s}", .{try face.name()});
|
||||||
try group.addFace(alloc, .bold, face);
|
try group.addFace(alloc, .bold, face);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var disco_it = try disco.discover(.{
|
||||||
|
.family = "Fira Code",
|
||||||
|
.size = font_size.points,
|
||||||
|
.italic = true,
|
||||||
|
});
|
||||||
|
defer disco_it.deinit();
|
||||||
|
if (try disco_it.next()) |face| {
|
||||||
|
log.debug("font italic: {s}", .{try face.name()});
|
||||||
|
try group.addFace(alloc, .italic, face);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
var disco_it = try disco.discover(.{
|
||||||
|
.family = "Fira Code",
|
||||||
|
.size = font_size.points,
|
||||||
|
.bold = true,
|
||||||
|
.italic = true,
|
||||||
|
});
|
||||||
|
defer disco_it.deinit();
|
||||||
|
if (try disco_it.next()) |face| {
|
||||||
|
log.debug("font bold+italic: {s}", .{try face.name()});
|
||||||
|
try group.addFace(alloc, .bold_italic, face);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,15 +110,20 @@ fn parseIntoField(
|
|||||||
|
|
||||||
// No parseCLI, magic the value based on the type
|
// No parseCLI, magic the value based on the type
|
||||||
@field(dst, field.name) = switch (Field) {
|
@field(dst, field.name) = switch (Field) {
|
||||||
[]const u8 => if (value) |slice| value: {
|
[]const u8 => value: {
|
||||||
|
const slice = value orelse return error.ValueRequired;
|
||||||
const buf = try alloc.alloc(u8, slice.len);
|
const buf = try alloc.alloc(u8, slice.len);
|
||||||
mem.copy(u8, buf, slice);
|
mem.copy(u8, buf, slice);
|
||||||
break :value buf;
|
break :value buf;
|
||||||
} else return error.ValueRequired,
|
},
|
||||||
|
|
||||||
bool => try parseBool(value orelse "t"),
|
bool => try parseBool(value orelse "t"),
|
||||||
|
|
||||||
u8 => try std.fmt.parseInt(u8, value orelse return error.ValueRequired, 0),
|
u8 => try std.fmt.parseInt(
|
||||||
|
u8,
|
||||||
|
value orelse return error.ValueRequired,
|
||||||
|
0,
|
||||||
|
),
|
||||||
|
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
};
|
};
|
||||||
|
@ -6,6 +6,12 @@ const inputpkg = @import("input.zig");
|
|||||||
/// Config is the main config struct. These fields map directly to the
|
/// Config is the main config struct. These fields map directly to the
|
||||||
/// CLI flag names hence we use a lot of `@""` syntax to support hyphens.
|
/// CLI flag names hence we use a lot of `@""` syntax to support hyphens.
|
||||||
pub const Config = struct {
|
pub const Config = struct {
|
||||||
|
/// The font families to use.
|
||||||
|
@"font-family": ?[]const u8 = null,
|
||||||
|
@"font-family-bold": ?[]const u8 = null,
|
||||||
|
@"font-family-italic": ?[]const u8 = null,
|
||||||
|
@"font-family-bold-italic": ?[]const u8 = null,
|
||||||
|
|
||||||
/// Font size in points
|
/// Font size in points
|
||||||
@"font-size": u8 = 12,
|
@"font-size": u8 = 12,
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user