Move the disableFontFace option from the global PDFJS object and into getDocument instead

This commit is contained in:
Jonas Jenwald 2018-02-17 21:57:20 +01:00
parent f3900c4e57
commit c7c583583b
5 changed files with 19 additions and 17 deletions

View file

@ -160,6 +160,10 @@ function setPDFNetworkStreamFactory(pdfNetworkStreamFactory) {
* @property {boolean} isEvalSupported - (optional) Determines if we can eval
* strings as JS. Primarily used to improve performance of font rendering,
* and when parsing PDF functions. The default value is `true`.
* @property {boolean} disableFontFace - (optional) By default fonts are
* converted to OpenType fonts and loaded via font face rules. If disabled,
* fonts will be rendered using a built-in font renderer that constructs the
* glyphs with primitive path commands. The default value is `false`.
*/
/**
@ -258,6 +262,9 @@ function getDocument(src) {
if (typeof params.isEvalSupported !== 'boolean') {
params.isEvalSupported = true;
}
if (typeof params.disableFontFace !== 'boolean') {
params.disableFontFace = false;
}
// Set the main-thread verbosity level.
setVerbosityLevel(params.verbosity);
@ -344,7 +351,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
length: source.length,
},
maxImageSize: source.maxImageSize,
disableFontFace: getDefaultSetting('disableFontFace'),
disableFontFace: source.disableFontFace,
disableCreateObjectURL: getDefaultSetting('disableCreateObjectURL'),
postMessageTransfers: worker.postMessageTransfers,
docBaseUrl: source.docBaseUrl,
@ -1831,7 +1838,7 @@ var WorkerTransport = (function WorkerTransportClosure() {
}
var font = new FontFaceObject(exportedData, {
isEvalSupported: params.isEvalSupported,
disableFontFace: getDefaultSetting('disableFontFace'),
disableFontFace: params.disableFontFace,
fontRegistry,
});
var fontReady = (fontObjs) => {