summaryrefslogtreecommitdiff
path: root/addons/pdf/pdf.zig
diff options
context:
space:
mode:
Diffstat (limited to 'addons/pdf/pdf.zig')
-rw-r--r--addons/pdf/pdf.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/addons/pdf/pdf.zig b/addons/pdf/pdf.zig
index bc75e039..7ee3400a 100644
--- a/addons/pdf/pdf.zig
+++ b/addons/pdf/pdf.zig
@@ -35,6 +35,7 @@ const m = @import("pdf_bridge");
const c = addon.c;
pub const pardes_addon = addon.ops(Pdf);
+pub const panic = addon.panic;
comptime {
addon.exportLib(&pardes_addon);
}
@@ -270,6 +271,7 @@ pub const Pdf = extern struct {
return addon.say("not a PDF pardes can read", .err);
}
o.d = d;
+ sayHuge(o.size[0..1]);
st.pages = @intCast(pages);
// every page the first's size until a lane measures them
o.measured = st.pages == 1;
@@ -812,6 +814,7 @@ pub const Pdf = extern struct {
if (res.n != st.pages or sizes.len != st.pages) return;
for (o.size, sizes) |*to, from| to.* = from;
o.measured = true;
+ sayHuge(o.size);
// laid again where a page is not the first's size
for (o.size) |s| if (!std.meta.eql(s, o.size[0])) {
for (&st.views) |*l| l.laid = false;
@@ -958,6 +961,13 @@ fn ownOf(st: *const Pdf) *Own {
}
/// Page `p`'s size as the strip is laid with it.
+/// A page the bridge held to its bound (a crafted MediaBox) is said.
+fn sayHuge(sizes: []const m.pardes_pdf_page_size) void {
+ const most: f32 = m.PARDES_PDF_MAX_PAGE_POINTS;
+ for (sizes) |s| if (s.width >= most or s.height >= most)
+ return addon.say(std.fmt.comptimePrint("a page past {d} pt on a side: laid out at that size", .{m.PARDES_PDF_MAX_PAGE_POINTS}), .note);
+}
+
fn sizeOf(st: *const Pdf, o: *Own, p: usize) m.pardes_pdf_page_size {
if (st.sizes != .measured) return o.size[0];
// A client joined after the lane measured them: measured here.