Commit Graph
6348 Commits
Author SHA1 Message Date
Harrison Booth 6d24eedac9 docs: cover attachment edit helpers 2026-10-30 20:26:11 -05:00
Harrison Booth ab433eb763 M12: edit attachment descriptions 2026-10-30 20:15:49 -05:00
mtlcl410andClaude Opus 5.5 f43a8af538 M5: a right-click on a group member selects its group
Review follow-up on #4358: the secondary-click path still selected with cx.hit, which misses a group subordinate lying outside its primary's rectangle and cleared the selection, so the menu offered page actions instead of the comment's. It now uses the group-aware cx.click_hit, as the click does (ISO 32000-2 §12.5.6.2). Double-click editing goes through the same group-aware hit as the click since the rebase onto main, where the press owner comes from the module's hit test; the test covers both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 08:51:24 +08:00
skylar taylor-barrick 65ff3a00c0 Merge pull request #4172 from songzhihui/fix/windows-cjk-viewer
M2: continue CJK viewer fallback for Windows GBK PDFs
2026-10-30 18:45:08 -06:00
Grzegorz MartensandClaude Opus 5.5 7d422a0998 M11: JBIG2 alone isn't decoded for Group 4 unless it is resampled
An ordinary scan stored as JBIG2 was decoded for Group 4 by default, at 0.26 s a page at 300 ppi,
and came out unchanged: Group 4 of a symbol-coded page was 201,132 bytes against 17,291. Over a
500-page scan that is minutes for nothing. Dropping the guard changed no output, as a cost guard
wouldn't, so its test counts the pixels decoded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-10-31 01:39:27 +01:00
mtlcl410andClaude Opus 5.5 6085c9110e M5: a Replace Text group makes Replace Text defaults; an empty caret lends no text
Review on #4358:
- Make Current Properties Default on a Replace Text group selected the
  caret, the group's primary, and updated the Insert Text tool. A caret whose
  group holds a grouped /IT /StrikeOutTextEdit strikeout now updates the
  Replace Text tool; a caret of its own still updates Insert Text.
  Test: a_replace_text_group_makes_replace_text_defaults.
- fill_group_text let an empty caret take the primary's slot, so a later caret
  with the replacement text was not listed. Only a caret with text lends it.
  Test: an_empty_caret_does_not_hide_the_next_carets_text.

Both tests fail with their fix reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 08:29:58 +08:00
mtlcl410andClaude Opus 5.5 492011348e M5: comments in an /RT /Group are one comment, with the primary's attributes, ported onto main
A single squashed port of the branch's four commits onto current main, which
split annot's lib.rs (info.rs, modify.rs), render's inspect.rs (model.rs,
annotations.rs, tests.rs), engine's lib.rs (comments.rs, edit/run.rs) and
ui-egui's comments.rs (tools/comments/*). The behaviour and tests are the
branch's (ISO 32000-2 §12.5.6.2):

- a group subordinate is part of its primary's comment: listed, selected,
  exported and deleted with it, with the primary's attributes;
- Replace Text writes the caret as the primary and the strikeout as its
  subordinate; earlier groups (strikeout primary, text on the caret) still
  list their text, through a map;
- deleting a group refuses a locked member, and a subordinate whose primary
  is past the depth limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 08:29:58 +08:00
mtlcl410andClaude Opus 5.5 726024143f M3: a document that hides only the toolbar leaves no empty mode bar under the macOS menu bar
Review follow-up on #4378: HiddenInterface::mode_bar skipped the bar only when both the toolbar and the menu bar were hidden. With the native macOS menu bar the bar never draws the menus, so a document setting only HideToolbar (ISO 32000-2 Table 147) left an empty 48 px bar above the page. The bar now goes when the tools are hidden and the menus are hidden or native.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 08:27:02 +08:00
mtlcl410andClaude Opus 5.5 ef5f6915b8 M12: the XFA reader holds the text it assembles to the template limit
Review on #5010: MAX_TEMPLATE_TEXT allowed for a UTF-16 packet growing
into UTF-8, but not for the other ways a packet's text can grow past its
bytes. Each byte that isn't valid UTF-8 becomes a three-byte replacement
character, and the packets of an array are joined by newlines, so a
document within the 64 MB packet limit could hand parse a template it
refuses. read_packets now checks the text it assembles, each packet and
its newline before they are added, and the text of a single stream,
against MAX_TEMPLATE_TEXT, and refuses past it as too large; a template
it returns always parses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 08:21:56 +08:00
mtlcl410andClaude Opus 5.5 175d4e4de1 M10: an unreadable glyph name reads as WinAnsi in the editor too (#3962)
Review on #3969: for a symbolic TrueType font without an encoding, the
editor overlaid only the codes whose glyph has a name with a Unicode
value on its Standard table. A code whose glyph name has none kept
Standard's reading (0xC4 `tilde`, 0x80 nothing), while extraction falls
back to WinAnsi (vendored hayro-interpret patch (53)): `Ä`, `€`. Such a
code now reads as WinAnsi in the editor as well, so editing and
extraction show the same text.

vendor/README.md: patch (53) names the function it adds,
`EmbeddedKind::symbolic_text`, states the glyph-name rules it shares with
the editor, and lists the pdfcraft-fonts test too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 08:18:00 +08:00
Grzegorz MartensandClaude Opus 5.5 d41d4c5eaa Merge the fixes to the PR below into this one
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-10-31 01:16:58 +01:00
mtlcl410andClaude Opus 5.5 5c371183c4 M3: documents that hide the toolbar, menu bar or window controls open that way; FitWindow and CenterWindow, ported onto main
A single squashed port of the branch's five commits onto current main, which
split ui-egui's lib.rs (app.rs, app/files.rs), canvas.rs (canvas/zoom.rs,
canvas/tests.rs) and control.rs (control/host.rs), replaced the Menu button
with a menu bar and moved the rail and panels into panels/side_panels.rs. The
behaviour and tests are the branch's (ISO 32000-2 Table 147):

- HideToolbar, HideMenubar and HideWindowUI apply in the document's tab, and
  F8 (view.toggle_interface) brings them back; on main the toggle is listed in
  the View menu beside Full Screen and Read Mode, HideMenubar hides the menu
  bar, and HideWindowUI skips the side panels;
- FitWindow measures the spread the view shows, and FitWindow and CenterWindow
  wait only while the document is the window's only one;
- a reloaded document keeps its tab's hidden interface; one-page-at-a-time
  layouts open at fit page;
- the two strings are in every catalog, fa.tsv (added on main since) too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 08:16:56 +08:00
Grzegorz MartensandClaude Opus 5.5 24c6529f77 M11: test: a palette stream is read up to exactly 16 KiB of raw data
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-10-31 01:15:52 +01:00
Dylan M. Taylor ec33924e80 fix(flatpak): allow reading launcher version pins (#5490)
* fix(flatpak): allow reading launcher version pins

* fix(flatpak): allow reading launcher version pins
2026-10-30 20:12:04 -04:00
mtlcl410andClaude Opus 5.5 53d0e36533 M10: the symbolic glyph-name patch is hayro-interpret patch 53 (#3962)
main added hayro-interpret patches 51 and 52 (bounded saved graphics
states, /W2 runs past the largest CID), so this branch's patch is now
53 in vendor/README.md; the code comments that cite it follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0175FWj4xFhMhSH3UpMU8DSC
2026-10-31 08:11:30 +08:00
mtlcl410andClaude Opus 5.5 8c3812499c M10: read a font's post names once for the 256 codes (#3962)
CodeRabbit on #3969 (nitpick): Post::glyph_name walks a version 2.0 table's name data
from its start for each glyph, and symbolic_glyph_texts asks for up to 256, so an
untrusted font program (up to 16 MiB) could make opening a document slow. The names the
table spells out are now read once (post_custom_names) and looked up by index
(post_name), giving what Post::glyph_name gives; a test checks that for every glyph of
Inter's version 2.0 table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 08:11:24 +08:00
mtlcl410andClaude Opus 5.5 3fe55aae22 M10: the editor reads a swapped post version as the renderer does (#3962)
CodeRabbit on #3969: symbolic_glyph_texts read `post` straight from the font, so a
version written with its halves swapped (00 00 00 02 for 2.0, which the renderer
repairs since #2946, vendored hayro-interpret patch (49)) gave the editor no glyph
names while the renderer drew the font. The table is now read as the version it means
first. The test builds the same symbolic font with the swapped version and gets the same
text. Also removes a stray `|` main had left in hayro-interpret's test list, which split
it into a sixth cell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 08:11:23 +08:00
mtlcl410andClaude Opus 5.5 3200a5078d M10: the editor finds a symbolic font's glyph through the cmap as the renderer does (#3962)
Review follow-up. symbolic_glyph_texts tried each offset across every cmap
subtable, while the renderer reads the records in order, each with its
offsets, and only Windows (3,0)/(3,1) and Macintosh or Unicode-platform
encoding-0 records. A font with a (3,0) and a (3,1) cmap could give the editor
another glyph, and so another name, than the page shows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 08:11:21 +08:00
mtlcl410andClaude Opus 5.5 197b15d8b7 M10: extraction reads glyph names by the same rules as the editor (#3962)
Review follow-up. The renderer kept only glyph names it could look up whole,
so a variant such as `a.ss01` fell back to WinAnsi while the editor's
glyph_text dropped the suffix and read `a`. The vendored patch now reads names
by the same Adobe Glyph List rules (suffix dropped, `_` components, uniXXXX
groups, uXXXX to uXXXXXX), giving several characters for a ligature, and
checks /Differences itself now that the step sits outside the name chain.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 08:11:09 +08:00
mtlcl410andClaude Opus 5.5 3271fabc5c M10: a symbolic TrueType font without an encoding reads its glyph names (#3962)
FrameMaker files distilled with Distiller 3 embed symbolic TrueType subsets
with no /Encoding and no /ToUnicode, whose codes are glyph positions in the
Macintosh order, 29 below ASCII; the font's own cmap maps them to the right
glyphs. Read as WinAnsi (extraction, Word export) or as Standard (the
editor), `Solid` came out as `6ROLG`.

Both readers now take the post-table name of the glyph a code selects, when
that name has a Unicode value, as MuPDF does; the editor's reverse map makes
typing set the same glyphs. Fonts flagged Nonsymbolic, fonts with a named
base encoding, and fonts the editor already treats as Symbol or ZapfDingbats
by name keep their old reading. Vendored hayro-interpret patch (46).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 08:10:25 +08:00
mtlcl410andClaude Opus 5.5 582d491b2f M3: a shared /QuadPoints array that no longer fits the budget is not read again
Review on #4474: past the text budget every link still resolved and
parsed its whole /QuadPoints array before dropping the result, so many
links sharing one long array cost its length each. Now no array is read
once less than one quadrilateral's bytes is left, and an indirect array
that did not fit is remembered and skipped for later links (the budget
only shrinks). A guard on the budget being exactly zero alone would
rarely trigger, since URIs spend from the same budget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 08:07:02 +08:00
Grzegorz MartensandClaude Opus 5.5 e0e40c6460 Merge the fixes to the PR below into this one
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-10-31 01:06:26 +01:00
Grzegorz MartensandClaude Opus 5.5 6ad95f0aa4 M11: an indexed image's palette is read once it matters, within 4 KiB; a colour key keeps its image
From a review of the spellings an indexed image can take:
- The palette was read for every 1-bit indexed image, resampled or not, and twice each. Images
  share a table, so 1,000 images sharing one with 16 MiB of raw data took 16 to 60 s, none of
  them resampled. It is now read only for an image about to be resampled, and a table over
  4 KiB is refused before it is copied or decoded, since no palette needs that.
- A colour key can hide the dark sample a tie goes to, so a thin rule of the other was lost: a
  white rule on a hidden black went from 255 to the backdrop's 128. An image with a colour key
  now keeps its resolution. Grey had this since #5426 and is covered too.
- `/Indexed` by reference, and a base of `[/DeviceRGB]`, are the same colour space and are read
  so. `/I`, an inline abbreviation, and a real hival aren't, and such an image is left alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-10-31 01:05:58 +01:00
mtlcl410andClaude Opus 5.5 409477067a M8: the redact README lists every fail-closed trigger and the metadata it doesn't scrub (#2448)
Review on #2539 (nitpick): the README named only the collection limit
and unreadable XMP as fail-closed cases. It now lists all of them (the
run and run-length limits, a removed glyph with unknown text, a form
XObject removed unread past the depth limit or unreadable, the term
limits, the search work limit, oversized or undecodable XMP) and the
metadata the check leaves to Sanitize: XMP on objects other than the
catalog and pages, bookmark titles, and attachments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 08:05:51 +08:00
mtlcl410andClaude Opus 5.5 24ac313428 M5: a callout given its arrow point alone keeps its knee (#1152)
comment_edit with one point on a callout whose /CL has six numbers built
the new line from that point and the end only, so the knee was dropped
without a word. An agent moving just the arrow lost the knee.

place_text_box now keeps the old knee when only the arrow point is given;
two points still set both, and a four-number /CL still gains a knee only
when one is sent. The points schema says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 08:02:40 +08:00
mtlcl410andClaude Opus 5.5 a36dcbb3bc M5: a callout's leader line follows its text box while the box is resized (#1152)
Review on #4094: resizing a callout's text box moved its frame, but
changing_points had no Resize branch, so no leader line was drawn to the box
until the page was redrawn. A Resize gesture, and the ResizeAnnotation edit
just released, now count as changing the callout: its points stay and its
line is drawn to where the box is going. A box moved alone and released keeps
its knee beside it, as while it was dragged.

Test: a_callout_being_resized_draws_its_leader_line, which fails with the fix
reverted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 08:01:02 +08:00
mtlcl410andClaude Opus 5.5 adc0b91b1e M5: callouts reshape by their arrow point, knee and text box, ported onto main (#1152)
A single squashed port of the branch's seven commits onto current main, which
split the files this touched into modules: annot (create.rs, modify.rs,
info.rs), render inspect (model.rs, annotations.rs), engine comments.rs and
ui-egui tools/comments/*. The behaviour and tests are the branch's:

- a callout's arrow point and knee have handles and move on their own; its
  line follows the box as Acrobat's does; its text box resizes;
- comment_list gives a callout's points and text box, comment_edit reshapes it;
- /CL is read all or nothing, and a box sent back as f32 still moves or keeps
  its line.

On main, select_input's knee cursor moved into point_cursor to stay under the
cognitive-complexity limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 08:01:02 +08:00
mtlcl410andClaude Opus 5.5 8a7394c578 M3: link_list reports the address the viewer opens, not a second resolution
Once inspection's text budget is spent, a relative URI keeps its raw address, and that is what
the viewer opens. link_list resolved it afresh against /URI /Base and reported an address
nobody opens. It now reads resolved_url from the inspected target, and resolves only for a link
inspection did not list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 07:49:28 +08:00
mtlcl410andClaude Opus 5.5 378ad5eafc M3: relative links resolve against the document's base URI; a link is active only in its QuadPoints
The PR's five commits (base URI resolution, QuadPoints hit areas, their budget, the /Rect gate,
zero-area quads, f64 containment), ported onto main, where inspect.rs, canvas.rs and the
comments tool were split into modules: DocInfo::uri_base in inspect.rs, Link::quads and
Link::contains in inspect/model.rs, the reading in inspect/core.rs and inspect/annotations.rs,
their tests in inspect/tests.rs, and PageXform::link_contains in canvas/xform.rs.

ISO 32000-2 §12.6.4.8 Table 211 (/URI /Base) and §12.5.6.5 Table 176 (/QuadPoints).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 07:49:28 +08:00
Grzegorz MartensandClaude Opus 5.5 689a1e34cf M8: test: a cleared image of more than one bit stays Flate
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-10-31 00:41:23 +01:00
Grzegorz MartensandClaude Opus 5.5 fbb1942933 Merge the fixes to the PR below into this one
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-10-31 00:41:23 +01:00
Grzegorz MartensandClaude Opus 5.5 e2adbe7faa M11: tests: an indexed palette is read by its colours' luma, and only a real palette counts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-10-31 00:41:23 +01:00
Grzegorz MartensandClaude Opus 5.5 4d30af00a9 Merge the fixes to the PR below into this one
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-10-31 00:20:54 +01:00
mtlcl410andClaude Opus 5.5 a767cca629 M12: test hidden page-master instances across the hide matrix and several page areas
Two tests wireless89 offered in the #5368 review. Hiding the first, middle,
last or every master widget keeps every master[n] addressable and counted,
live and after save and reopen. With several page areas, a hidden-only
master still counts and a removed page leaves no stale count. Both fail
without 350a41f29 (master count 2 and a TypeError from resolveNode for the
last page; the Cover/master counts in the page-area test).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 07:20:51 +08:00
mtlcl410andClaude Opus 5.5 e5faac8e52 M12: an XFA page counts for its page area even when all its master fields are hidden
Each page laying the form out writes names the page area it was made from
(PCXfaArea), and page_area_uses counts those pages, so a page whose only
master field a script hid keeps its master nodes in the script model and a
later script can show them again (review). A file laid out before pages
were named is still read from its generated fields. Adds two tests from
wireless89's review: page-local and shared master values through relayout,
save, reopen and print, and the page whose last master widget is hidden.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 07:20:51 +08:00
mtlcl410andClaude Opus 5.5 74930f3929 M12: what scripts set on XFA page-master content is applied to that page when laid out again
apply_overrides walks the body only. Page-master content is now set
page by page: each page made from a page area gets its own copy of the
area's content with the overrides its SOM path (Body[n]...) carries, so
a field a script hides on page 2 is hidden there only after a relayout.
The copies are kept for the whole layout, as the measurement cache keys
on node addresses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Pq7HyCfwzyRXj4VfQAVVdv
2026-10-31 07:20:36 +08:00
mtlcl410andClaude Opus 5.5 63a77901e6 M12: an XFA page master's content is its own on every page, in the layout and in scripts
Master-page content repeated on each page shared one SOM path (`master[0]`), so its fields
shared one data node and one script node. Each page's copy is now `master[n]`:
- the layout names it so;
- data binds it per page, except a field bound globally or by explicit ref, which stays shared
  (XFA 3.3, "Page Background");
- the live form has one page-area node per page laid out from it, counted from the generated
  fields, so a button on page 2 runs its click script as itself.
- an event listed before a script laid the form out again can name an object that is gone (a
  page the form no longer fills): it is not run, rather than run with `this` at the form's root,
  where `this.presence = "hidden"` hid the whole form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CBVyQEwtmEw3mS1MoAiwrK
2026-10-31 07:20:36 +08:00
Grzegorz MartensandClaude Opus 5.5 d7bd36251b Merge the fixes to the PR below into this one
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-10-31 00:20:28 +01:00
Grzegorz MartensandClaude Opus 5.5 d1677b4b3f M11: an indexed image also drawn where the optimizer doesn't read keeps its resolution
From CodeRabbit's review: default colour spaces apply to an indexed colour space's
device base, so one in force where an annotation's appearance (or a pattern, or
another image's /Alternates) draws the image may change which palette entry is darker,
and the tie a resampled image keeps. Only black-and-white RGB went through
used_elsewhere; indexed images now do too when downsampling is on, and one used beyond
the page and form resources the walk read keeps its resolution, as such RGB keeps its
colour space.

A grey image stays out of this check, since sample 0 stays dark in a grey space, and #5426's rule
for grey is unchanged: the test now has a grey image drawn on the page and in an annotation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-10-31 00:20:10 +01:00
Grzegorz MartensandClaude Opus 5.5 7fbb40a2c1 Merge the fixes to #5461 into this PR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-10-31 00:20:10 +01:00
Grzegorz MartensandClaude Opus 5.5 5480dbe163 M2.6: shared JBIG2 globals are read once a document; Copy Image is tested on JBIG2
From CodeRabbit's review of the stack:
- Every JBIG2 image read its /JBIG2Globals afresh, within 32 MiB each but with no
  bound across an export or a redaction. A globals stream of the file, not edited since
  it was read and with its /DecodeParms direct, now has its filters undone once a
  document and is kept for the images that share it (in every clone, which share the
  file), up to 64 MiB in all. An edited one, one added in memory, or one with
  /DecodeParms by reference (another object, which can change under it) is read each
  time as before. This saves the filters only: the decoder reads the segments afresh for
  every image, so a real symbol dictionary still costs its decoding once an image.
- view.copy-image dropped "JBIG2 inside other filters" from its missing list on the
  strength of Export's test; Copy Image now has its own: a JBIG2 picture behind
  ASCIIHexDecode is found under the pointer and copied as its pixels and as a PNG, and
  one whose page information is in its globals is read through them.

A JBIG2 image's /Width and /Height are read as given directly; one by reference is an
error rather than an image of no rows.

A /JBIG2Globals reference to no object still reads as no globals: it is a reference
to null (ISO 32000-2 §7.3.10), which an entry may hold for being absent (§7.3.7), and
the renderer draws the page so. An image that needed those globals then mostly fails
to decode; in a probe of twelve pictures that decoded with them, eleven were refused
and one decoded to other pixels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-10-31 00:06:56 +01:00
oracola91 78b8dfbaef Exports join wrapped Chinese and Japanese lines without a space
Chinese and Japanese text wraps between characters, so the word space
put at each joined line break showed up inside the text. No space is
added now when both sides of the break are Chinese or Japanese
characters, their punctuation or fullwidth forms; Korean, which spaces
its words, still gets one. A line ending in a full-width full stop,
exclamation or question mark (also inside closing corner brackets) now
ends its paragraph like one ending in a full stop.

The new test lines fail without the change. The wrapped sentence test
now checks the Markdown export too, which goes through the same
joining since it was added.
2026-10-31 00:51:26 +02:00
oracola91 b98b20633c Exports keep a bulleted list as paragraphs, not a table
Word and LibreOffice often draw a list's bullet in a symbol font, a
tab stop before the item's text, so each bullet is a block of its own.
Table detection read the bullets and the items as two columns, and
every export wrote the list as a borderless two-column table.

Each bullet is now paired with the text that starts within three times
its size after it on its line. The text runs on from its bullet, and
bullets stay out of table detection, so Word gets one paragraph per
item with the bullet first. The Symbol and Wingdings bullets Word
writes (U+F0B7, U+F0A7) count. A dash or a middle dot counts only when
nothing starts left of it on its line, so a dash that stands for
"none" in a table row stays a cell.

The new export and automation tests fail without the change.
2026-10-31 00:47:05 +02:00
oracola91 ce12a12788 Exports keep a wrapped paragraph as one paragraph
Reading splits a line wherever its style changes, and export joined
those blocks along one line only (#4158). A sentence with a bold name
in one line and an italic name in the next came out of Word, HTML, RTF
and PowerPoint as one paragraph per line.

A paragraph whose last line reaches the right edge of the page's text
now runs on into the line just below it, when that line starts at the
same left edge in the same size. Headings, list items, a line that
ends a sentence, an indented line and a line after paragraph space
keep their break. A slanted run whose box leans into the next word by
up to 0.3 of its size still runs on into it.

The new export and automation tests fail without the change.
2026-10-31 00:47:04 +02:00
oracola91 a54fc93d4a Merge remote-tracking branch 'upstream/main' into fix/type3-cleanup-keeps-other-drawers 2026-10-31 00:46:22 +02:00
oracola91 0cb06e4568 Redaction keeps a page Type 3 font that a pattern or soft mask shows
The page font prune counted the page content, forms without /Resources
and annotation appearances, but not tiling patterns or soft mask groups
without /Resources. Those draw through the page's resources too, so a
Type 3 font only they selected left the page and their text lost its
font. They are now read as well, only when the page lists a Type 3
font.

Two new tests fail without the change.
2026-10-31 00:46:22 +02:00
Grzegorz MartensandClaude Opus 5.5 85c1005148 fix(render): a JBIG2 page's segments are bounded in what they hold and refer to (hayro-jbig2 patches 5 to 9, hayro-syntax 29)
Each JBIG2 bitmap was bounded on its own, but a few kilobytes could still exhaust memory:
nothing bounded what a page's segments hold for later ones, or how far one segment could
multiply them. Measured on black-box streams, peak memory before and after:

- intermediate regions, 16 in 774 bytes: 514 MiB, now 98 MiB;
- an 8 MiB symbol exported 1,200 times, a 2,989-byte PDF: killed at 8 GiB, now 79 MB;
- dictionaries of zero-width symbols: 781 MB, now 72 MB;
- dictionaries retaining their coding contexts, 1.1 MB: 2.89 GB, now 71 MB;
- 65,535 references to one dictionary, 78 KB: about 17 GB, now 6 MB;
- a halftone grid of 16,384 cells a side, 98 bytes: 1.1 GB, now 2.4 MB;
- a pattern dictionary of 65,535 patterns, 48 bytes: 539 MB, now 15 MB, and it still draws;
- a custom Huffman table behind nested Flate, a 1,297-byte PDF: killed at 8 GiB, now 278 MB,
  which is mostly the decoded stream;
- 11-byte segments behind nested Flate in a stream and its globals, a 4,765-byte PDF: 5 GB, now
  602 MB, which is mostly the two decoded streams;
- an Indexed image whose page header claims 2^20 a side, a 743-byte PDF: aborted asking for
  137 GB, now 23 MB;
- a chain of 4,000 /JBIG2Globals streams that are JBIG2 themselves, on a 2 MiB stack: overflowed
  it and aborted, now 24 MB.

So PageState counts what it stores: regions, pattern and symbol dictionaries and Huffman
tables, with bitmap headers, retained contexts and a charge per item, up to 64 MiB, two square
bitmaps of 16,384 a side. A dictionary's new and exported symbols count against what is left as they are
made, not once it is stored. A segment may refer to at most 2^20 symbols, checked before any are
collected. A halftone grid has at most 2^25 cells. A pattern dictionary keeps at most 16 MiB of
shifted copies, which only speed up drawing, and none that wouldn't fit what the page has left. A custom Huffman table has at most 2^16 lines, and a
stream with its globals at most 2^20 segments and 2^22 references, checked as they are read. A
page past the bounds on a bitmap is refused when the stream is opened, since callers size their
output from its header before the page bitmap is made. And in hayro-syntax, a /JBIG2Globals
stream that is itself JBIG2 isn't decoded: globals are raw segments, so it reads as globals that
can't be decoded.

An image past a bound isn't drawn, as with the other caps, and the rest of the page is. This
bounds memory, not time: decoding work has no total yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmsdeUCdTaD72jkDw2pJKY
2026-10-30 23:43:50 +01:00
KenM76andClaude Opus 5.5 9ca051ac06 fix(ui): list X.PDF in file pickers on Linux and the BSDs (#5481)
rfd 0.17 gives each filter extension to the XDG portal, GTK and Zenity as
the glob `*.<ext>`, which those match case-sensitively, so a "PDF" filter
of `pdf` hid `Report.PDF`. `AddFilterAnyCase::add_filter_any_case` passes
each letter as a bracket class there (`pdf` -> `[pP][dD][fF]`) and the
extension unchanged on Windows, macOS and the web, which already ignore
case. Every picker filter in ui-egui now goes through it; the imports
used only by native pickers are gated off wasm.

Fixes #5481

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqmHYx8FiWM5PcsoiErgp9
2026-10-30 18:07:38 -04:00
Eric Kaden 937618f4b7 Merge remote-tracking branch 'upstream/main' into fix/xfa-runtime-highlight
# Conflicts:
#	crates/engine/src/tests.rs
#	crates/ui-egui/src/app.rs
2026-10-30 17:55:37 -04:00
vangel76 6f2ab48e84 Merge upstream/main into feat/optimize-target-bytes
Keep the upstream monochrome optimizer options alongside target_bytes.
2026-10-30 22:29:23 +01:00