Commit Graph

14223 Commits

Author SHA1 Message Date
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
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
Calixte Denizet
1486608f32 XFA - contentarea must be on top of the other containers in a pageArea 2021-06-09 15:29:29 +02:00
calixteman
b4c96f3bc8
Merge pull request #13521 from Snuffleupagus/issue-13518
[XFA] Use `align-items: flex-start;` to improve browser compatibility (issue 13518)
2021-06-09 15:28:07 +02:00
Jonas Jenwald
f716de7a2d [XFA] Use align-items: flex-start; to improve browser compatibility (issue 13518)
https://developer.mozilla.org/en-US/docs/Web/CSS/align-items#browser_compatibility
2021-06-09 08:20:12 +02:00
Jonas Jenwald
ae531e5e23
Merge pull request #13514 from Snuffleupagus/base_factory
[api-minor] Fetch binary CMap data in the worker-thread, when `useWorkerFetch` is set
2021-06-08 22:43:16 +02:00
Jonas Jenwald
d995f90183 Fetch binary CMap data in the worker-thread, when useWorkerFetch is set
This patch uses the new option added in PR 12726 to *also* allow fetching binary CMap data directly in the worker-thread in browsers.
Given that these changes remove the need to transfer data between threads for the default (browser) use-case, we can also revert the changes in PR 11118 since that simplifies the overall implementation.
2021-06-08 21:51:07 +02:00
Jonas Jenwald
248113bbf0 Move BaseCanvasFactory, BaseCMapReaderFactory, and BaseStandardFontDataFactory to their own file
Given that these factories are being used in *different* files, for Browser respectively Node.js implementations, it seems reasonable to move them into their own file instead.
2021-06-08 21:48:49 +02:00
Brendan Dahl
2a6111044e
Merge pull request #13479 from calixteman/margin
XFA - Fix layout issues (again)
2021-06-08 12:06:40 -07:00
Calixte Denizet
cfa727474e XFA - Fix layout issues (again)
- some elements weren't displayed because their rotation angle was not taken into account;
  - fix box model (XFA concept):
    - remove use of outline;
    - position correctly border which isn't part of box dimensions;
    - fix margins issues (see issue #13474).
  - move border on button instead of having it on wrapping div;
2021-06-08 17:42:53 +02:00
Jonas Jenwald
e8fe0711ee
Merge pull request #13506 from calixteman/xfa_reftest
XFA - Add support for reftests
2021-06-08 14:47:49 +02:00
Jonas Jenwald
d639a27557
Merge pull request #13513 from mozilla/dependabot/npm_and_yarn/trim-newlines-3.0.1
Bump trim-newlines from 3.0.0 to 3.0.1
2021-06-08 10:45:30 +02:00
Calixte Denizet
63caa101f8 XFA - Add support for reftests 2021-06-08 10:37:26 +02:00
dependabot[bot]
0fad999fc9
Bump trim-newlines from 3.0.0 to 3.0.1
Bumps [trim-newlines](https://github.com/sindresorhus/trim-newlines) from 3.0.0 to 3.0.1.
- [Release notes](https://github.com/sindresorhus/trim-newlines/releases)
- [Commits](https://github.com/sindresorhus/trim-newlines/commits)

---
updated-dependencies:
- dependency-name: trim-newlines
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-08 08:11:20 +00:00
Jonas Jenwald
e7dc822e74
Merge pull request #12726 from brendandahl/standard-fonts
[api-minor] Include and use the 14 standard font files.
2021-06-08 10:09:40 +02:00
Brendan Dahl
4c1dd47e65 Include and use the 14 standard fonts files. 2021-06-07 11:10:11 -07:00
calixteman
8b4acb4e36
Merge pull request #13501 from calixteman/13500
XFA - CDATA can be xml so parse it when required
2021-06-07 11:27:49 +02:00
Jonas Jenwald
e0abf87bc3
Merge pull request #13505 from Snuffleupagus/createMatrix-DOMSVGFactory
Use the `DOMSVGFactory`, rather than manually creating the SVG-element, in `createMatrix` (PR 13361 follow-up)
2021-06-07 11:16:07 +02:00
Calixte Denizet
5dc7f4ade8 XFA - CDATA can be xml so parse it when required 2021-06-07 10:38:39 +02:00
calixteman
1775d5eeb7
Merge pull request #13503 from calixteman/nodata
XFA - Don't bind a form node with an empty value when the data node doesn't exist
2021-06-07 10:37:14 +02:00
Jonas Jenwald
9e632ee323 Use the DOMSVGFactory, rather than manually creating the SVG-element, in createMatrix (PR 13361 follow-up)
Generally, in the `src/display/` folder, we utilize `DOMSVGFactory` rather than manually creating an SVG-element; hence let's do the same thing in `src/display/pattern_helper.js` as well.
2021-06-07 10:15:20 +02:00
Calixte Denizet
112645ea3d XFA - Don't bind a form node with an empty value when the data node doesn't exist 2021-06-06 17:59:01 +02:00
Tim van der Meij
2b63d97b9d
Merge pull request #13461 from Snuffleupagus/issue-6605
Improve text-selection for Type3 fonts with empty /FontBBox-entries (issue 6605)
2021-06-06 14:37:52 +02:00
Tim van der Meij
7d834396e4
Merge pull request #13498 from Snuffleupagus/issue-12996
Normalize the coordinates used in `SVGGraphics._makeTilingPattern` (issue 12996)
2021-06-06 14:31:35 +02:00
Jonas Jenwald
04ab4bd406 Normalize the coordinates used in SVGGraphics._makeTilingPattern (issue 12996)
While this prevents the error which is currently thrown by the `assert` in the `DOMSVGFactory.create` method, the pattern still doesn't actually render (visibly). However, in the interest of getting rid of some open issues, this patch should make (some) sense and there's already other issues about patterns in the SVG-backend,

Given that, as clearly [outlined in the FAQ](https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#backends), the SVG-backend is *not* officially supported and that there's currently no development of it; this is probably the most that is reasonable to do here.
2021-06-05 09:15:23 +02:00
Jonas Jenwald
1dd01b8506
Merge pull request #13494 from brendandahl/stepper-show-text
Add more info for showText operator in stepper.
2021-06-05 08:37:11 +02:00
Jonas Jenwald
eefc94ceb7 Ensure that we fully load Type3 fonts in PartialEvaluator.getTextContent
This is necessary now, since with the previous patch the /FontBBox potentially depends on the contents of the /CharProcs-streams.
Note that if `getOperatorList` is called *before* `getTextContent`, this patch doesn't matter since the font is already fully loaded/parsed. However, for e.g. the `text` test-cases this is necessary to ensure correct reference images.
2021-06-05 08:09:29 +02:00
Jonas Jenwald
20770cb06a Improve text-selection for Type3 fonts with empty /FontBBox-entries (issue 6605)
For Type3 fonts where the /CharProcs-streams of the individual glyph starts with a `d1` operator, we can use that to build a fallback bounding box for the font and thus improve text-selection in some cases.
2021-06-05 08:09:29 +02:00
Brendan Dahl
6255c2a8f3
Merge pull request #13376 from calixteman/6132
Replace command with not enough args by an endchar in CFF font
2021-06-04 14:00:51 -07:00
Brendan Dahl
17f1857556 Add more info for showText operator in stepper.
Adds a table that shows original char code, font char code, and unicode.
2021-06-04 13:58:05 -07:00
Tim van der Meij
eba6db9dc6
Merge pull request #13497 from Snuffleupagus/HTMLResult-lazy
Initialize `HTMLResult.{FAILURE, EMPTY}` lazily
2021-06-04 21:24:49 +02:00
Tim van der Meij
ce1ed60d11
Merge pull request #13490 from Snuffleupagus/issue-10362
Miscellaneous improvements for `gulpfile.js` (issue 10362)
2021-06-04 21:13:06 +02:00