mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-10 13:01:29 +00:00
draw_value_text re-measures overflowing text up to six times to shrink it, and a repeating subform draws its text once per instance, with no shared cache. A small file with large text drawn across many instances therefore cost one full text layout per instance per pass, for seconds of work, and finished with a valid layout, so neither the page limit nor the measurement budget stopped it. Each pass over a draw's text now counts its characters against a new draw budget (MAX_DRAW_CHARS), the way the measurement budget bounds container sizing. A real form's draws stay far below it; a template that lays out far more text stops with TooLarge. The budget is reduced under test so the guard is exercised without laying out hundreds of megabytes. Test: large_text_drawn_in_many_instances_spends_the_draw_budget (fifty instances of a 20,000-character draw give TooLarge; one copy lays out); it fails without the cap. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pq7HyG234xeYkJfr41E6iP