Commit Graph
6644 Commits
Author SHA1 Message Date
Dylan M. Taylor 2c0280eb11 fonts: cut over encodings, Std14, and font wire builders to craft-pdf (#778) (#7940) 2026-11-20 07:17:06 -05:00
aiongg 3f3b3e634a Adopt the shared AGENTS.md (RFC-0072) (#7937)
* Adopt the shared AGENTS.md (RFC-0072) and test rules (RFC-0071)

* Point removed AGENTS.md section references at the shared standards
2026-11-20 18:10:17 +07:00
skylar taylor-barrickandDylan M. Taylor 20830d092c Route PDF parsing and rendering through shared craft-pdf (#2068)
* refactor(render): route PDF reading and rendering through shared craft-pdf (storytold/craft-libs#778)

* fix(render): convert u32 raster dimensions to usize for Pixels::zeroed

* fix(render): remove unused hayro_syntax imports in inspect

* fix(render): let shared raster dimensions reject rounded over-budget sizes before allocation

* chore(pdf): repin craft-libs to #2497 and align tests with shared contract

* fix(render): align remaining 8 tests and OutputLimit error with craft-libs contract

* docs(attribution): update ATTRIBUTION.md for shared hayro* dependencies

* docs(attribution): include adobe_data suffix for hayro-cmap in ATTRIBUTION.md

* docs(attribution): sync ATTRIBUTION.md with cargo xtask assets --write

* docs(licenses): update NOTICE hash and hayro-interpret asset licences in LICENSES.toml

---------

Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
2026-11-20 02:53:23 -05:00
Dylan M. Taylor 0a53d7cc22 create: use shared JPEG and JP2 embedding probes from craft-image-codecs (#778) (#7939)
* create: use shared JPEG and JP2 embedding probes from craft-image-codecs (#778)

* deps: pin craft-image-codecs to craft-libs main a7c6c9d6
2026-11-20 00:34:51 -05:00
Dylan M. Taylor 006e79b5ab Restore JPEG metadata preflight parity (#7930) 2026-11-19 23:22:57 -05:00
Dylan M. Taylor e1d2f32e58 export, xfdf: cut over portable HTML writer and XFDF/FDF grammar to craft-libs (#778) (#7914)
* export, xfdf: cut over portable HTML writer and XFDF/FDF grammar to craft-libs (#778)

* fix(xfdf): align craft-xml rev with craft-xfdf and deref standalone El

* fix(xfdf): remove redundant deref on standalone(el, ns)

* xfdf, export: update craft-libs pin and add XFDF annotation round-trip test

* chore: align craft-xml rev with craft-xfdf

* chore: repin craft-xml to craft-libs main

* chore: repin craft-xml, craft-xfdf, craft-html to craft-libs main

* test(xfdf): pass &str to import_comments in round-trip test

* test(xfdf): bind dst.get(dst_ref) before as_dict

* test(fonts): import pdfcraft_cos::Stream in embedding tests

* test(xfdf): update newly added square annotation instead of widget[0]

* test(xfdf): read newly imported annotation at Annots.last() in roundtrip test
2026-11-19 22:42:25 -05:00
FredApps 6de83353bd Merge pull request #7916 from dotCooCoo/fix/fonts-embedding-test-stream
Fonts: the embedding tests import Stream
2026-11-20 09:16:43 +07:00
dotCooCoo 521cb6a0f9 Fonts: the embedding tests import Stream
Commit 49fe62434 moved the font wire builders into their own module and dropped Stream from the imports of embedding.rs. Two tests in its test module still call Stream::flate, so cargo check --tests failed on main with E0433. The test module now imports Stream.
2026-11-19 15:58:18 -08:00
Dylan M. Taylor d7f4c6a668 mcp: delegate stdio framing and JSON-RPC envelopes to craft-mcp-server and craft-jsonrpc (#7910) 2026-11-19 18:38:34 -05:00
Dylan M. Taylor 49fe624347 fonts: isolate Type0, CIDFont, ToUnicode, and FontDescriptor wire builders (#7911)
* fonts: isolate Type0/CIDFont/ToUnicode/FontDescriptor wire builders

* fonts: fix clippy unused import and CidMapping::width lint
2026-11-19 18:32:37 -05:00
Dylan M. Taylor cbcacac205 create: share JPEG and JP2 embedding probes without re-encoding (#7902) 2026-11-19 17:51:12 -05:00
Dylan M. Taylor 043ccbdf84 export: isolate portable HTML and XFDF/FDF grammar (#7868)
* export: isolate portable HTML and XFDF/FDF grammar

* Fix extracted XFDF helper references and format affected crates

* Borrow HTML export items and finish extracted XFDF lint cleanup
2026-11-19 14:00:55 -05:00
wstockandClaude Fable 5.1 f0bbce5b30 Issue #2385: audit finds thick strokes, black highlights and white boxes over text (#2408)
* Issue #2385: audit finds thick strokes, black highlights and white boxes over text

Three ways of hiding text that a reader sees as redacted were reported clean
while the text stayed extractable:

- a thick stroke along the text (`0 G 20 w 70 705 m 400 705 l S`, marker
  style): the walker now tracks the stroking color, the line width and `/CA`,
  and a single axis-aligned `m`/`l` segment stroked opaquely counts as the
  rectangle it paints (half the width each side);
- an opaque `/Highlight` annotation dark enough to hide the text (`/C [0 0 0]`):
  the annotation pass now reads highlights too (color from `/C`, `/CA`,
  Hidden/NoView skipped) and reports them as `covered-text`;
- an opaque white rectangle after dark text (`1 g 70 695 330 20 re f`): its
  own kind, `hidden-under-white` (relative luminance of the paint >= 0.9; the
  `0.9 g` table shading stays unflagged), so callers can decide.

The `doc_audit_redactions` tool description lists the new covers and kind;
the module docs state the limits (slanted or bent strokes, other filled
paths, shadings and patterns are still out of scope).

Tests: thick_stroke_over_text_is_a_cover, black_highlight_annotation_over_
text_is_a_cover, white_rectangle_over_text_is_reported_as_hidden_under_white
(the report's three cases, with the hairline, yellow, translucent, hidden and
outlined negatives); graphics_state_carries_across_streams now expects the
white kind for its white rectangle.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011K1peyrh5MdZ6ttHkVq8Gh

* audit: ExtGState /LW and omitted alphas, stroke width across the CTM, white first, highlight quads (#2385 review)

- gs sets /LW as the line width, and a /ca or /CA the dictionary leaves out
  keeps its earlier value (ISO 32000-2 8.4.5) instead of resetting to opaque.
- A stroke's width is measured across the segment after the CTM, so a
  non-uniform scale no longer widens horizontal and vertical strokes alike.
- A white cover is hidden-under-white even over white text, which the
  contrast check had classified as covered-text.
- An opaque Highlight hides what its /QuadPoints paint, not its /Rect; the
  /Rect stays the fallback when there are no usable quads.

Tests: ext_gstate_sets_line_width_and_keeps_omitted_alphas,
stroke_width_follows_a_non_uniform_ctm_across_the_segment,
white_cover_over_white_text_is_hidden_under_white,
highlight_covers_its_quad_points_not_its_rect

* audit: document that a Highlight is judged by its dictionary, not its /AP

Developed with AI assistance (Claude Code).

* audit: a white Square is hidden-under-white; a hidden Redact mark is still unapplied (#2385 review)

An opaque /Square with a white interior went through the dark-cover
contrast test and was passed over, although it hides the text as a white
rectangle in the content does: it is reported as HiddenUnderWhite, like
that rectangle. The Hidden/NoView skip applied to every annotation, so an
unapplied /Redact mark with either flag was no longer reported, which main
reports: the flags hide the mark, not the text, so the skip is for the
cover annotations only.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011K1peyrh5MdZ6ttHkVq8Gh

* audit: a stroke's round or square caps are part of the cover (#2385 review)

`stroked_rect` left the caps out, so a `1 J` / `2 J` marker line (or `/LC` in
an ExtGState) painted half a line width past each end that the audit did not
count: text under a cap stayed extractable and unreported. The cap is tracked
like the width (`J`, `/LC`, cumulative, saved by `q`), and an axis-aligned
stroke is lengthened by the pen's extent along it, `w/2 · |Mᵀ d̂|` after the
CTM (the across-width is `w/2 · |Mᵀ n̂|`, the same rule). A round cap counts by
its box. Butt caps, the default, add nothing.

Test `stroke_caps_lengthen_the_cover`: butt, round, square, back to butt,
vertical, a 4× scale along the stroke, a shear (√2), `/LC` with `/LW`, `Q`
restoring it, and a stroke that reaches `IBAN` only by its cap.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011K1peyrh5MdZ6ttHkVq8Gh

* audit: charge a highlight's quads against the comparison bound

A highlight is compared with every line of its page once per quad, but was
charged for one cover: a /Highlight with many /QuadPoints did page_cost x quads
work for the price of page_cost. hidden_text now spends page_cost per area.

QuadPoints is read only for highlights, and its length is checked before the
numbers are collected.

Developed with AI assistance (Claude Code).

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-19 08:20:37 -06:00
Dylan M. Taylor eeee51ff7b Merge pull request #7572 from keithcsqueensu/rtf-full-writer
Export: bound RTF pictures per placement, bake their rotations, report the pages that lose one
2026-11-18 21:50:30 -05:00
Dylan M. Taylor 44aaf2d003 Merge main preserving RTF safety and PPTX parity fixes 2026-11-18 21:06:36 -05:00
FredApps 5b8cb8ab61 Merge pull request #7830 from storytold/fix/pptx-parity-20261119
Restore plain PPTX tables and shared-writer regression checks
2026-11-19 08:12:39 +07:00
FredApps 21a9d8b1be Merge pull request #7825 from FredApps/test/button-script-completion
test(ui): await native button-script completion
2026-11-19 07:36:44 +07:00
Dylan M. Taylor 93a34204e3 Preserve plain PPTX tables and validate shared-writer semantics 2026-11-18 19:23:10 -05:00
Dylan M. Taylor 79477f3909 Point hayro-postscript to storytold/craft-libs (storytold/craft-libs#790) (#7828) 2026-11-18 19:08:53 -05:00
Dylan M. Taylor 8f4f4ea9c5 Cut over pptx export to craft-pptx (#7823)
* cut over pptx export to craft-pptx (storytold/craft-libs#792)

* style(export): run cargo fmt on pptx.rs
2026-11-18 18:57:36 -05:00
FredApps 60ca578c37 test(ui): await native button script completion 2026-11-19 00:37:30 +01:00
Dylan M. Taylor 8d14c81be2 Bound aggregate input work for rotated RTF picture probes 2026-11-18 18:07:30 -05:00
FredApps 3bc2adbe28 Merge pull request #7805 from FredApps/ci/gate-cleanup-budget-778
ci: allow native gate cleanup to finish
2026-11-19 05:29:14 +07:00
kiwi4boy f77ad824ee Merge main (#7814, which landed steps 1 and 2) and keep the RTF picture fixes
#7814 brought this branch's first two commits to main inside step 2, but not the three
fixes made here since: the RTF picture budget that counts every placement, rotations baked
into the pictures, pictures fitted to the text height, and the pages that lost a picture
reported through truncated_pages. They now sit in step 2's Builder: RTF's flow_doc gives
it a pictures::Budget, and Word's word_doc doesn't, so Word keeps its own limits
(room_for) and turns positioned pictures through their float. The text-height fit is in
the shared picture(), so Word's flowing pictures fit too.

The truncated_pages doc now says what RTF reports: pictures lost to its own limits or a
rotation it couldn't bake. A picture no format can encode is left out of all of them.
2026-11-18 17:28:58 -05:00
Dylan M. Taylorandkiwi4boy d03b99ea54 Export: Word through craft-docx, from the shared word model (rebased #7592) (#7814)
* export: write RTF through craft-rtf's full writer, from the word model

The pages are mapped onto a craft_wordmodel::Document (as_word.rs, the
mapping the DOCX export will share), and craft_rtf::doc::export writes
it. Over the small writer this keeps, in RTF:
- pictures, inline (the engine no longer leaves them out for RTF);
- each page's size, as a section per page (blank pages kept);
- Heading 1 and 2 styles;
- the title;
- hard line breaks inside a paragraph or cell (storytold/pdfcraft#4723).
It also fixes two bugs: \cellx was the absolute page x, so every column
edge sat one left margin too far right, and tables that touched became
one (NIST CSF 2.0 came out with 28 tables instead of 68).

craft-rtf, craft-wordmodel, craft-docx and craft-mime are pinned together
at one craft-libs commit: doc::export takes its own revision's Document.

* export: pin craft-libs main with push_text, the header-row fix and the RTF generator name

craft-rtf, craft-wordmodel, craft-docx and craft-mime move to craft-libs
b8eaa8e2, which has storytold/craft-libs#1946, #1947 and #1950. The
mapping appends through Paragraph::push_text/push_object, tables keep
the default look, and the RTF names PdfCraft as its generator.

* export: write Word through craft-docx, from the shared word model

as_docx.rs no longer writes WordprocessingML itself: as_word::word_doc
maps the pages onto a craft_wordmodel::Document and craft_docx::write
writes it. The decisions stay the same: a page with rotated text or
overlapping text keeps its layout as positioned text boxes and pictures
(watermark-sized text behind, pictures over it, other text on top), the
other pages flow, each page is a section of its own size, a shared page
colour is the document's, the PDF's language goes in the slot Word keeps
for its script, and the media limits are unchanged.

Over the hand-written package this gains:
- a VML fallback for every text box, so Word 2007 opens positioned pages;
- rotated text as a turned text box Word draws as a line;
- the body font named (Arial), with a font table saying it is a sans;
- PdfCraft as the application in docProps/app.xml;
- a picture drawn many times stored once.

The tests that matched XML read the package back through craft-docx.

* parity: the Word export through craft-docx, checked in Word 16, Word 2007 and LibreOffice

* chore: update Cargo.lock after rebasing #7592

---------

Co-authored-by: kiwi4boy <kiwi4boy@gmail.com>
2026-11-18 17:11:01 -05:00
FredApps 1f3aa5311c Merge remote-tracking branch 'origin/main' into ci/gate-cleanup-budget-778 2026-11-18 22:32:53 +01:00
FredApps 56f19a32c0 Merge pull request #7811 from FredApps/test/startup-password-completion-order
test: avoid racing startup password completion order
2026-11-19 04:32:05 +07:00
FredApps f9bfa19e74 test: keep startup password assertions independent of worker order 2026-11-18 21:26:45 +01:00
Dylan M. Taylor ac8c44517d Fit RTF pictures within page bounds and report omitted media 2026-11-18 14:57:09 -05:00
FredApps ec7e4342f7 ci: allow native gate cleanup to finish 2026-11-18 20:15:17 +01:00
Dylan M. Taylor 1cd10fb9b2 Merge current main while preserving RTF and HTML media regressions 2026-11-18 14:06:43 -05:00
Dylan M. Taylor 0b50bddc84 Bound RTF picture expansion and bake image rotations before embedding 2026-11-18 14:05:40 -05:00
FredApps bad6ac7fa2 Merge pull request #7779 from FredApps/chore/778-xfa-merged-pin
Use merged XFA namespace and BOM safety fixes
2026-11-19 00:57:14 +07:00
Dylan M. Taylor b11d37c0ed Merge pull request #7795 from storytold/fix/shared-ocsp-wrapper-pin-20261118
fix(sign): consume standard OCSP certificate wrapper parsing
2026-11-18 12:36:28 -05:00
FredApps fe16ea4834 fix(xfa): classify shared namespace admission as too large 2026-11-18 18:07:30 +01:00
Dylan M. Taylor dbf59f410f Merge pull request #7786 from storytold/test/ocsp-independent-oracle-20261118
test(sign): keep embedded OCSP certificate oracle independent
2026-11-18 11:54:34 -05:00
FredApps 39b3f45a9d Merge current main to validate the #778 dependency pin with baseline repairs 2026-11-18 17:07:47 +01:00
Dylan M. Taylor 3f1088afe2 Keep the OCSP parity oracle independent for embedded certificates 2026-11-18 11:01:52 -05:00
Dylan M. Taylor 209c040cce Merge pull request #7783 from storytold/fix/unused-tag-import
Keep the DER tag import where the test oracles use it
2026-11-18 10:43:26 -05:00
Dylan M. Taylor c9c4eb94e8 Keep the DER tag import where the test oracles use it 2026-11-18 10:43:09 -05:00
FredApps 6d95958ccc Use merged XFA namespace and BOM safety fixes 2026-11-18 16:08:32 +01:00
Dylan M. Taylor f1ace254bf Merge pull request #7656 from storytold/refactor/shared-ocsp
Sign: parse ocsp through shared PKCS7 components
2026-11-18 10:08:06 -05:00
Dylan M. Taylor 34d6706088 Pin shared PKCS7 adapters to merged parts API 2026-11-18 09:58:51 -05:00
Dylan M. Taylor d79a0fdc3d Merge main into shared OCSP adapter, retaining CRL parity coverage 2026-11-18 09:58:06 -05:00
Dylan M. Taylor a49a037db6 Merge pull request #7646 from storytold/refactor/shared-xfdf-fields
XFDF: use shared bounded field-value reader
2026-11-18 09:53:53 -05:00
Dylan M. Taylor e6274ea729 Merge branch 'refactor/shared-xfdf-fields' of github.com:storytold/pdfcraft into pr-7646 2026-11-18 09:53:36 -05:00
Dylan M. Taylor 70c7cebde8 Merge remote-tracking branch 'base-src/main' into pr-7646
# Conflicts:
#	Cargo.lock
2026-11-18 09:50:17 -05:00
Dylan M. Taylor e835554187 Merge pull request #7655 from storytold/refactor/shared-x509
Sign: parse x509 through shared PKCS7 components
2026-11-18 09:47:14 -05:00
Dylan M. Taylor 78706fe8c0 Merge pull request #7654 from storytold/refactor/shared-crl
Sign: parse crl through shared PKCS7 components
2026-11-18 09:47:10 -05:00
Dylan M. Taylor 7c15cb5019 Merge pull request #7642 from storytold/refactor/shared-xfa-xml
XFA: use shared namespace-aware XML DOM
2026-11-18 09:47:03 -05:00