1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

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) => {

View file

@ -342,8 +342,6 @@ function getDefaultSetting(id) {
return globalSettings ? globalSettings.disableStream : false;
case 'disableRange':
return globalSettings ? globalSettings.disableRange : false;
case 'disableFontFace':
return globalSettings ? globalSettings.disableFontFace : false;
case 'disableCreateObjectURL':
return globalSettings ? globalSettings.disableCreateObjectURL : false;
default:

View file

@ -65,15 +65,6 @@ PDFJS.Util = Util;
PDFJS.PageViewport = PageViewport;
PDFJS.createPromiseCapability = createPromiseCapability;
/**
* By default fonts are converted to OpenType fonts and loaded via font face
* rules. If disabled, the font will be rendered using a built in font
* renderer that constructs the glyphs with primitive path commands.
* @var {boolean}
*/
PDFJS.disableFontFace = (PDFJS.disableFontFace === undefined ?
false : PDFJS.disableFontFace);
/**
* Disable range request loading of PDF files. When enabled and if the server
* supports partial content requests then the PDF will be fetched in chunks.