mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-13 19:15:48 +00:00
build: fix freetype C enum signedness for MSVC
MSVC translates C enums as signed int, while GCC/Clang uses unsigned int. The freetype Zig bindings hardcode c_uint for enum backing types, causing type mismatches when compiling with MSVC target. Fix by adding @intCast at call sites where enum values are passed to C functions, and @bitCast for the glyph format tag extraction where bit-shift operations require unsigned integers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -679,13 +679,16 @@ pub const Face = struct {
|
||||
else => |f| {
|
||||
// Glyph formats are tags, so we can
|
||||
// output a semi-readable error here.
|
||||
// Use @bitCast to u32 because MSVC translates C enums
|
||||
// as signed int, while GCC/Clang uses unsigned int.
|
||||
const tag: u32 = @bitCast(f);
|
||||
log.err(
|
||||
"Can't render glyph with unsupported glyph format \"{s}\"",
|
||||
.{[4]u8{
|
||||
@truncate(f >> 24),
|
||||
@truncate(f >> 16),
|
||||
@truncate(f >> 8),
|
||||
@truncate(f >> 0),
|
||||
@truncate(tag >> 24),
|
||||
@truncate(tag >> 16),
|
||||
@truncate(tag >> 8),
|
||||
@truncate(tag >> 0),
|
||||
}},
|
||||
);
|
||||
return error.UnsupportedGlyphFormat;
|
||||
|
||||
Reference in New Issue
Block a user