using uucode for the graphemeBreak in shaper/web_canvas.zig

pull/8757/head
Jacob Sandlund 2025-08-23 14:33:11 -04:00
parent 39ecfe9211
commit c7fa1d8381
3 changed files with 6 additions and 19 deletions

View File

@ -37,12 +37,8 @@
.lazy = true,
},
.uucode = .{
.url = "https://github.com/jacobsandlund/uucode/archive/7e2bde7c3cd90a5b754cd62b7d0059f70f5eea3f.tar.gz",
.hash = "uucode-0.0.0-ZZjBPn1iPwCsTwd680sxrXcqNZxA8r_EmnpMiP53h5a5",
},
.uucode_x = .{
.url = "https://github.com/jacobsandlund/uucode.x/archive/5964041fa51234a5d86dedda88f2af6bb9adf361.tar.gz",
.hash = "uucode_x-0.0.0-5_D0j200AAB5nu0QR5oQiceKujDN8C1WqMNlZiaxqNu0",
.url = "https://github.com/jacobsandlund/uucode/archive/38b82297e69a3b2dc55dc8df25f3851be37f9327.tar.gz",
.hash = "uucode-0.0.0-ZZjBPiqdPwB-rG3ieaq3c6tMpnksWYs4_rGj2IvFGjjB",
},
.zig_wayland = .{
// codeberg ifreund/zig-wayland

View File

@ -25,8 +25,6 @@ pub fn init(b: *std.Build, cfg: *const Config) !SharedDeps {
const uucode = b.dependency("uucode", .{
.build_config_path = b.path("src/build/uucode_config.zig"),
});
const uucode_x = b.dependency("uucode_x", .{});
@import("uucode_x").connectBuild(uucode_x, uucode);
break :blk uucode.namedLazyPath("tables.zig");
};
@ -425,17 +423,10 @@ pub fn add(
.target = target,
.optimize = optimize,
.@"tables.zig" = self.uucode_tables_zig,
.build_config_path = b.path("src/build/uucode_config.zig"),
})) |dep| {
step.root_module.addImport("uucode", dep.module("uucode"));
}
if (b.lazyDependency("uucode_x", .{
.target = target,
.optimize = optimize,
})) |dep| {
const mod = dep.module("uucode.x");
step.root_module.addImport("uucode.x", mod);
mod.addImport("root_module", step.root_module);
}
if (b.lazyDependency("zf", .{
.target = target,
.optimize = optimize,

View File

@ -3,7 +3,7 @@ const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
const font = @import("../main.zig");
const terminal = @import("../../terminal/main.zig");
const uucode_x = @import("uucode.x");
const uucode = @import("uucode");
const log = std.log.scoped(.font_shaper);
@ -111,7 +111,7 @@ pub const Shaper = struct {
// font ligatures. However, we do support grapheme clustering.
// This means we can render things like skin tone emoji but
// we can't render things like single glyph "=>".
var break_state: uucode_x.GraphemeBreakState = .default;
var break_state: uucode.GraphemeBreakState = .default;
var cp1: u21 = @intCast(codepoints[0]);
var start: usize = 0;
@ -126,7 +126,7 @@ pub const Shaper = struct {
const cp2: u21 = @intCast(codepoints[i]);
defer cp1 = cp2;
break :blk uucode_x.graphemeBreakXEmoji(
break :blk uucode.graphemeBreak(
cp1,
cp2,
&break_state,