mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
[PATCH] Add fallback for font loading when eval disabled
In some cases, such as in use with a CSP header, constructing a function with a string of javascript is not allowed. However, compiling the various commands that need to be done on the canvas element is faster than interpreting them. This patch changes the font renderer to instead emit commands that are compiled by the font loader. If, during compilation, we receive an EvalError, we instead interpret them.
This commit is contained in:
parent
18e1a14e65
commit
341c5e9d1f
3 changed files with 83 additions and 34 deletions
|
@ -177,6 +177,14 @@ PDFJS.openExternalLinksInNewWindow = (
|
|||
PDFJS.openExternalLinksInNewWindow === undefined ?
|
||||
false : PDFJS.openExternalLinksInNewWindow);
|
||||
|
||||
/**
|
||||
* Determines if we can eval strings as JS. Primarily used to improve
|
||||
* performance for font rendering.
|
||||
* @var {boolean}
|
||||
*/
|
||||
PDFJS.isEvalSupported = (PDFJS.isEvalSupported === undefined ?
|
||||
true : PDFJS.isEvalSupported);
|
||||
|
||||
/**
|
||||
* Document initialization / loading parameters object.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue