Commit Graph

14259 Commits

Author SHA1 Message Date
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
Jonas Jenwald
75113e4517 Initialize HTMLResult.{FAILURE, EMPTY} lazily
While these objects aren't exactly that big and/or complex, they are nonetheless *only* necessary for XFA documents.
However, currently these objects are initialized *eagerly* for all PDF documents. By using the same pattern as elsewhere in the code-base, it's very easy to make these lazily initialized; so let's just do that instead :-)
2021-06-04 21:01:14 +02:00
Tim van der Meij
ed0990ab6f
Merge pull request #13492 from MMeent/patch-1
Add normalization for Hyphen -> Hyphen-minus
2021-06-04 21:00:02 +02:00
calixteman
e0676ec298
Merge pull request #13473 from calixteman/usehref
XFA - Implement usehref support
2021-06-04 20:13:22 +02:00
Brendan Dahl
425e58431a
Merge pull request #13482 from Snuffleupagus/scrollMatches-fix
Fix scrolling of search results in documents with marked content (bug 1714183)
2021-06-04 10:16:05 -07:00
Jonas Jenwald
66a5671847 Remove gulp makefile, since it's broken and unused
Looking at the history of the code, this `gulp` task was *accidentally* broken in the Gulp 4 upgrade in PR 10266 (all the way back in 2018).
Given that no one has either noticed and/or complained about this since, it's safe to assume that it's completely unused, hence why I suggest that we just remove this `gulp` task (rather than fixing it).
2021-06-04 17:55:35 +02:00
MMeent
3631121841
Add normalization for Hyphen -> Hyphen-minus
Previously these two characters were not searchable interchangably, even when Hyphen-Minus is being changed to Hyphen in some text to PDF pipelines.
2021-06-04 15:54:52 +02:00
Calixte Denizet
11573ddd16 XFA - Implement usehref support
- attribute 'use' was already implemented but not usehref
  - in general, usehref should make reference to current document
  - add support for SOM expressions in use and usehref to search a node.
  - get prototype for all nodes if any.
2021-06-04 14:57:05 +02:00
Jonas Jenwald
3b502f7e07
Merge pull request #13478 from brendandahl/find-regression
Fix find highlighting regression from #13306.
2021-06-04 14:09:35 +02:00
Jonas Jenwald
6c249f8e21 Clean-up gulpfile.js by removing most "-pre" tasks (issue 10362)
Most of the `gulp` tasks with a "-pre" suffix, especially those related to the main build-targets, are no longer needed and can simply be inlined in their corresponding tasks. This is likely a left-over from older Gulp-versions, but currently it only adds unnecessary indirection.

Furthermore, a number of the `gulp` tasks which are only used *internally* are converted to standard functions instead. This prevents them from being exposed "globally" and e.g. listed by `gulp default`.
2021-06-04 13:28:58 +02:00
Jonas Jenwald
92434b1eb4 Replace anonymous functions in gulpfile.js with named functions (issue 10362)
This replaces all of the `Starting '<anonymous>'...` lines in the output, when running various `gulp` tasks, with more meaningful function names.
2021-06-04 13:09:03 +02:00
Jonas Jenwald
ed9d5c4ec2
Merge pull request #13489 from Snuffleupagus/hasEOL-TextItem-docs
Add `hasEOL` to the `TextItem` typedef in the API (PR 13257 follow-up)
2021-06-04 11:16:43 +02:00
Jonas Jenwald
4b1c4d2bd9 Add hasEOL to the TextItem typedef in the API (PR 13257 follow-up) 2021-06-04 10:22:43 +02:00
Jonas Jenwald
29e6930bb6 Fix scrolling of search results in documents with marked content (bug 1714183)
This regressed in PR 13171, since the `span`s with the marked content identifiers interfere with scrolling of search results.
2021-06-03 12:41:51 +02:00
Jonas Jenwald
2a35b39c46 Remove the unused dataset checks from the scrollIntoView helper function
This code was added in PR 3968, apparently in order to fix scrolling of search results in HiDPI-mode.
However, after PR 4570 nothing is setting these `dataset`-properties any more and this is thus dead code which should be removed. (If that change had broken scrolling of search results in HiDPI-mode, you'd really expect that it'd been reported and fixed a long time ago.)
2021-06-03 11:43:38 +02:00