mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-25 10:39:01 -06:00
rewrite_block clamps a requested paragraph width between the text's size in user space (size * k) and the largest page PDF allows (14 400 pt). f64::clamp panics when its minimum is the larger, so text set above 14 400 pt crashed the app as soon as its paragraph was given a width. The size comes from the file (`20000 Tf`, or `1 Tf` scaled up by `Tm`) or from the request (the automation tools pass `size` through). The lower bound is now capped at 14 400 pt too, so such a paragraph gets the widest width allowed. `f64::min` also turns a NaN size into the cap. Test: a 20000 pt Tf, a 1 pt Tf scaled 20000x by Tm, and a requested size of 20000 pt each take a width of 200 without panicking (all three panicked before). Reported-by: BS.ehlas.cz Co-authored-by: Brandon Thomas <echelon@gmail.com>