font/shaper: hook functions can't fail

This commit is contained in:
Mitchell Hashimoto
2026-01-20 11:50:58 -08:00
parent e3c39ed502
commit e875b453b7
3 changed files with 8 additions and 8 deletions

View File

@@ -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;
}
};

View File

@@ -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();
}
};

View File

@@ -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);