diff --git a/build.zig.zon b/build.zig.zon index 2166e78..a988bdd 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -6,8 +6,8 @@ .minimum_zig_version = "0.15.2", .dependencies = .{ .TrueType = .{ - .url = "git+https://codeberg.org/andrewrk/TrueType#b0f9867671a14ce4ed75a05a7e52c927623095e5", - .hash = "TrueType-0.0.0-Ne-mWMxxAQDit1oHfxlK2lkZAX8P7Wsa2SBPaR_xSpc8", + .url = "git+https://codeberg.org/marler/TrueType#1d2012f9b7af8c6bb224017a459b0124fcf004ed", + .hash = "TrueType-0.0.0-Ne-mWNVzAQBpo-7-locnCb9lfth2lCeCa2WT6Og7Kbzs", }, // Used by examples .inter = .{ diff --git a/xtt/GlyphSet.zig b/xtt/GlyphSet.zig index 865f83e..c3a1a46 100644 --- a/xtt/GlyphSet.zig +++ b/xtt/GlyphSet.zig @@ -94,16 +94,13 @@ pub fn uploadIfNeeded( var r8: std.ArrayListUnmanaged(u8) = .empty; defer r8.deinit(scratch); - const dims = self.ttf.glyphBitmap( + const dims = try self.ttf.glyphBitmap( scratch, &r8, glyph_index, self.scale, self.scale, - ) catch |err| switch (err) { - error.GlyphNotFound => return self.uploadEmpty(lazy, sink, glyph_index), - else => |e| return e, - }; + ); const w: u32 = dims.width; const h: u32 = dims.height; @@ -137,34 +134,6 @@ pub fn uploadIfNeeded( self.uploaded.set(glyph_index); } -/// Upload a zero-size glyph so the server knows the ID exists. -fn uploadEmpty( - self: *GlyphSet, - lazy: *xtt.Lazy, - sink: *x11.RequestSink, - glyph_index: TrueType.GlyphIndex, -) error{WriteFailed}!void { - const advance: i16 = @intFromFloat(@round(self.scaled(lazy.hMetrics(self.ttf, glyph_index).advance_width))); - const info: x11.render.GlyphInfo = .{ - .width = 0, - .height = 0, - .x = 0, - .y = 0, - .x_off = advance, - .y_off = 0, - }; - const pad_len = try x11.render.AddGlyphsStart( - sink, - self.render_ext_opcode, - self.glyphset, - @intFromEnum(glyph_index), - info, - 0, - ); - try x11.render.AddGlyphsFinish(sink, pad_len); - self.uploaded.set(glyph_index); -} - const std = @import("std"); const x11 = @import("x11"); const TrueType = @import("TrueType");