2
0

font_loader.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * Javascript code in this page
  4. *
  5. * Copyright 2019 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * Javascript code in this page
  21. */
  22. "use strict";
  23. Object.defineProperty(exports, "__esModule", {
  24. value: true
  25. });
  26. exports.FontLoader = exports.FontFaceObject = void 0;
  27. var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
  28. var _util = require("../shared/util");
  29. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  30. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  31. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  32. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  33. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  34. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  35. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  36. function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  37. function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  38. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  39. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  40. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  41. var BaseFontLoader =
  42. /*#__PURE__*/
  43. function () {
  44. function BaseFontLoader(_ref) {
  45. var docId = _ref.docId,
  46. onUnsupportedFeature = _ref.onUnsupportedFeature;
  47. _classCallCheck(this, BaseFontLoader);
  48. if (this.constructor === BaseFontLoader) {
  49. (0, _util.unreachable)('Cannot initialize BaseFontLoader.');
  50. }
  51. this.docId = docId;
  52. this._onUnsupportedFeature = onUnsupportedFeature;
  53. this.nativeFontFaces = [];
  54. this.styleElement = null;
  55. }
  56. _createClass(BaseFontLoader, [{
  57. key: "addNativeFontFace",
  58. value: function addNativeFontFace(nativeFontFace) {
  59. this.nativeFontFaces.push(nativeFontFace);
  60. document.fonts.add(nativeFontFace);
  61. }
  62. }, {
  63. key: "insertRule",
  64. value: function insertRule(rule) {
  65. var styleElement = this.styleElement;
  66. if (!styleElement) {
  67. styleElement = this.styleElement = document.createElement('style');
  68. styleElement.id = "PDFJS_FONT_STYLE_TAG_".concat(this.docId);
  69. document.documentElement.getElementsByTagName('head')[0].appendChild(styleElement);
  70. }
  71. var styleSheet = styleElement.sheet;
  72. styleSheet.insertRule(rule, styleSheet.cssRules.length);
  73. }
  74. }, {
  75. key: "clear",
  76. value: function clear() {
  77. this.nativeFontFaces.forEach(function (nativeFontFace) {
  78. document.fonts["delete"](nativeFontFace);
  79. });
  80. this.nativeFontFaces.length = 0;
  81. if (this.styleElement) {
  82. this.styleElement.remove();
  83. this.styleElement = null;
  84. }
  85. }
  86. }, {
  87. key: "bind",
  88. value: function () {
  89. var _bind = _asyncToGenerator(
  90. /*#__PURE__*/
  91. _regenerator["default"].mark(function _callee(font) {
  92. var _this = this;
  93. var nativeFontFace, rule;
  94. return _regenerator["default"].wrap(function _callee$(_context) {
  95. while (1) {
  96. switch (_context.prev = _context.next) {
  97. case 0:
  98. if (!(font.attached || font.missingFile)) {
  99. _context.next = 2;
  100. break;
  101. }
  102. return _context.abrupt("return", undefined);
  103. case 2:
  104. font.attached = true;
  105. if (!this.isFontLoadingAPISupported) {
  106. _context.next = 19;
  107. break;
  108. }
  109. nativeFontFace = font.createNativeFontFace();
  110. if (!nativeFontFace) {
  111. _context.next = 18;
  112. break;
  113. }
  114. this.addNativeFontFace(nativeFontFace);
  115. _context.prev = 7;
  116. _context.next = 10;
  117. return nativeFontFace.loaded;
  118. case 10:
  119. _context.next = 18;
  120. break;
  121. case 12:
  122. _context.prev = 12;
  123. _context.t0 = _context["catch"](7);
  124. this._onUnsupportedFeature({
  125. featureId: _util.UNSUPPORTED_FEATURES.font
  126. });
  127. (0, _util.warn)("Failed to load font '".concat(nativeFontFace.family, "': '").concat(_context.t0, "'."));
  128. font.disableFontFace = true;
  129. throw _context.t0;
  130. case 18:
  131. return _context.abrupt("return", undefined);
  132. case 19:
  133. rule = font.createFontFaceRule();
  134. if (!rule) {
  135. _context.next = 25;
  136. break;
  137. }
  138. this.insertRule(rule);
  139. if (!this.isSyncFontLoadingSupported) {
  140. _context.next = 24;
  141. break;
  142. }
  143. return _context.abrupt("return", undefined);
  144. case 24:
  145. return _context.abrupt("return", new Promise(function (resolve) {
  146. var request = _this._queueLoadingCallback(resolve);
  147. _this._prepareFontLoadEvent([rule], [font], request);
  148. }));
  149. case 25:
  150. return _context.abrupt("return", undefined);
  151. case 26:
  152. case "end":
  153. return _context.stop();
  154. }
  155. }
  156. }, _callee, this, [[7, 12]]);
  157. }));
  158. function bind(_x) {
  159. return _bind.apply(this, arguments);
  160. }
  161. return bind;
  162. }()
  163. }, {
  164. key: "_queueLoadingCallback",
  165. value: function _queueLoadingCallback(callback) {
  166. (0, _util.unreachable)('Abstract method `_queueLoadingCallback`.');
  167. }
  168. }, {
  169. key: "_prepareFontLoadEvent",
  170. value: function _prepareFontLoadEvent(rules, fontsToLoad, request) {
  171. (0, _util.unreachable)('Abstract method `_prepareFontLoadEvent`.');
  172. }
  173. }, {
  174. key: "isFontLoadingAPISupported",
  175. get: function get() {
  176. (0, _util.unreachable)('Abstract method `isFontLoadingAPISupported`.');
  177. }
  178. }, {
  179. key: "isSyncFontLoadingSupported",
  180. get: function get() {
  181. (0, _util.unreachable)('Abstract method `isSyncFontLoadingSupported`.');
  182. }
  183. }, {
  184. key: "_loadTestFont",
  185. get: function get() {
  186. (0, _util.unreachable)('Abstract method `_loadTestFont`.');
  187. }
  188. }]);
  189. return BaseFontLoader;
  190. }();
  191. var FontLoader;
  192. exports.FontLoader = FontLoader;
  193. {
  194. exports.FontLoader = FontLoader =
  195. /*#__PURE__*/
  196. function (_BaseFontLoader) {
  197. _inherits(GenericFontLoader, _BaseFontLoader);
  198. function GenericFontLoader(docId) {
  199. var _this2;
  200. _classCallCheck(this, GenericFontLoader);
  201. _this2 = _possibleConstructorReturn(this, _getPrototypeOf(GenericFontLoader).call(this, docId));
  202. _this2.loadingContext = {
  203. requests: [],
  204. nextRequestId: 0
  205. };
  206. _this2.loadTestFontId = 0;
  207. return _this2;
  208. }
  209. _createClass(GenericFontLoader, [{
  210. key: "_queueLoadingCallback",
  211. value: function _queueLoadingCallback(callback) {
  212. function completeRequest() {
  213. (0, _util.assert)(!request.done, 'completeRequest() cannot be called twice.');
  214. request.done = true;
  215. while (context.requests.length > 0 && context.requests[0].done) {
  216. var otherRequest = context.requests.shift();
  217. setTimeout(otherRequest.callback, 0);
  218. }
  219. }
  220. var context = this.loadingContext;
  221. var request = {
  222. id: "pdfjs-font-loading-".concat(context.nextRequestId++),
  223. done: false,
  224. complete: completeRequest,
  225. callback: callback
  226. };
  227. context.requests.push(request);
  228. return request;
  229. }
  230. }, {
  231. key: "_prepareFontLoadEvent",
  232. value: function _prepareFontLoadEvent(rules, fonts, request) {
  233. function int32(data, offset) {
  234. return data.charCodeAt(offset) << 24 | data.charCodeAt(offset + 1) << 16 | data.charCodeAt(offset + 2) << 8 | data.charCodeAt(offset + 3) & 0xff;
  235. }
  236. function spliceString(s, offset, remove, insert) {
  237. var chunk1 = s.substring(0, offset);
  238. var chunk2 = s.substring(offset + remove);
  239. return chunk1 + insert + chunk2;
  240. }
  241. var i, ii;
  242. var canvas = document.createElement('canvas');
  243. canvas.width = 1;
  244. canvas.height = 1;
  245. var ctx = canvas.getContext('2d');
  246. var called = 0;
  247. function isFontReady(name, callback) {
  248. called++;
  249. if (called > 30) {
  250. (0, _util.warn)('Load test font never loaded.');
  251. callback();
  252. return;
  253. }
  254. ctx.font = '30px ' + name;
  255. ctx.fillText('.', 0, 20);
  256. var imageData = ctx.getImageData(0, 0, 1, 1);
  257. if (imageData.data[3] > 0) {
  258. callback();
  259. return;
  260. }
  261. setTimeout(isFontReady.bind(null, name, callback));
  262. }
  263. var loadTestFontId = "lt".concat(Date.now()).concat(this.loadTestFontId++);
  264. var data = this._loadTestFont;
  265. var COMMENT_OFFSET = 976;
  266. data = spliceString(data, COMMENT_OFFSET, loadTestFontId.length, loadTestFontId);
  267. var CFF_CHECKSUM_OFFSET = 16;
  268. var XXXX_VALUE = 0x58585858;
  269. var checksum = int32(data, CFF_CHECKSUM_OFFSET);
  270. for (i = 0, ii = loadTestFontId.length - 3; i < ii; i += 4) {
  271. checksum = checksum - XXXX_VALUE + int32(loadTestFontId, i) | 0;
  272. }
  273. if (i < loadTestFontId.length) {
  274. checksum = checksum - XXXX_VALUE + int32(loadTestFontId + 'XXX', i) | 0;
  275. }
  276. data = spliceString(data, CFF_CHECKSUM_OFFSET, 4, (0, _util.string32)(checksum));
  277. var url = "url(data:font/opentype;base64,".concat(btoa(data), ");");
  278. var rule = "@font-face {font-family:\"".concat(loadTestFontId, "\";src:").concat(url, "}");
  279. this.insertRule(rule);
  280. var names = [];
  281. for (i = 0, ii = fonts.length; i < ii; i++) {
  282. names.push(fonts[i].loadedName);
  283. }
  284. names.push(loadTestFontId);
  285. var div = document.createElement('div');
  286. div.setAttribute('style', 'visibility: hidden;' + 'width: 10px; height: 10px;' + 'position: absolute; top: 0px; left: 0px;');
  287. for (i = 0, ii = names.length; i < ii; ++i) {
  288. var span = document.createElement('span');
  289. span.textContent = 'Hi';
  290. span.style.fontFamily = names[i];
  291. div.appendChild(span);
  292. }
  293. document.body.appendChild(div);
  294. isFontReady(loadTestFontId, function () {
  295. document.body.removeChild(div);
  296. request.complete();
  297. });
  298. }
  299. }, {
  300. key: "isFontLoadingAPISupported",
  301. get: function get() {
  302. var supported = typeof document !== 'undefined' && !!document.fonts;
  303. if (supported && typeof navigator !== 'undefined') {
  304. var m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);
  305. if (m && m[1] < 63) {
  306. supported = false;
  307. }
  308. }
  309. return (0, _util.shadow)(this, 'isFontLoadingAPISupported', supported);
  310. }
  311. }, {
  312. key: "isSyncFontLoadingSupported",
  313. get: function get() {
  314. var supported = false;
  315. if (typeof navigator === 'undefined') {
  316. supported = true;
  317. } else {
  318. var m = /Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);
  319. if (m && m[1] >= 14) {
  320. supported = true;
  321. }
  322. }
  323. return (0, _util.shadow)(this, 'isSyncFontLoadingSupported', supported);
  324. }
  325. }, {
  326. key: "_loadTestFont",
  327. get: function get() {
  328. var getLoadTestFont = function getLoadTestFont() {
  329. return atob('T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQA' + 'FQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAA' + 'ALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgA' + 'AAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1' + 'AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD' + '6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACM' + 'AooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4D' + 'IP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAA' + 'AAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUA' + 'AQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgAB' + 'AAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABY' + 'AAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAA' + 'AC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' + 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAA' + 'AAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQAC' + 'AQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3' + 'Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTj' + 'FQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==');
  330. };
  331. return (0, _util.shadow)(this, '_loadTestFont', getLoadTestFont());
  332. }
  333. }]);
  334. return GenericFontLoader;
  335. }(BaseFontLoader);
  336. }
  337. var IsEvalSupportedCached = {
  338. get value() {
  339. return (0, _util.shadow)(this, 'value', (0, _util.isEvalSupported)());
  340. }
  341. };
  342. var FontFaceObject =
  343. /*#__PURE__*/
  344. function () {
  345. function FontFaceObject(translatedData, _ref2) {
  346. var _ref2$isEvalSupported = _ref2.isEvalSupported,
  347. isEvalSupported = _ref2$isEvalSupported === void 0 ? true : _ref2$isEvalSupported,
  348. _ref2$disableFontFace = _ref2.disableFontFace,
  349. disableFontFace = _ref2$disableFontFace === void 0 ? false : _ref2$disableFontFace,
  350. _ref2$ignoreErrors = _ref2.ignoreErrors,
  351. ignoreErrors = _ref2$ignoreErrors === void 0 ? false : _ref2$ignoreErrors,
  352. _ref2$onUnsupportedFe = _ref2.onUnsupportedFeature,
  353. onUnsupportedFeature = _ref2$onUnsupportedFe === void 0 ? null : _ref2$onUnsupportedFe,
  354. _ref2$fontRegistry = _ref2.fontRegistry,
  355. fontRegistry = _ref2$fontRegistry === void 0 ? null : _ref2$fontRegistry;
  356. _classCallCheck(this, FontFaceObject);
  357. this.compiledGlyphs = Object.create(null);
  358. for (var i in translatedData) {
  359. this[i] = translatedData[i];
  360. }
  361. this.isEvalSupported = isEvalSupported !== false;
  362. this.disableFontFace = disableFontFace === true;
  363. this.ignoreErrors = ignoreErrors === true;
  364. this._onUnsupportedFeature = onUnsupportedFeature;
  365. this.fontRegistry = fontRegistry;
  366. }
  367. _createClass(FontFaceObject, [{
  368. key: "createNativeFontFace",
  369. value: function createNativeFontFace() {
  370. if (!this.data || this.disableFontFace) {
  371. return null;
  372. }
  373. var nativeFontFace = new FontFace(this.loadedName, this.data, {});
  374. if (this.fontRegistry) {
  375. this.fontRegistry.registerFont(this);
  376. }
  377. return nativeFontFace;
  378. }
  379. }, {
  380. key: "createFontFaceRule",
  381. value: function createFontFaceRule() {
  382. if (!this.data || this.disableFontFace) {
  383. return null;
  384. }
  385. var data = (0, _util.bytesToString)(new Uint8Array(this.data));
  386. var url = "url(data:".concat(this.mimetype, ";base64,").concat(btoa(data), ");");
  387. var rule = "@font-face {font-family:\"".concat(this.loadedName, "\";src:").concat(url, "}");
  388. if (this.fontRegistry) {
  389. this.fontRegistry.registerFont(this, url);
  390. }
  391. return rule;
  392. }
  393. }, {
  394. key: "getPathGenerator",
  395. value: function getPathGenerator(objs, character) {
  396. if (this.compiledGlyphs[character] !== undefined) {
  397. return this.compiledGlyphs[character];
  398. }
  399. var cmds, current;
  400. try {
  401. cmds = objs.get(this.loadedName + '_path_' + character);
  402. } catch (ex) {
  403. if (!this.ignoreErrors) {
  404. throw ex;
  405. }
  406. if (this._onUnsupportedFeature) {
  407. this._onUnsupportedFeature({
  408. featureId: _util.UNSUPPORTED_FEATURES.font
  409. });
  410. }
  411. (0, _util.warn)("getPathGenerator - ignoring character: \"".concat(ex, "\"."));
  412. return this.compiledGlyphs[character] = function (c, size) {};
  413. }
  414. if (this.isEvalSupported && IsEvalSupportedCached.value) {
  415. var args,
  416. js = '';
  417. for (var i = 0, ii = cmds.length; i < ii; i++) {
  418. current = cmds[i];
  419. if (current.args !== undefined) {
  420. args = current.args.join(',');
  421. } else {
  422. args = '';
  423. }
  424. js += 'c.' + current.cmd + '(' + args + ');\n';
  425. }
  426. return this.compiledGlyphs[character] = new Function('c', 'size', js);
  427. }
  428. return this.compiledGlyphs[character] = function (c, size) {
  429. for (var _i = 0, _ii = cmds.length; _i < _ii; _i++) {
  430. current = cmds[_i];
  431. if (current.cmd === 'scale') {
  432. current.args = [size, -size];
  433. }
  434. c[current.cmd].apply(c, current.args);
  435. }
  436. };
  437. }
  438. }]);
  439. return FontFaceObject;
  440. }();
  441. exports.FontFaceObject = FontFaceObject;