22752 Commits

Author SHA1 Message Date
Tim van der Meij
d1c85f87f7
Merge pull request #21330 from calixteman/fix_regex
Enable 'eslint-plugin-regexp' and fix existing findings
2026-05-25 18:22:21 +02:00
calixteman
f82382e010
Merge pull request #21331 from calixteman/fix_cjk_file
Load the predefined CMap for composite fonts that omit the FontDescriptor
2026-05-25 16:40:11 +02:00
Jonas Jenwald
f156b8190b
Merge pull request #21332 from Snuffleupagus/direct-return
Avoid a temporary variable and return results directly in a couple of functions
2026-05-25 16:14:15 +02:00
Jonas Jenwald
48a12ac225 Avoid a temporary variable and return results directly in a couple of functions 2026-05-25 15:33:39 +02:00
Calixte Denizet
8f85e3f20b Load the predefined CMap for composite fonts that omit the FontDescriptor
and add font substitutions for the standard Acrobat CJK families.
2026-05-25 14:44:48 +02:00
calixteman
164ffb9042
Merge pull request #21321 from danyalahmed1995/fix/issue-21259-text-layer-spacing
Prevent inherited spacing from affecting text layer
2026-05-25 14:36:22 +02:00
Calixte Denizet
7bda0fc97c Enable 'eslint-plugin-regexp' and fix existing findings
Enable the recommended preset and fix or per-line-disable the 78
findings it surfaces. Most are equivalent rewrites, intentional
patterns (control chars, the whatwg email regex, autolinker URL regex)
keep their behavior via targeted disables.
2026-05-25 14:31:55 +02:00
Tim van der Meij
87b436ddd4
Merge pull request #21329 from calixteman/fix_selection_color
Force the text selection color to be in light mode
2026-05-25 13:59:13 +02:00
Calixte Denizet
f7af3ea9ac Force the text selection color to be in light mode
Most of the pdfs have a white background, so it makes sense to use the colors for light mode.
2026-05-25 12:59:54 +02:00
calixteman
1cb14a02d3
Merge pull request #21314 from calixteman/issue21312
Recover CFF FontBBox with negative coordinates encoded as unsigned 16-bit
2026-05-25 08:57:43 +02:00
Calixte Denizet
9391296036 Recover CFF FontBBox with negative coordinates encoded as unsigned 16-bit
It fixes #21312.
2026-05-25 08:36:18 +02:00
calixteman
5f2691e77d
Merge pull request #21328 from timvandermeij/updates
Update dependencies to the most recent versions
2026-05-25 08:33:34 +02:00
Danyal Ahmed
4ee9c39fc8 Prevent inherited spacing from affecting text layer
Fixes #21259.

Reset letter-spacing and word-spacing on the text layer and hidden measurement canvas so inherited page styles do not affect text layer alignment. Add an integration regression test for inherited spacing.
2026-05-24 23:56:23 +05:00
Tim van der Meij
33d8f45fc5
Fix vulnerabilities in dependency versions
This patch is generated automatically using `npm audit fix`, and brings
the number of reported vulnerabilities back to zero by patching:

- GHSA-jxxr-4gwj-5jf2: "brace-expansion: Large numeric range defeats
  documented `max` DoS protection"
- GHSA-58qx-3vcg-4xpx: "ws: Uninitialized memory disclosure"
2026-05-24 19:34:07 +02:00
Tim van der Meij
f1f8e2c04e
Upgrade postcss-values-parser to version 8.0.0
This is a major version bump, but the changelog at
17304bbe9c
doesn't indicate any breaking changes that should impact us.
2026-05-24 19:29:57 +02:00
Tim van der Meij
0fa006997b
Update dependencies to the most recent versions 2026-05-24 19:29:09 +02:00
Tim van der Meij
e6cb600896
Merge pull request #21320 from calixteman/issue7625
Substitute a system font when an embedded CFF is truncated
2026-05-24 19:00:50 +02:00
calixteman
adcde1175e Substitute a system font when an embedded CFF is truncated
It fixes #7625.

If the Top DICT's Private DICT extends past the end of the font data,
the Local Subrs INDEX is unreachable and every CharString that calls
a subr ends up as a blank glyph. Throw from parsePrivateDict so the
existing catch in translateFont triggers fallbackToSystemFont, then
run getFontSubstitution post-construction so we pick a close local
match instead of the generic fallbackName.
2026-05-24 18:10:09 +02:00
calixteman
143a7244a3
Merge pull request #21315 from calixteman/issue18548
Keep the first /Subrs and /CharStrings block
2026-05-24 18:07:20 +02:00
Tim van der Meij
13a61b1f72
Merge pull request #21319 from Snuffleupagus/XRefWrapper-fix
Fix the `XRefWrapper` implementation, in the `src/core/editor/pdf_editor.js` file
2026-05-24 15:06:22 +02:00
Tim van der Meij
941e17296e
Merge pull request #21313 from Snuffleupagus/Annotation-OC
Add support for Optional Content in the AnnotationLayer (issue 20433)
2026-05-24 15:02:06 +02:00
calixteman
1f8eed020f Keep the first /Subrs and /CharStrings block
Some Type1 fonts (the embedded Optima variants in orw1972.pdf) ship
two /Subrs and /CharStrings blocks wrapped in save/restore frames
gated on an Adobe hires/lores runtime switch.
In such cases, we just use the first /Subrs and /CharStrings block,
which is the one that is actually used by the font renderer in Acrobat.

It fixes #18548.
2026-05-24 15:01:22 +02:00
Tim van der Meij
bbfbe5159c
Merge pull request #21324 from Snuffleupagus/scaleCharBBox
Simplify how the character BBox is scaled in `src/display/canvas_dependency_tracker.js`
2026-05-24 14:41:34 +02:00
Tim van der Meij
4daca805d6
Merge pull request #21323 from Snuffleupagus/integration-test-more-fromBase64
Use `Uint8Array.fromBase64` in the `test/integration/highlight_editor_spec.mjs` file
2026-05-24 14:37:27 +02:00
Tim van der Meij
d37e0b40a5
Merge pull request #21317 from Snuffleupagus/XfaLayerBuilder-render-shorten
Shorten the `XfaLayerBuilder.prototype.render` method
2026-05-24 14:36:33 +02:00
Tim van der Meij
46b16bd42e
Merge pull request #21322 from Snuffleupagus/fontFile-lookup-shorten
Shorten the `fontFile` lookup a tiny bit
2026-05-24 14:33:25 +02:00
Jonas Jenwald
59086fa582 Simplify how the character BBox is scaled in src/display/canvas_dependency_tracker.js
In many/most PDF documents every glyph will require that the character BBox has scaling/offset applied, which can be made a tiny bit more efficient. In particular:
 - Avoid creating one additional temporary Array for every glyph.
 - Simplify the helper function, since there's no skew-components.
2026-05-24 12:32:19 +02:00
Jonas Jenwald
057507f6ce Use Uint8Array.fromBase64 in the test/integration/highlight_editor_spec.mjs file 2026-05-24 10:56:51 +02:00
Jonas Jenwald
31c6561b91 Shorten the fontFile lookup a tiny bit
Rather than effectively duplicating code, we can use a loop instead.
2026-05-24 10:19:34 +02:00
Jonas Jenwald
05de3c8a88 Fix the XRefWrapper implementation, in the src/core/editor/pdf_editor.js file
When comparing this code with the full `XRef` class it doesn't seem to be entirely correctly implemented, since the `fetch` method is basically doing what the `fetchIfRef` method is intended to do.
2026-05-23 22:40:14 +02:00
calixteman
ea18e73de2
Merge pull request #20542 from calixteman/fontfile3
Use the CFF program directly for CID fonts wrapped in OpenType FontFile3
2026-05-23 21:39:13 +02:00
Jonas Jenwald
bd14524536 Shorten the XfaLayerBuilder.prototype.render method
Given that the "print" intent is handled separately, there's currently a little bit of unnecessary code duplication in this method.
2026-05-23 16:33:23 +02:00
Jonas Jenwald
fb9758303b Add support for Optional Content in the AnnotationLayer (issue 20433) 2026-05-23 12:33:56 +02:00
calixteman
25c7d9eaac
Merge pull request #21316 from mozilla/update-locales
l10n: Update locale files
2026-05-22 08:11:19 +02:00
github-actions[bot]
d8c08b980a l10n: Update locale files 2026-05-22 00:51:32 +00:00
calixteman
98e3a85a44
Merge pull request #21300 from calixteman/issue21298
Sanitize glyf composite cycles, OS/2 length and maxp version mismatches
2026-05-21 21:45:33 +02:00
Calixte Denizet
d6a2b91243 Sanitize glyf composite cycles, OS/2 length and maxp version mismatches
Prune the back-edge components from cyclic composite glyphs in
sanitizeGlyphLocations (leaving non-cyclic siblings intact), reject OS/2
tables whose length is too short for the declared version so a clean
table gets regenerated, and upgrade a version 0.5 maxp table to 1.0 for
TrueType fonts to silence OTS' "wrong maxp version for glyph data".

It fixes #21298.
2026-05-21 21:24:00 +02:00
Tim van der Meij
52d574c539
Merge pull request #21306 from calixteman/dnd_pdf_merging
Allow merging a PDF by dropping it onto the thumbnail viewer
2026-05-21 21:01:42 +02:00
Tim van der Meij
9b5cd3db64
Merge pull request #21304 from Snuffleupagus/PdfTextExtractor-tests
Add basic integration-tests for the `PdfTextExtractor` class
2026-05-21 20:27:53 +02:00
Tim van der Meij
93f01aa412
Merge pull request #21311 from Snuffleupagus/getPdfFilenameFromUrl-test-corrupt-relative
Extend unit-test coverage for the `getPdfFilenameFromUrl` helper function
2026-05-21 20:19:48 +02:00
Tim van der Meij
83c37357dc
Merge pull request #21302 from mozilla/dependabot/github_actions/github/codeql-action-4.35.4
Bump github/codeql-action from 4.35.3 to 4.35.4
2026-05-21 20:18:52 +02:00
Tim van der Meij
223170694c
Merge pull request #21301 from mozilla/dependabot/github_actions/actions/create-github-app-token-3.2.0
Bump actions/create-github-app-token from 3.1.1 to 3.2.0
2026-05-21 20:18:09 +02:00
Tim van der Meij
42db304268
Merge pull request #21305 from Snuffleupagus/integration-test-EventBus-on
Don't use "internal" `EventBus` methods in the integration-tests
2026-05-21 20:17:28 +02:00
calixteman
78cc2e3d38
Merge pull request #21309 from calixteman/issue21307
Fix 'Select all' after #20981
2026-05-21 18:11:56 +02:00
Calixte Denizet
0f90987927 Fix 'Select all' after #20981 2026-05-21 16:39:34 +02:00
Jonas Jenwald
74471651c7 Extend unit-test coverage for the getPdfFilenameFromUrl helper function
Currently there's a couple of branches, specifically for dealing with corrupt URLs, that are not covered by tests.
2026-05-21 14:03:32 +02:00
Calixte Denizet
d79043b3af Allow merging a PDF by dropping it onto the thumbnail viewer
Drop an external PDF anywhere in the views-manager thumbnail
sidebar to merge it at the cursor, rather than always inserting
after the current page via the "Add file" button.

The drop reuses the blue separator from page-move drag so the
user can see exactly where the inserted pages will land, and the
merge path is shared with the existing picker so post-merge
selection/current-page behavior stays consistent.
2026-05-20 18:06:55 +02:00
Jonas Jenwald
429b469ecb Add basic integration-tests for the PdfTextExtractor class 2026-05-20 17:26:50 +02:00
Jonas Jenwald
abe8b564a3 Don't use "internal" EventBus methods in the integration-tests
This way *guarantees* that any and all internal viewer state has been updated first, before any test-specific code runs.
2026-05-20 16:39:21 +02:00
calixteman
5a4d93a238
Merge pull request #20981 from wooorm/wooorm/hcm
Make text selection more visible (bug 1879559)
2026-05-20 15:49:01 +02:00