Files
pdfcraft/crates/model
c2fcf77e9e XFA: time fields show and keep times through their time picture (#8411) (#8607)
* XFA: time fields are times, not dates (#8411)

A dateTimeEdit whose value is a <time/>, or whose picture is a time{…}
clause, became a date field formatted yyyy-mm-dd. It is now a time field:
its picture becomes an AFTime pattern, its canonical HH:MM:SS data value
shows in that pattern, a typed time goes back to the data canonically,
and text that isn't a time is kept as typed. Taking the XFA out makes a
time field typed in one pattern and shown in another hold its time as
shown, as date fields do.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* XFA time fields: keep untouched time data; read data canonically (#8411)

- A time field still showing the time its data holds keeps that data as
  it is, so a zone, a fraction or seconds the picture doesn't show
  survive a save (review on #8607).
- A data value is read as a canonical time first, whatever order the
  picture puts its fields in (`time{HH:SS:MM}`).
- A one-letter number in a time pattern takes one digit when the next
  number needs the other (`905` in `HMM`).
- Only a time clause alone makes a time field; `time{…} date{…}` stays a
  date field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* XFA time fields: read a time pattern in bounded time and depth (#8411)

A pattern with more than one hour, minute, second or AM/PM isn't read, so the
one-or-two-digit search tries at most eight ways. Literal text is consumed in a
loop, so a long run of it no longer means a call per character. The pattern can
come from a file's AFTime_KeystrokeEx when the XFA is removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* XFA time fields: draw the meridiem in upper case, as the picture's A does (#8411)

Review on #8607: the value read 2:30 PM while the page drew 2:30 pm,
because the appearance went through Acrobat's lower-case tt. An XFA
time field (/PCXfaDate) now draws AM/PM; plain AcroForm tt is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Preserve ambiguous XFA times in static conversion

* Fix time conversion Clippy warning

---------

Co-authored-by: sixparks <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: FredApps <[email protected]>
Co-authored-by: FredApps <[email protected]>
2026-12-04 18:51:01 +01:00
..

pdfcraft-model

Layer L2: typed views over the pdfcraft-cos object graph. It starts small, with what several L3/L4 crates need:

  • pages(doc): leaf pages in order, each with its inherited attributes (Resources, MediaBox, CropBox, Rotate, §7.7.3.4) resolved;
  • Page::crop, Page::rotation, Page::user_unit and Page::view_matrix: the displayed page's geometry, and the matrix from "display space" (points, origin at the bottom-left of the page as shown, after /UserUnit and /Rotate) to user space, so content can be placed the way the reader sees the page. /UserUnit is read as Acrobat reads it: the page's own entry, a number from 1 up, at most 75,000; anything else counts as 1. A /Rotate that isn't a multiple of 90 counts as 0, as the renderer draws it. view_matrix_for(rotation, rect) is the same matrix for any rectangle, e.g. to draw a comment's picture upright inside its user-space /Rect on a turned page.

The page-tree walk keeps one cursor per ancestor and shares inherited attribute owners. Repeated child references are skipped before copying attributes, with first depth-first occurrence order preserved. Returned page dictionaries still own their effective attributes. A walk copies at most MAX_INHERITED_COPIES (1 GiB, approximate heap bytes) of inherited values into the leaves; past it the walk stops, as it does past its leaf cap, and the pages after that point are not listed.

organize, annot and forms still carry their own small walkers; they move here as the model grows (ADR-0004).