From e3aaae3a56a56d1147741ff9788a9f7607b9ee57 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 4 Nov 2026 23:30:20 -0300 Subject: pdf: an outline entry is its depth, title and destination, where it also carried is_open, flags and color (with isBold and isItalic) that nothing shows, the sections rows reading none of them; their assertions in pdf.zig's outline test, the literals' fields in test/panes.zig and the sections bench's checksum of them go, and the bridge still fills its C item Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/pdf.zig | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'src/pdf.zig') diff --git a/src/pdf.zig b/src/pdf.zig index 262af8b9..1a983e2c 100644 --- a/src/pdf.zig +++ b/src/pdf.zig @@ -655,18 +655,7 @@ pub const OutlineEntry = struct { depth: u8, /// Null preserves a missing /Title; a present empty title is "". title: ?[]const u8, - is_open: bool, - flags: u8, - color: [3]u8, destination: OutlineDestination, - - pub fn isBold(entry: OutlineEntry) bool { - return entry.flags & 1 != 0; - } - - pub fn isItalic(entry: OutlineEntry) bool { - return entry.flags & 2 != 0; - } }; /// All title and external-URI slices point into `bytes`. This fixed two-allocation @@ -825,7 +814,7 @@ pub const Document = struct { if (item.depth >= c.PARDES_PDF_MAX_OUTLINE_DEPTH or item.depth > std.math.maxInt(u8) or item.title_present > 1 or item.has_x > 1 or - item.has_y > 1 or item.is_open > 1) + item.has_y > 1) return error.BadOutline; const depth: u8 = @intCast(item.depth); if ((index == 0 and depth != 0) or @@ -866,14 +855,7 @@ pub const Document = struct { }, else => return error.BadOutline, }; - entry.* = .{ - .depth = depth, - .title = title, - .is_open = item.is_open != 0, - .flags = item.flags, - .color = .{ item.r, item.g, item.b }, - .destination = destination, - }; + entry.* = .{ .depth = depth, .title = title, .destination = destination }; } } return .{ .entries = entries, .bytes = bytes }; @@ -1722,12 +1704,8 @@ test "PDF outline is a stable owned DFS view with native destinations" { }); try std.testing.expect(outline.entries[0].title == null); - try std.testing.expect(outline.entries[0].is_open); try std.testing.expect(outline.entries[0].destination == .none); try std.testing.expectEqualStrings("Café 子", outline.entries[1].title.?); - try std.testing.expect(outline.entries[1].isBold()); - try std.testing.expect(outline.entries[1].isItalic()); - try std.testing.expectEqual([3]u8{ 51, 102, 153 }, outline.entries[1].color); const child = outline.entries[1].destination.internal; try std.testing.expectEqual(@as(usize, 1), child.page); try std.testing.expect(child.x != null and child.y != null); -- cgit v1.3