Commit Graph

14303 Commits

Author SHA1 Message Date
Calixte Denizet
088db47849 XFA - Value in field can be html 2021-06-13 19:50:28 +02:00
calixteman
96c103462a
Merge pull request #13548 from calixteman/default_fill
XFA - Default fill color for rectangle is transparent
2021-06-13 14:11:22 +02:00
Tim van der Meij
e1a5339961
Merge pull request #13552 from Snuffleupagus/update-packages
Update packages and translations
2021-06-13 13:31:54 +02:00
Jonas Jenwald
59f72bbde1 Update l10n files 2021-06-13 10:35:58 +02:00
Jonas Jenwald
014148b28a Update the eslint-plugin-unicorn package to the latest version 2021-06-13 10:35:58 +02:00
Jonas Jenwald
99dc7af590 Update npm packages 2021-06-13 09:59:44 +02:00
Tim van der Meij
a4546e83c3
Merge pull request #13549 from Snuffleupagus/rm-isFetchSupported
Remove the `isFetchSupported` function since the Fetch API is available in all supported browsers
2021-06-12 11:47:04 +02:00
Jonas Jenwald
ddea90b8f6 Remove the isFetchSupported function since the Fetch API is available in all supported browsers
The currently supported browsers, note the minimum versions [listed here](5a4e06af2d/gulpfile.js (L78-L88)), should now have native support for all of the features checked in the `isFetchSupported` function:

 - https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/API/Response#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/API/Body/body#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream#browser_compatibility

Hence this function can now be removed, and the code can thus be simplified a little bit.
2021-06-12 08:01:54 +02:00
Brendan Dahl
5a4e06af2d
Merge pull request #13547 from calixteman/cerfa
XFA - Handle correctly subformSet
2021-06-11 13:09:43 -07:00
Tim van der Meij
c7c59feeaf
Merge pull request #13546 from Snuffleupagus/base_factory-tweaks
Re-factor the `DOMCanvasFactory` and `DOMSVGFactory` implementations slightly
2021-06-11 21:19:11 +02:00
Calixte Denizet
694b14c047 XFA - Default fill color for rectangle is transparent 2021-06-11 18:03:19 +02:00
calixteman
2dc22394e7
Merge pull request #13542 from calixteman/center_radio
XFA - Center vertically radio without caption
2021-06-11 17:55:55 +02:00
Calixte Denizet
d1e945998b XFA - Handle correctly subformSet
- it aims to avoid to loop forever when opening pdf in #13213;
  - the idea is to consider subformSet as inexistent when running in the tree. So if we've subformA > subformSet > subformB then subformB will be visited as a direct child of subformA.
2021-06-11 17:49:17 +02:00
Jonas Jenwald
7b17dc8bfd Re-factor the fetchData helper function, in src/display/display_utils.js to be asynchronous 2021-06-11 17:16:00 +02:00
Jonas Jenwald
b05a22d01b Re-factor the DOMSVGFactory to extend an abstract base class
This is first of all consistent with all of the other (similar) factories, and secondly it will also simplify a future addition of a corresponding `NodeSVGFactory` (if that's ever deemed necessary).
2021-06-11 17:15:49 +02:00
Jonas Jenwald
d10b850916 Move most functionality in the create methods into the BaseCanvasFactory
This *slightly* reduces the amount of code duplication in the `DOMCanvasFactory.create` and `NodeCanvasFactory.create` methods.
2021-06-11 17:15:47 +02:00
Calixte Denizet
da4916e3c1 XFA - Center vertically radio without caption
- and fix intent value which is used to name the radio button group.
2021-06-11 13:24:45 +02:00
calixteman
7b4fa0a038
Merge pull request #13540 from calixteman/13536
XFA - Return html element for the different possible value
2021-06-11 13:12:26 +02:00
Calixte Denizet
367d1ad137 XFA - Return html element for the different possible value
- it aims to fix #13536.
2021-06-11 11:51:54 +02:00
calixteman
950dcc7e9f
Merge pull request #13539 from calixteman/outline
XFA - Don't show outline on focused textfields
2021-06-11 09:53:03 +02:00
Calixte Denizet
897a679723 XFA - Don't show outline on focused textfields 2021-06-11 09:25:14 +02:00
Brendan Dahl
a3b0596cf2
Merge pull request #13534 from calixteman/missing_page
XFA - Flush contents when breakBefore target is 'auto'
2021-06-10 13:17:20 -07:00
Brendan Dahl
02c03795f3
Merge pull request #13532 from calixteman/radio
XFA - Give all the available space to the caption in case of checkButton
2021-06-10 12:30:49 -07:00
Jonas Jenwald
5bcba783cf
Merge pull request #13530 from Snuffleupagus/DOMMatrix-Node
Add a `DOMMatrix` polyfill for Node.js environments (PR 13361 follow-up)
2021-06-10 21:15:05 +02:00
Jonas Jenwald
3bd24d8d5a Throw errors directly, rather than using assert, in the DOMSVGFactory
This is similar to all of the other factories in this file, since they *directly* throw errors.
2021-06-10 21:08:23 +02:00
Jonas Jenwald
26011c65f4 Add a DOMMatrix polyfill for Node.js environments (PR 13361 follow-up)
Given that `DOMMatrix` is, unsurprisingly, not supported in Node.js the `createMatrix` helper function in `src/display/pattern_helper.js` is most likely broken in Node.js environments. It will obviously try to fallback to the `DOMSVGFactory`, however that isn't intended for Node.js usage and errors will be thrown.

Rather than trying to implement a `NodeSVGFactory`, this patch takes the easier route of just adding a `DOMMatrix` polyfill using: https://www.npmjs.com/package/dommatrix
This isn't done only for simplicity, but it'll become necessary anyway since the `createMatrix` helper function is only temporary and will be removed in the future.
2021-06-10 21:08:23 +02:00
Calixte Denizet
d7d53e7c6c XFA - Flush contents when breakBefore target is 'auto'
- some page can be missed in the final document because of that (see pdf in the test case which has 4 pages (when only 3 are rendered right now)
2021-06-10 17:15:08 +02:00
Calixte Denizet
58633ab9fd XFA - Give all the available space to the caption in case of checkButton
- a checkbox or radio doesn't have to be rescaled when the container is large so give the extra space to the caption to avoid some word wrapping.
  - when the caption is on the right, then put ui on the left as first element and so remove flex:row-reverse stuff.
2021-06-10 15:30:23 +02:00
Jonas Jenwald
cbcf0f7d1e
Merge pull request #13529 from Snuffleupagus/bundle-Liberation-license
Bundle the license-file for the Liberation fonts in the builds (PR 13517 follow-up)
2021-06-10 10:30:52 +02:00
Jonas Jenwald
8f3f76f8f6 [gulpfile.js] Reduce unnecessary duplication when bundling CMap/StandardFont files
Rather than repeating the exact same code in multiple `gulp`-tasks, we can extract it into two helper functions instead.
2021-06-10 00:12:59 +02:00
Jonas Jenwald
16d9fa1bf1 Bundle the license-file for the Liberation fonts in the builds (PR 13517 follow-up)
Currently only the Foxit license-file is included, which is most likely just an oversight as far as I can tell.
Furthermore, to be able the tell the two license-files apart, the Foxit one is also renamed slightly.
2021-06-10 00:11:47 +02:00
Brendan Dahl
c4cb71b68d
Merge pull request #13528 from calixteman/inline
XFA - Handle caption with inline placement as left one
2021-06-09 13:44:31 -07:00
Calixte Denizet
3bd936709c XFA - Handle caption with inline placement as left one
- it's just a temporary workaround to unblock release in Firefox.
2021-06-09 22:13:48 +02:00
Brendan Dahl
d333af7848
Merge pull request #13527 from calixteman/bind_inf_loop
XFA - Avoid infinite loop when creating some nodes in data
2021-06-09 12:37:29 -07:00
Brendan Dahl
aa2712744d
Merge pull request #13502 from calixteman/contentarea
XFA - contentarea must be on top of the other containers in a pageArea
2021-06-09 12:36:21 -07:00
Tim van der Meij
a5233f47f2
Merge pull request #13516 from Snuffleupagus/standard-fonts-disableFontFace
Always use standard font data, with `disableFontFace` set in the API (PR 12726 follow-up)
2021-06-09 21:35:37 +02:00
Jonas Jenwald
69477bfb06 Always use standard font data, with disableFontFace set in the API (PR 12726 follow-up)
We must force-fetch standard font data, when `disableFontFace = true` is set in the API, since otherwise rendering in e.g. the viewer is still broken (same as before PR 12726 landed).

*Please note:* We still need to also load standard font data for patterns and/or some text-rendering modes, however that will require larger changes so I figured that it cannot hurt to submit *this* patch right now.
2021-06-09 21:21:02 +02:00
Tim van der Meij
2a65455c71
Merge pull request #13525 from Snuffleupagus/api-conditional-Factory
[api-minor] Re-factor the `disableFontFace` fallback value, and skip initializing factories with `useWorkerFetch` set
2021-06-09 21:15:39 +02:00
Tim van der Meij
2a7827a7c6
Merge pull request #13515 from Snuffleupagus/standardFontDataCache
Cache the "raw" standard font data in the worker-thread (PR 12726 follow-up)
2021-06-09 21:06:01 +02:00
Calixte Denizet
cddc1d869d XFA - Avoid infinite loop when creating some nodes in data 2021-06-09 19:07:59 +02:00
Jonas Jenwald
a01c599247 Cache the "raw" standard font data in the worker-thread (PR 12726 follow-up)
*This implementation is basically a copy of the pre-existing `builtInCMapCache` implementation.*

For some, badly generated, PDF documents it's possible that we'll end up having to fetch the *same* standard font data over and over (which is obviously inefficient).
While not common, it's certainly possible that a PDF document uses *custom* font names where the actual font then references one of the standard fonts; see e.g. issue 11399 for one such example.

Note that I did suggest adding worker-thread caching of standard font data in PR 12726, however it wasn't deemed necessary at the time. Now that we have a real-world example that benefit from caching, I think that we should simply implement this now.
2021-06-09 18:27:51 +02:00
calixteman
6d88d8cdaa
Merge pull request #13517 from calixteman/liberation
XFA - Add Liberation-Sans font as a substitution for some missing fonts
2021-06-09 18:19:07 +02:00
calixteman
63bde1fcfe
Merge pull request #13524 from calixteman/print_select
XFA - Don't print arrow in select
2021-06-09 16:56:39 +02:00
Calixte Denizet
34a2fa72c7 XFA - Add Liberation-Sans font as a substitution for some missing fonts
- Some js files contain scale factors for each glyph in order to rescale Liberation to have a final font with the correct width.
  - A lot of XFA have some containers where their dimensions are based on their text content, so using default font from browser can lead to an almost unreadable pdf.
2021-06-09 16:55:45 +02:00
Calixte Denizet
82784e8e60 XFA - Don't print arrow in select 2021-06-09 16:45:49 +02:00
calixteman
f2b9f0d6ea
Merge pull request #13495 from calixteman/draws
XFA - Display rectangle, line and arc
2021-06-09 16:43:51 +02:00
Calixte Denizet
fd1110adb4 Add the possibility to rescale each glyph in a font
- a lot of xfa files are using Myriad pro or Arial fonts without embedding them and some containers have some dimensions based on those font metrics. So not having the exact same font leads to a wrong display.
  - since it's pretty hard to find a replacement font with the exact same metrics, this patch gives the possibility to read glyf table, rescale each glyph and then write a new table.
  - so once PR #12726 is merged we could rescale for example Helvetica to replace Myriad Pro.
2021-06-09 16:01:13 +02:00
Jonas Jenwald
2f8e2548f2 Don't initialize CMapReaderFactory/StandardFontDataFactory when the useWorkerFetch API option is set
Given that there's no fallback on the worker-thread, it shouldn't be necessary to initialize `CMapReaderFactory`/`StandardFontDataFactory` when `useWorkerFetch = true` is set.

Slightly unrelated, but this patch also ensures that the `useSystemFonts` default value only does the `isNodeJS` check in builds where that's actually necessary.
2021-06-09 15:35:23 +02:00
Jonas Jenwald
312326991f [api-minor] Set the disableFontFace fallback value directly in the API
At this point in time, the `apiCompatibilityParams` is essentially unused with the sole exception of the `disableFontFace` handling for Node.js environments.
Given that `isNodeJS` is a constant now (originally it was a function), we can simply set the correct fallback value for `disableFontFace` directly in the API and clean-up the code a bit here.
2021-06-09 15:35:23 +02:00
Calixte Denizet
1f6345b6c2 XFA - Display rectangle, line and arc 2021-06-09 15:34:31 +02:00