forked from parallax/jsPDF
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathttfsupport.js
More file actions
20 lines (19 loc) · 974 Bytes
/
Copy pathttfsupport.js
File metadata and controls
20 lines (19 loc) · 974 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
*
* Licensed under the MIT License.
* http://opensource.org/licenses/mit-license
*/
(function (jsPDFAPI, global) {
"use strict";
jsPDFAPI.events.push([
'addFont'
,function(font) {
if (jsPDFAPI.existsFileInVFS(font.postScriptName)) {
font.metadata = global.TTFFont.open(font.postScriptName, font.fontName, jsPDFAPI.getFileFromVFS(font.postScriptName), font.encoding);
font.metadata.Unicode = font.metadata.Unicode || {encoding: {}, kerning: {}, widths: []};
} else if (font.id.slice(1) >= 14) {
console.error("Font does not exist in FileInVFS, import fonts or remove declaration doc.addFont('" + font.postScriptName + "').");
}
}
]) // end of adding event handler
})(jsPDF.API, typeof self !== "undefined" && self || typeof global !== "undefined" && global || typeof window !== "undefined" && window || (Function ("return this"))());