FontData.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. "use strict";
  2. var __extends = (this && this.__extends) || (function () {
  3. var extendStatics = function (d, b) {
  4. extendStatics = Object.setPrototypeOf ||
  5. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  7. return extendStatics(d, b);
  8. };
  9. return function (d, b) {
  10. if (typeof b !== "function" && b !== null)
  11. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  12. extendStatics(d, b);
  13. function __() { this.constructor = d; }
  14. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15. };
  16. })();
  17. var __assign = (this && this.__assign) || function () {
  18. __assign = Object.assign || function(t) {
  19. for (var s, i = 1, n = arguments.length; i < n; i++) {
  20. s = arguments[i];
  21. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  22. t[p] = s[p];
  23. }
  24. return t;
  25. };
  26. return __assign.apply(this, arguments);
  27. };
  28. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  29. if (k2 === undefined) k2 = k;
  30. var desc = Object.getOwnPropertyDescriptor(m, k);
  31. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  32. desc = { enumerable: true, get: function() { return m[k]; } };
  33. }
  34. Object.defineProperty(o, k2, desc);
  35. }) : (function(o, m, k, k2) {
  36. if (k2 === undefined) k2 = k;
  37. o[k2] = m[k];
  38. }));
  39. var __exportStar = (this && this.__exportStar) || function(m, exports) {
  40. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
  41. };
  42. var __values = (this && this.__values) || function(o) {
  43. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  44. if (m) return m.call(o);
  45. if (o && typeof o.length === "number") return {
  46. next: function () {
  47. if (o && i >= o.length) o = void 0;
  48. return { value: o && o[i++], done: !o };
  49. }
  50. };
  51. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  52. };
  53. Object.defineProperty(exports, "__esModule", { value: true });
  54. exports.AddPaths = exports.SVGFontData = void 0;
  55. var FontData_js_1 = require("../common/FontData.js");
  56. __exportStar(require("../common/FontData.js"), exports);
  57. var SVGFontData = (function (_super) {
  58. __extends(SVGFontData, _super);
  59. function SVGFontData() {
  60. return _super !== null && _super.apply(this, arguments) || this;
  61. }
  62. SVGFontData.charOptions = function (font, n) {
  63. return _super.charOptions.call(this, font, n);
  64. };
  65. SVGFontData.OPTIONS = __assign(__assign({}, FontData_js_1.FontData.OPTIONS), { dynamicPrefix: './output/svg/fonts' });
  66. SVGFontData.JAX = 'SVG';
  67. return SVGFontData;
  68. }(FontData_js_1.FontData));
  69. exports.SVGFontData = SVGFontData;
  70. function AddPaths(font, paths, content) {
  71. var e_1, _a, e_2, _b;
  72. try {
  73. for (var _c = __values(Object.keys(paths)), _d = _c.next(); !_d.done; _d = _c.next()) {
  74. var c = _d.value;
  75. var n = parseInt(c);
  76. SVGFontData.charOptions(font, n).p = paths[n];
  77. }
  78. }
  79. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  80. finally {
  81. try {
  82. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  83. }
  84. finally { if (e_1) throw e_1.error; }
  85. }
  86. try {
  87. for (var _e = __values(Object.keys(content)), _f = _e.next(); !_f.done; _f = _e.next()) {
  88. var c = _f.value;
  89. var n = parseInt(c);
  90. SVGFontData.charOptions(font, n).c = content[n];
  91. }
  92. }
  93. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  94. finally {
  95. try {
  96. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  97. }
  98. finally { if (e_2) throw e_2.error; }
  99. }
  100. return font;
  101. }
  102. exports.AddPaths = AddPaths;
  103. //# sourceMappingURL=FontData.js.map