mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-10 13:01:29 +00:00
Review of #5075, four findings, each with a test seen failing first: - A /BBox with anything but four numbers is no bound. filter_map read [0 /Bad 0 50 50] as [0 0 50 50], invented a clip and hid real text. - A clipping path of several rectangles clipped to the last one only, hiding text seen through the others. It now clips to the box around them all, which holds every one of them, so nothing they show is lost; a path with an unreadable rectangle clips nothing. - Clips in force were each tested on their own, so a run crossing two clips that lie apart (a page clip and a form's /BBox, or nested forms' /BBoxes) overlapped each and was read though nothing of it shows. Clips now intersect. - A turned clip was reduced to its upright bounding box, whose corners it does not cover, so text there was read. A clip is now the convex region the rectangle's corners make under its matrix. So the graphics state's clip becomes a convex Region (page space). A form's /BBox is intersected into the clip it inherits at its Do (its content starts with a stack of its own, so it cannot lift it), which replaces the separate stack of form boxes. Regions intersect by Sutherland-Hodgman and a run shows when the separating-axis test finds no gap; a region past 32 corners becomes its bounding box, so a stream that sets clip after clip stays bounded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>