Commit Graph

8371 Commits

Author SHA1 Message Date
Brendan Dahl
91b27aae46 Merge pull request #6651 from yurydelendik/fix-chars-scaling
Fix chars scaling for standard fonts. (redo of #4908)
2015-12-10 14:18:48 -05:00
Tim van der Meij
7b144c02d3 Merge pull request #6739 from Snuffleupagus/PDFLinkService_getDestinationHash-prevent-resource-url-in-firefox
[Firefox] Prevent internal links from displaying "resource://pdf.js/web/" on hover, by tweaking the fallback case in `PDFLinkService_getDestinationHash`
2015-12-09 22:25:21 +01:00
Jonas Jenwald
d2c58a4ccc [Firefox] Prevent internal links from displaying "resource://pdf.js/web/" on hover, by tweaking the fallback case in PDFLinkService_getDestinationHash
An example where this is happening is http://www.nyc.gov/html/dcp/pdf/zone/map8c.pdf, check the link just below "Effective Date(s) of Rezoning:" on the right middle of the page.
2015-12-09 10:07:39 +01:00
Tim van der Meij
a96602223f Merge pull request #6736 from Snuffleupagus/adjustWidths
Use `adjustWidths` for TrueType fonts if we handle them as OpenType (issue 5027, issue 5084, issue 6556, bug 1204903)
2015-12-08 14:01:35 +01:00
Jonas Jenwald
ee0d522187 Use adjustWidths for TrueType fonts if we handle them as OpenType (issue 5027, issue 5084, issue 6556, bug 1204903)
In `Font_checkAndRepair` we can decide that a font isn't TrueType, and instead parse it as CFF. In that case it's quite possible that the `fontMatrix` will be changed, and without calling `adjustWidths` we're failing to update the glyph widths correctly.

Fixes 5027.
Fixes 5084.
Fixes 6556.
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1204903.
2015-12-08 00:49:22 +01:00
Jonas Jenwald
084bb8682f Merge pull request #6723 from yurydelendik/smask-transfer
Adds transfer function support for SMask.
2015-12-05 22:41:56 +01:00
Yury Delendik
5beb9a2e25 Merge pull request #6727 from yurydelendik/issue6726
Replaces test for #6720 to fix botio-linux slow script.
2015-12-05 13:43:51 -06:00
Yury Delendik
1bbe8f3fee Replaces test for #6720 to fix botio-linux slow script. 2015-12-05 12:33:25 -06:00
Yury Delendik
171f59c935 Merge pull request #6725 from Snuffleupagus/IdentityToUnicodeMap_charCodeOf
Fix the `charCodeOf` method in `IdentityToUnicodeMap` in order to prevent text selection from breaking
2015-12-05 06:47:05 -06:00
Jonas Jenwald
4810b7b8fc Fix the charCodeOf method in IdentityToUnicodeMap in order to prevent text selection from breaking
After PR 6590, `font.spaceWidth` is now called in more cases than before (in `PartialEvaluator_getTextContent`), which exposed an underlying issue with `IdentityToUnicodeMap_charCodeOf` throwing an error.
This breaks text-selection in some PDF files found in the wild, hence this patch replaces the `error` with an actual function instead (modelled after `IdentityCMap_charCodeOf`).
2015-12-05 13:15:55 +01:00
Yury Delendik
15c9969abe Adds transfer function support for SMask. 2015-12-04 12:52:45 -06:00
Jonas Jenwald
e2aca385c6 Merge pull request #6720 from yurydelendik/smask-state
Fixes canvas state after smask group ends.
2015-12-03 22:19:37 +01:00
Yury Delendik
d4843ebf6d Fixes canvas state after smask group ends. 2015-12-03 14:34:12 -06:00
Tim van der Meij
e180d01255 Merge pull request #6715 from brendandahl/remove-bad-glyph-ids
Remove glyph id's outside the range of valid glyphs.
2015-12-03 20:59:03 +01:00
Brendan Dahl
87762afec4 Remove glyph id's outside the range of valid glyphs.
OTS does not like invalid glyph ids in a camp table.
2015-12-03 11:53:06 -08:00
Yury Delendik
e93512f1eb Merge pull request #6712 from timvandermeij/text-layer-position
Use default line height for the text layer
2015-12-02 16:05:50 -06:00
Tim van der Meij
a2cac8fa71 Use default line height for the text layer
Fixes #6614.
2015-12-02 23:00:12 +01:00
Brendan Dahl
376788f2b2 Merge pull request #6698 from yurydelendik/rm-UnsupportedManager
[api-minor] Replaces UnsupportedManager with callback.
2015-12-02 10:57:44 -08:00
Jonas Jenwald
5f56a20b34 Merge pull request #6701 from timvandermeij/pdf-manager-inherit
Make use of `Util.inherit` in `src/core/pdf_manager.js`
2015-12-01 19:53:43 +01:00
Yury Delendik
4a82f2f5fd Merge pull request #6695 from Snuffleupagus/issue-6692
Ensure that `Lexer_getName` does not fail if a `Name` contains in invalid usage of the NUMBER SIGN (#) (issue 6692)
2015-12-01 10:25:57 -06:00
Jonas Jenwald
361fa83f3b Merge pull request #6699 from timvandermeij/annotation-refactoring
Improve code structure of the annotation code
2015-12-01 13:31:18 +01:00
Yury Delendik
c9cb6a3025 Replaces UnsupportedManager with callback. 2015-11-30 14:42:47 -06:00
Yury Delendik
84a47f8e53 Merge pull request #6700 from Snuffleupagus/mozcentral-remove-FontLoader-bindDOM
Replace `font.bindDOM()` with `font.createFontFaceRule()` in the `FontLoader` for MOZCENTRAL specific code (PR 6571 follow-up)
2015-11-28 21:33:38 -06:00
Tim van der Meij
0c41866433 Make use of Util.inherit in src/core/pdf_manager.js
While we are here, fix some incorrect function names.
2015-11-29 00:58:19 +01:00
Tim van der Meij
8b79becad6 Improve code structure of the annotation code
This patch improves the code structure of the annotation code.

- Create the annotation border style object in the `setBorderStyle` method instead of in the constructor. The behavior is the same as the `setBorderStyle` method is always called, thus a border style object is still always available.
- Put all data object manipulation lines in one block in the constructor. This improves readability and maintainability as it is more visible which properties are exposed.
- Simplify `appendToOperatorList` by removing the promise capability and removing an unused parameter.
- Remove some unnecessary newlines/spaces.
2015-11-29 00:04:21 +01:00
Jonas Jenwald
e8e79029b1 Replace font.bindDOM() with font.createFontFaceRule() in the FontLoader for MOZCENTRAL specific code (PR 6571 follow-up)
This is a follow-up to PR 6571, and fixes font loading in the `MOZCENTRAL` version.

Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1228603#c2.
2015-11-28 21:33:07 +01:00
Jonas Jenwald
995e1a45b8 Ensure that Lexer_getName does not fail if a Name contains in invalid usage of the NUMBER SIGN (#) (issue 6692)
*This is a regression from PR 3424.*

The PDF file in the referenced issue is using `Type3` fonts. In one of those, the `/CharProcs` dictionary contains an entry with the name `/#`. Before the changes to `Lexer_getName` in PR 3424, we were allowing certain invalid `Name` patterns containing the NUMBER SIGN (#).

It's unfortunate that this has been broken for close to two and a half years before the bug surfaced, but it should at least indicate that this is not a widespread issue.

Fixes 6692.
2015-11-28 11:59:09 +01:00
Tim van der Meij
a8279f7d60 Merge pull request #6697 from yurydelendik/type3loaderror
Set error font for Type3 if its loading failed.
2015-11-27 23:39:24 +01:00
Yury Delendik
e4e69e2f05 Set error font for Type3 if its loading failed. 2015-11-27 13:05:51 -06:00
Brendan Dahl
83dbdc1e09 Merge pull request #6693 from yurydelendik/workerwait
Worker shall wait for MessageHandler to be created at api side.
2015-11-25 16:51:01 -08:00
Yury Delendik
8dff301ce1 Worker shall wait for MessageHandler to be created at api side. 2015-11-25 18:21:23 -06:00
Tim van der Meij
5fcd779812 Merge pull request #6209 from Rob--W/parallel-rendering
Fix font rendering when rendering multiple PDFs in parallel
2015-11-25 22:51:15 +01:00
Yury Delendik
0819d71a02 Merge pull request #6681 from Snuffleupagus/issue-6612
[api-minor] Add a parameter to `PDFPageProxy_getTextContent` that enables replacing of all whitespace with standard spaces in the textLayer (issue 6612)
2015-11-25 10:56:08 -06:00
Jonas Jenwald
6dfe53b976 [api-minor] Add a parameter to PDFPageProxy_getTextContent that enables replacing of all whitespace with standard spaces in the textLayer (issue 6612)
This patch goes a bit further than issue 6612 requires, and replaces all kinds of whitespace with standard spaces.

When testing this locally, it actually seemed to slightly improve two existing test-cases (`tracemonkey-text` and `taro-text`).

Fixes 6612.
2015-11-25 17:28:40 +01:00
Rob Wu
07f2a43943 Add tests for parallel rendering 2015-11-25 17:22:51 +01:00
Tim van der Meij
c2dfe9e9a9 Merge pull request #6571 from yurydelendik/worker
[api-minor] Allows a worker to handle multiple documents.
2015-11-24 22:42:44 +01:00
Tim van der Meij
c280fb516d Merge pull request #6679 from Snuffleupagus/better-openExternalLinksInNewWindow-deprecation-comments
Improve the comment and deprecation warning for `PDFJS.openExternalLinksInNewWindow`
2015-11-24 22:38:43 +01:00
Yury Delendik
06c1904675 Refactors FontLoader to group fonts per document. 2015-11-24 13:27:22 -06:00
Yury Delendik
09772e1e15 Creates PDFWorker, separates fetchDocument from transport. 2015-11-24 13:27:22 -06:00
Yury Delendik
acdd49f480 Adds peer communication between MessageHandlers. 2015-11-24 12:16:58 -06:00
Yury Delendik
4b243cdd89 Merge pull request #6675 from Snuffleupagus/getAnnotations-intent
[api-minor] Let `getAnnotations` fetch all annotations by default, unless an intent is specified
2015-11-24 12:11:51 -06:00
Tim van der Meij
dcd28126bf Merge pull request #6677 from Snuffleupagus/restore-data-annotationFlags
Restore the `data.annotationFlags` parameter for annotations (PR 6672 follow-up)
2015-11-23 14:24:07 +01:00
Jonas Jenwald
27c8e1e22f Improve the comment and deprecation warning for PDFJS.openExternalLinksInNewWindow
This patch:
 - Updates the JSDoc comment in `api.js`, to more clearly point out that `PDFJS.openExternalLinksInNewWindow` is deprecated, and explains what to use instead.

 - Changes the `warn`, in `isExternalLinkTargetSet()`, to use the new `deprecated` function instead. Also updates the message with more detailed information about what to use instead.

 - Changes the pre-processor tag to ensure the deprecation warning is seen in all build types where it could possibly matter (in case people are using `PDFJS.openExternalLinksInNewWindow` in e.g. custom-built extensions).

These changes were prompted by seeing http://stackoverflow.com/questions/33813373/pdf-js-how-to-open-hyperlinks-in-a-new-tab-window, since it seems to me that the current comments/warnings might not be worded well enough.
2015-11-23 13:12:23 +01:00
Jonas Jenwald
a2a5d36d5b Restore the data.annotationFlags parameter for annotations (PR 6672 follow-up) 2015-11-23 10:17:11 +01:00
Jonas Jenwald
b05652ca97 [api-minor] Let getAnnotations fetch all annotations by default, unless an intent is specified
Currently `getAnnotations` will *only* fetch annotations that are either `viewable` or `printable`. This is "hidden" inside the `core.js` file, meaning that API consumers might be confused as to why they are not recieving *all* the annotations present for a page.

I thus think that the API should, by default, return *all* available annotations unless specifically told otherwise. In e.g. the default viewer, we obviously only want to display annotations that are `viewable`, hence this patch adds an `intent` parameter to `getAnnotations` that makes it possible to decide if only `viewable` or `printable` annotations should be fetched.
2015-11-22 15:51:37 +01:00
Tim van der Meij
aa75c4fe4e Merge pull request #6676 from Archaeopteryx/documentColorsQuoteEscaping
document_colors_disabled shouldn't escape quotes (compare-locales warning)
2015-11-22 15:13:13 +01:00
Yury Delendik
0029000c9f Merge pull request #6671 from Snuffleupagus/make-stripCommentHeaders-less-gready
Make `stripCommentHeaders` less greedy, to ensure that it doesn't eat 'use strict' directive at the top of files (PR 6627 follow-up)
2015-11-22 07:24:20 -06:00
Jonas Jenwald
c310a3790e Make stripCommentHeaders less greedy, to ensure that it doesn't eat 'use strict' directive at the top of files (PR 6627 follow-up)
While browsing through the latest PDF.js update on mozilla-central, see https://hg.mozilla.org/integration/fx-team/rev/aef06cd725fc, I noticed that the `'use strict';` directives were missing at the top of a number of files.
This is fallout from the changes made in `make.js` in PR 6627, since `stripCommentHeaders` previously relied on the existence of the mode-lines.

I'm assuming that we do want *all* of the code (e.g. the viewer too) to execute in strict mode, hence this patch tweaks `stripCommentHeaders` to make it less greedy.
2015-11-22 14:17:37 +01:00
Jonas Jenwald
9de056f242 Update l10n files 2015-11-22 12:06:06 +01:00
Jonas Jenwald
97cb7ff2e6 Merge pull request #6672 from timvandermeij/annotation-flags
Refactor annotation flags code
2015-11-22 10:52:18 +01:00