From e875b453b7342767f7b8315ba1628853e6fb4cb6 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 20 Jan 2026 11:50:58 -0800 Subject: [PATCH] font/shaper: hook functions can't fail --- src/font/shaper/coretext.zig | 8 ++++---- src/font/shaper/harfbuzz.zig | 4 ++-- src/font/shaper/run.zig | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/font/shaper/coretext.zig b/src/font/shaper/coretext.zig index cc05022c4..ab3c6aaab 100644 --- a/src/font/shaper/coretext.zig +++ b/src/font/shaper/coretext.zig @@ -98,7 +98,7 @@ pub const Shaper = struct { self.unichars.deinit(alloc); } - fn reset(self: *RunState) !void { + fn reset(self: *RunState) void { self.codepoints.clearRetainingCapacity(); self.unichars.clearRetainingCapacity(); } @@ -644,8 +644,8 @@ pub const Shaper = struct { pub const RunIteratorHook = struct { shaper: *Shaper, - pub fn prepare(self: *RunIteratorHook) !void { - try self.shaper.run_state.reset(); + pub fn prepare(self: *RunIteratorHook) void { + self.shaper.run_state.reset(); // log.warn("----------- run reset -------------", .{}); } @@ -681,7 +681,7 @@ pub const Shaper = struct { }); } - pub fn finalize(self: RunIteratorHook) !void { + pub fn finalize(self: RunIteratorHook) void { _ = self; } }; diff --git a/src/font/shaper/harfbuzz.zig b/src/font/shaper/harfbuzz.zig index e4a9301e8..6dcc0f94e 100644 --- a/src/font/shaper/harfbuzz.zig +++ b/src/font/shaper/harfbuzz.zig @@ -175,7 +175,7 @@ pub const Shaper = struct { pub const RunIteratorHook = struct { shaper: *Shaper, - pub fn prepare(self: RunIteratorHook) !void { + pub fn prepare(self: RunIteratorHook) void { // Reset the buffer for our current run self.shaper.hb_buf.reset(); self.shaper.hb_buf.setContentType(.unicode); @@ -191,7 +191,7 @@ pub const Shaper = struct { self.shaper.hb_buf.add(cp, cluster); } - pub fn finalize(self: RunIteratorHook) !void { + pub fn finalize(self: RunIteratorHook) void { self.shaper.hb_buf.guessSegmentProperties(); } }; diff --git a/src/font/shaper/run.zig b/src/font/shaper/run.zig index 85c5c410b..45c5d38ca 100644 --- a/src/font/shaper/run.zig +++ b/src/font/shaper/run.zig @@ -73,7 +73,7 @@ pub const RunIterator = struct { var current_font: font.Collection.Index = .{}; // Allow the hook to prepare - try self.hooks.prepare(); + self.hooks.prepare(); // Initialize our hash for this run. var hasher = Hasher.init(0); @@ -283,7 +283,7 @@ pub const RunIterator = struct { } // Finalize our buffer - try self.hooks.finalize(); + self.hooks.finalize(); // Add our length to the hash as an additional mechanism to avoid collisions autoHash(&hasher, j - self.i); -- 2.51.2