diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-10 21:51:57 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-10 21:51:57 +0300 |
| commit | 425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch) | |
| tree | e52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/src/font/face | |
| parent | 90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff) | |
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/src/font/face')
| -rw-r--r-- | vendor/libghostty-vt/src/font/face/coretext.zig | 1 | ||||
| -rw-r--r-- | vendor/libghostty-vt/src/font/face/freetype.zig | 45 |
2 files changed, 24 insertions, 22 deletions
diff --git a/vendor/libghostty-vt/src/font/face/coretext.zig b/vendor/libghostty-vt/src/font/face/coretext.zig index cd8bc7d8..4b2af153 100644 --- a/vendor/libghostty-vt/src/font/face/coretext.zig +++ b/vendor/libghostty-vt/src/font/face/coretext.zig @@ -926,6 +926,7 @@ const ColorState = struct { const svg = opentype.SVG.init(ptr[0..len]) catch |err| { return switch (err) { error.EndOfStream, + error.ReadFailed, error.SVGVersionNotSupported, => error.InvalidSVGTable, }; diff --git a/vendor/libghostty-vt/src/font/face/freetype.zig b/vendor/libghostty-vt/src/font/face/freetype.zig index d04fe180..14a378e5 100644 --- a/vendor/libghostty-vt/src/font/face/freetype.zig +++ b/vendor/libghostty-vt/src/font/face/freetype.zig @@ -18,6 +18,7 @@ const Library = font.Library; const opentype = @import("../opentype.zig"); const quirks = @import("../../quirks.zig"); const config = @import("../../config.zig"); +const global = @import("../../global.zig"); const F26Dot6 = opentype.sfnt.F26Dot6; @@ -41,7 +42,7 @@ pub const Face = struct { /// /// This means that anywhere where `self.face.loadGlyph` /// is called, this mutex must be held. - ft_mutex: *std.Thread.Mutex, + ft_mutex: *std.Io.Mutex, /// Harfbuzz font corresponding to this face. hb_font: harfbuzz.Font, @@ -68,8 +69,8 @@ pub const Face = struct { index: i32, opts: font.face.Options, ) !Face { - lib.mutex.lock(); - defer lib.mutex.unlock(); + lib.mutex.lockUncancelable(global.io()); + defer lib.mutex.unlock(global.io()); const face = try lib.lib.initFace(path, index); errdefer face.deinit(); return try initFace(lib, face, opts); @@ -81,8 +82,8 @@ pub const Face = struct { source: [:0]const u8, opts: font.face.Options, ) !Face { - lib.mutex.lock(); - defer lib.mutex.unlock(); + lib.mutex.lockUncancelable(global.io()); + defer lib.mutex.unlock(global.io()); const face = try lib.lib.initMemoryFace(source, 0); errdefer face.deinit(); return try initFace(lib, face, opts); @@ -99,9 +100,9 @@ pub const Face = struct { var hb_font = try harfbuzz.freetype.createFont(face.handle); errdefer hb_font.destroy(); - const ft_mutex = try lib.alloc.create(std.Thread.Mutex); + const ft_mutex = try lib.alloc.create(std.Io.Mutex); errdefer lib.alloc.destroy(ft_mutex); - ft_mutex.* = .{}; + ft_mutex.* = .init; var result: Face = .{ .lib = lib, @@ -142,8 +143,8 @@ pub const Face = struct { pub fn deinit(self: *Face) void { self.lib.alloc.destroy(self.ft_mutex); { - self.lib.mutex.lock(); - defer self.lib.mutex.unlock(); + self.lib.mutex.lockUncancelable(global.io()); + defer self.lib.mutex.unlock(global.io()); self.face.deinit(); } @@ -330,8 +331,8 @@ pub const Face = struct { /// Returns true if the given glyph ID is colorized. pub fn isColorGlyph(self: *const Face, glyph_id: u32) bool { - self.ft_mutex.lock(); - defer self.ft_mutex.unlock(); + self.ft_mutex.lockUncancelable(global.io()); + defer self.ft_mutex.unlock(global.io()); // Load the glyph and see what pixel mode it renders with. // All modes other than BGRA are non-color. @@ -429,8 +430,8 @@ pub const Face = struct { glyph_index: u32, opts: font.Glyph.RenderOptions, ) !Glyph { - self.ft_mutex.lock(); - defer self.ft_mutex.unlock(); + self.ft_mutex.lockUncancelable(global.io()); + defer self.ft_mutex.unlock(global.io()); // Load the glyph. try self.face.loadGlyph(glyph_index, self.glyphLoadFlags(opts.constraint.doesAnything())); @@ -541,7 +542,7 @@ pub const Face = struct { else 0.0; - const outline = &glyph.*.outline; + const outline: *freetype.c.FT_Outline = &glyph.*.outline; for (outline.points[0..@intCast(outline.n_points)]) |*p| { // Convert to f64 for processing var px = f26dot6ToF64(p.x); @@ -971,8 +972,8 @@ pub const Face = struct { // the metrics provided by FreeType, and set ascii_height to null as // it's optional. const cell_width: f64, const ascii_height: ?f64 = measurements: { - self.ft_mutex.lock(); - defer self.ft_mutex.unlock(); + self.ft_mutex.lockUncancelable(global.io()); + defer self.ft_mutex.unlock(global.io()); var max: f64 = 0.0; var top: f64 = 0.0; @@ -1024,8 +1025,8 @@ pub const Face = struct { break :heights .{ cap: { - self.ft_mutex.lock(); - defer self.ft_mutex.unlock(); + self.ft_mutex.lockUncancelable(global.io()); + defer self.ft_mutex.unlock(global.io()); if (face.getCharIndex('H')) |glyph_index| { if (face.loadGlyph(glyph_index, self.glyphLoadFlags(false))) { break :cap getGlyphSize(face.handle.*.glyph).height; @@ -1034,8 +1035,8 @@ pub const Face = struct { break :cap null; }, ex: { - self.ft_mutex.lock(); - defer self.ft_mutex.unlock(); + self.ft_mutex.lockUncancelable(global.io()); + defer self.ft_mutex.unlock(global.io()); if (face.getCharIndex('x')) |glyph_index| { if (face.loadGlyph(glyph_index, self.glyphLoadFlags(false))) { break :ex getGlyphSize(face.handle.*.glyph).height; @@ -1048,8 +1049,8 @@ pub const Face = struct { // Measure "水" (CJK water ideograph, U+6C34) for our ic width. const ic_width: ?f64 = ic_width: { - self.ft_mutex.lock(); - defer self.ft_mutex.unlock(); + self.ft_mutex.lockUncancelable(global.io()); + defer self.ft_mutex.unlock(global.io()); const glyph = face.getCharIndex('水') orelse break :ic_width null; |
