makerjs 0.18.2 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,7 +39,7 @@ and limitations under the License.
39
39
  * author: Dan Marshall / Microsoft Corporation
40
40
  * maintainers: Dan Marshall <danmar@microsoft.com>
41
41
  * homepage: https://maker.js.org
42
- * version: 0.18.2
42
+ * version: 0.19.1
43
43
  *
44
44
  * browserify:
45
45
  * license: MIT (http://opensource.org/licenses/MIT)
@@ -448,6 +448,7 @@ return kdbush;
448
448
  })));
449
449
 
450
450
  },{}],"makerjs":[function(require,module,exports){
451
+ (function (global){(function (){
451
452
  /**
452
453
  * Root module for Maker.js.
453
454
  *
@@ -476,29 +477,35 @@ var MakerJs;
476
477
  * @private
477
478
  */
478
479
  var EPSILON = Number.EPSILON || Math.pow(2, -52);
479
- /**
480
- * @private
481
- */
482
- function tryEval(name) {
483
- try {
484
- var value = eval(name);
485
- return value;
486
- }
487
- catch (e) { }
488
- return;
489
- }
490
480
  /**
491
481
  * @private
492
482
  */
493
483
  function detectEnvironment() {
494
- if (tryEval('WorkerGlobalScope') && tryEval('self')) {
484
+ // Use a function to get the global object to avoid TypeScript checking specific globals
485
+ var getGlobal = function () {
486
+ // In browsers and workers, 'self' refers to the global scope
487
+ if (typeof self !== 'undefined') {
488
+ return self;
489
+ }
490
+ // In Node.js, 'global' refers to the global scope
491
+ if (typeof global !== 'undefined') {
492
+ return global;
493
+ }
494
+ // Fallback for older environments
495
+ return this || {};
496
+ };
497
+ var globalObj = getGlobal();
498
+ // Check for Web Worker environment
499
+ // Workers have 'self' and 'WorkerGlobalScope' but not 'window'
500
+ if (globalObj['self'] && globalObj['WorkerGlobalScope'] && !globalObj['window']) {
495
501
  return MakerJs.environmentTypes.WebWorker;
496
502
  }
497
- if (tryEval('window') && tryEval('document')) {
503
+ // Check for Browser UI environment
504
+ if (globalObj['window'] && globalObj['document']) {
498
505
  return MakerJs.environmentTypes.BrowserUI;
499
506
  }
500
507
  //put node last since packagers usually add shims for it
501
- if (tryEval('global') && tryEval('process')) {
508
+ if (globalObj['global'] && globalObj['process']) {
502
509
  return MakerJs.environmentTypes.NodeJs;
503
510
  }
504
511
  return MakerJs.environmentTypes.Unknown;
@@ -7585,20 +7592,29 @@ var MakerJs;
7585
7592
  /**
7586
7593
  * Convert a chain to SVG path data.
7587
7594
  *
7588
- * @param chain Chain to convert.
7595
+ * @param c Chain to convert.
7589
7596
  * @param offset IPoint relative offset point.
7590
7597
  * @param accuracy Optional accuracy of SVG path data.
7598
+ * @param clockwise Optional flag to specify desired winding direction for nonzero fill rule.
7591
7599
  * @returns String of SVG path data.
7592
7600
  */
7593
- function chainToSVGPathData(chain, offset, accuracy) {
7601
+ function chainToSVGPathData(c, offset, accuracy, clockwise) {
7594
7602
  function offsetPoint(p) {
7595
7603
  return MakerJs.point.add(p, offset);
7596
7604
  }
7597
- var first = chain.links[0];
7605
+ // If clockwise direction is specified, check if chain needs to be reversed
7606
+ if (clockwise !== undefined) {
7607
+ var isClockwise = MakerJs.measure.isChainClockwise(c);
7608
+ if (isClockwise !== null && isClockwise !== clockwise) {
7609
+ c = MakerJs.cloneObject(c);
7610
+ MakerJs.chain.reverse(c);
7611
+ }
7612
+ }
7613
+ var first = c.links[0];
7598
7614
  var firstPoint = offsetPoint(svgCoords(first.endPoints[first.reversed ? 1 : 0]));
7599
7615
  var d = ['M', MakerJs.round(firstPoint[0], accuracy), MakerJs.round(firstPoint[1], accuracy)];
7600
- for (var i = 0; i < chain.links.length; i++) {
7601
- var link = chain.links[i];
7616
+ for (var i = 0; i < c.links.length; i++) {
7617
+ var link = c.links[i];
7602
7618
  var pathContext = link.walkedPath.pathContext;
7603
7619
  var fn = chainLinkToPathDataMap[pathContext.type];
7604
7620
  if (fn) {
@@ -7610,7 +7626,7 @@ var MakerJs;
7610
7626
  fn(fixedPath, offsetPoint(svgCoords(link.endPoints[link.reversed ? 0 : 1])), link.reversed, d, accuracy);
7611
7627
  }
7612
7628
  }
7613
- if (chain.endless) {
7629
+ if (c.endless) {
7614
7630
  d.push('Z');
7615
7631
  }
7616
7632
  return d.join(' ');
@@ -7686,16 +7702,16 @@ var MakerJs;
7686
7702
  }
7687
7703
  pathDataByLayer[layer] = [];
7688
7704
  function doChains(cs, clockwise) {
7689
- cs.forEach(function (chain) {
7690
- if (chain.links.length > 1) {
7691
- var pathData = chainToSVGPathData(chain, offset, accuracy);
7705
+ cs.forEach(function (c) {
7706
+ if (c.links.length > 1) {
7707
+ var pathData = chainToSVGPathData(c, offset, accuracy, clockwise);
7692
7708
  pathDataByLayer[layer].push(pathData);
7693
7709
  }
7694
7710
  else {
7695
- single(chain.links[0].walkedPath, clockwise);
7711
+ single(c.links[0].walkedPath, clockwise);
7696
7712
  }
7697
- if (chain.contains) {
7698
- doChains(chain.contains, !clockwise);
7713
+ if (c.contains) {
7714
+ doChains(c.contains, !clockwise);
7699
7715
  }
7700
7716
  });
7701
7717
  }
@@ -10225,6 +10241,7 @@ var MakerJs;
10225
10241
  ];
10226
10242
  })(models = MakerJs.models || (MakerJs.models = {}));
10227
10243
  })(MakerJs || (MakerJs = {}));
10244
+ /// <reference types="fontkit" />
10228
10245
  var MakerJs;
10229
10246
  (function (MakerJs) {
10230
10247
  var models;
@@ -10232,13 +10249,13 @@ var MakerJs;
10232
10249
  var Text = /** @class */ (function () {
10233
10250
  /**
10234
10251
  * Renders text in a given font to a model.
10235
- * @param font OpenType.Font object.
10252
+ * @param font OpenType.Font object or fontkit font object.
10236
10253
  * @param text String of text to render.
10237
10254
  * @param fontSize Font size.
10238
10255
  * @param combine Flag (default false) to perform a combineUnion upon each character with characters to the left and right.
10239
10256
  * @param centerCharacterOrigin Flag (default false) to move the x origin of each character to the center. Useful for rotating text characters.
10240
10257
  * @param bezierAccuracy Optional accuracy of Bezier curves.
10241
- * @param opentypeOptions Optional opentype.RenderOptions object.
10258
+ * @param opentypeOptions Optional opentype.RenderOptions object or fontkit layout options.
10242
10259
  * @returns Model of the text.
10243
10260
  */
10244
10261
  function Text(font, text, fontSize, combine, centerCharacterOrigin, bezierAccuracy, opentypeOptions) {
@@ -10250,7 +10267,7 @@ var MakerJs;
10250
10267
  var prevDeleted;
10251
10268
  var prevChar;
10252
10269
  var cb = function (glyph, x, y, _fontSize, options) {
10253
- var charModel = Text.glyphToModel(glyph, _fontSize, bezierAccuracy);
10270
+ var charModel = Text.glyphToModel(glyph, _fontSize, bezierAccuracy, font);
10254
10271
  charModel.origin = [x, 0];
10255
10272
  if (centerCharacterOrigin && (charModel.paths || charModel.models)) {
10256
10273
  var m = MakerJs.measure.modelExtents(charModel);
@@ -10282,62 +10299,227 @@ var MakerJs;
10282
10299
  charIndex++;
10283
10300
  prevChar = charModel;
10284
10301
  };
10285
- font.forEachGlyph(text, 0, 0, fontSize, opentypeOptions, cb);
10302
+ // Detect if font is fontkit (has layout method) or opentype.js (has forEachGlyph)
10303
+ if (font.layout && typeof font.layout === 'function') {
10304
+ // fontkit font - use layout engine
10305
+ var fontkitFont = font;
10306
+ var layoutOpts = opentypeOptions;
10307
+ var run = fontkitFont.layout(text, layoutOpts === null || layoutOpts === void 0 ? void 0 : layoutOpts.features, layoutOpts === null || layoutOpts === void 0 ? void 0 : layoutOpts.script, layoutOpts === null || layoutOpts === void 0 ? void 0 : layoutOpts.language, layoutOpts === null || layoutOpts === void 0 ? void 0 : layoutOpts.direction);
10308
+ var scale = fontSize / fontkitFont.unitsPerEm;
10309
+ var currentX = 0;
10310
+ for (var i = 0; i < run.glyphs.length; i++) {
10311
+ var glyph = run.glyphs[i];
10312
+ var position = run.positions[i];
10313
+ var glyphX = currentX + (position.xOffset || 0) * scale;
10314
+ var glyphY = (position.yOffset || 0) * scale;
10315
+ cb(glyph, glyphX, glyphY, fontSize, opentypeOptions);
10316
+ currentX += (position.xAdvance || 0) * scale;
10317
+ }
10318
+ }
10319
+ else {
10320
+ // opentype.js font - use forEachGlyph
10321
+ var opentypeFont = font;
10322
+ opentypeFont.forEachGlyph(text, 0, 0, fontSize, opentypeOptions, cb);
10323
+ }
10286
10324
  }
10287
10325
  /**
10288
- * Convert an opentype glyph to a model.
10289
- * @param glyph Opentype.Glyph object.
10326
+ * Convert an opentype glyph or fontkit glyph to a model.
10327
+ * @param glyph Opentype.Glyph object or fontkit glyph.
10290
10328
  * @param fontSize Font size.
10291
10329
  * @param bezierAccuracy Optional accuracy of Bezier curves.
10330
+ * @param font Optional font object (needed for fontkit to get scale).
10292
10331
  * @returns Model of the glyph.
10293
10332
  */
10294
- Text.glyphToModel = function (glyph, fontSize, bezierAccuracy) {
10333
+ Text.glyphToModel = function (glyph, fontSize, bezierAccuracy, font) {
10295
10334
  var charModel = {};
10296
10335
  var firstPoint;
10297
10336
  var currPoint;
10298
10337
  var pathCount = 0;
10299
- function addPath(p) {
10338
+ function addPath(p, layer) {
10300
10339
  if (!charModel.paths) {
10301
10340
  charModel.paths = {};
10302
10341
  }
10342
+ if (layer) {
10343
+ if (!charModel.layer)
10344
+ charModel.layer = layer;
10345
+ }
10303
10346
  charModel.paths['p_' + ++pathCount] = p;
10304
10347
  }
10305
- function addModel(m) {
10348
+ function addModel(m, layer) {
10306
10349
  if (!charModel.models) {
10307
10350
  charModel.models = {};
10308
10351
  }
10352
+ if (layer) {
10353
+ if (!charModel.layer)
10354
+ charModel.layer = layer;
10355
+ }
10309
10356
  charModel.models['p_' + ++pathCount] = m;
10310
10357
  }
10311
- var p = glyph.getPath(0, 0, fontSize);
10312
- p.commands.map(function (command, i) {
10313
- var points = [[command.x, command.y], [command.x1, command.y1], [command.x2, command.y2]].map(function (p) {
10314
- if (p[0] !== void 0) {
10315
- return MakerJs.point.mirror(p, false, true);
10316
- }
10317
- });
10318
- switch (command.type) {
10319
- case 'M':
10320
- firstPoint = points[0];
10321
- break;
10322
- case 'Z':
10323
- points[0] = firstPoint;
10324
- //fall through to line
10325
- case 'L':
10326
- if (!MakerJs.measure.isPointEqual(currPoint, points[0])) {
10327
- addPath(new MakerJs.paths.Line(currPoint, points[0]));
10358
+ // Detect if this is a fontkit glyph (has path property) or opentype.js glyph (has getPath method)
10359
+ var isFontkitGlyph = glyph.path && !glyph.getPath;
10360
+ var p;
10361
+ if (isFontkitGlyph && font) {
10362
+ // fontkit glyph
10363
+ var scale_1 = fontSize / font.unitsPerEm;
10364
+ p = glyph.path;
10365
+ // Check for color layers (COLR table support)
10366
+ if (glyph.layers && glyph.layers.length > 0) {
10367
+ // Handle color glyph with layers
10368
+ glyph.layers.forEach(function (layer, layerIndex) {
10369
+ var layerGlyph = font.getGlyph(layer.glyph);
10370
+ var layerPath = layerGlyph.path;
10371
+ if (layerPath && layerPath.commands) {
10372
+ // Get color from palette if available
10373
+ var layerColor = void 0;
10374
+ if (font['COLR'] && font['CPAL'] && layer.color !== undefined) {
10375
+ // CPAL table structure varies, try to access color palettes
10376
+ var cpal = font['CPAL'];
10377
+ var colorPalettes = cpal.colorPalettes || cpal.colorRecords;
10378
+ if (colorPalettes && colorPalettes.length > 0) {
10379
+ // Get the first palette
10380
+ var palette = colorPalettes[0];
10381
+ if (palette && palette.length > layer.color) {
10382
+ var color = palette[layer.color];
10383
+ if (color) {
10384
+ // Convert RGBA to hex color for layer name
10385
+ var red = color.red !== undefined ? color.red : color.r || 0;
10386
+ var green = color.green !== undefined ? color.green : color.g || 0;
10387
+ var blue = color.blue !== undefined ? color.blue : color.b || 0;
10388
+ layerColor = "color_".concat(red.toString(16).padStart(2, '0')).concat(green.toString(16).padStart(2, '0')).concat(blue.toString(16).padStart(2, '0'));
10389
+ }
10390
+ }
10391
+ }
10392
+ }
10393
+ // Process layer path commands
10394
+ var layerFirstPoint = void 0;
10395
+ var layerCurrPoint = void 0;
10396
+ for (var _i = 0, _a = layerPath.commands; _i < _a.length; _i++) {
10397
+ var cmd = _a[_i];
10398
+ var points = Text.convertFontkitCommand(cmd, scale_1);
10399
+ switch (cmd.command) {
10400
+ case 'moveTo':
10401
+ layerFirstPoint = points[0];
10402
+ layerCurrPoint = points[0];
10403
+ break;
10404
+ case 'closePath':
10405
+ points[0] = layerFirstPoint;
10406
+ // fall through to line
10407
+ case 'lineTo':
10408
+ if (layerCurrPoint && !MakerJs.measure.isPointEqual(layerCurrPoint, points[0])) {
10409
+ addPath(new MakerJs.paths.Line(layerCurrPoint, points[0]), layerColor);
10410
+ }
10411
+ layerCurrPoint = points[0];
10412
+ break;
10413
+ case 'bezierCurveTo':
10414
+ if (layerCurrPoint) {
10415
+ addModel(new models.BezierCurve(layerCurrPoint, points[0], points[1], points[2], bezierAccuracy), layerColor);
10416
+ }
10417
+ layerCurrPoint = points[2];
10418
+ break;
10419
+ case 'quadraticCurveTo':
10420
+ if (layerCurrPoint) {
10421
+ addModel(new models.BezierCurve(layerCurrPoint, points[0], points[1], bezierAccuracy), layerColor);
10422
+ }
10423
+ layerCurrPoint = points[1];
10424
+ break;
10425
+ }
10426
+ }
10328
10427
  }
10329
- break;
10330
- case 'C':
10331
- addModel(new models.BezierCurve(currPoint, points[1], points[2], points[0], bezierAccuracy));
10332
- break;
10333
- case 'Q':
10334
- addModel(new models.BezierCurve(currPoint, points[1], points[0], bezierAccuracy));
10335
- break;
10428
+ });
10429
+ return charModel;
10430
+ }
10431
+ // Standard fontkit glyph (no color layers)
10432
+ if (!p || !p.commands) {
10433
+ return charModel; // Empty glyph (e.g., space)
10434
+ }
10435
+ for (var _i = 0, _a = p.commands; _i < _a.length; _i++) {
10436
+ var cmd = _a[_i];
10437
+ var points = Text.convertFontkitCommand(cmd, scale_1);
10438
+ switch (cmd.command) {
10439
+ case 'moveTo':
10440
+ firstPoint = points[0];
10441
+ currPoint = points[0];
10442
+ break;
10443
+ case 'closePath':
10444
+ points[0] = firstPoint;
10445
+ // fall through to line
10446
+ case 'lineTo':
10447
+ if (!MakerJs.measure.isPointEqual(currPoint, points[0])) {
10448
+ addPath(new MakerJs.paths.Line(currPoint, points[0]));
10449
+ }
10450
+ currPoint = points[0];
10451
+ break;
10452
+ case 'bezierCurveTo':
10453
+ addModel(new models.BezierCurve(currPoint, points[0], points[1], points[2], bezierAccuracy));
10454
+ currPoint = points[2];
10455
+ break;
10456
+ case 'quadraticCurveTo':
10457
+ addModel(new models.BezierCurve(currPoint, points[0], points[1], bezierAccuracy));
10458
+ currPoint = points[1];
10459
+ break;
10460
+ }
10336
10461
  }
10337
- currPoint = points[0];
10338
- });
10462
+ }
10463
+ else {
10464
+ // opentype.js glyph
10465
+ p = glyph.getPath(0, 0, fontSize);
10466
+ p.commands.map(function (command, i) {
10467
+ var points = [[command.x, command.y], [command.x1, command.y1], [command.x2, command.y2]].map(function (p) {
10468
+ if (p[0] !== void 0) {
10469
+ return MakerJs.point.mirror(p, false, true);
10470
+ }
10471
+ });
10472
+ switch (command.type) {
10473
+ case 'M':
10474
+ firstPoint = points[0];
10475
+ break;
10476
+ case 'Z':
10477
+ points[0] = firstPoint;
10478
+ //fall through to line
10479
+ case 'L':
10480
+ if (!MakerJs.measure.isPointEqual(currPoint, points[0])) {
10481
+ addPath(new MakerJs.paths.Line(currPoint, points[0]));
10482
+ }
10483
+ break;
10484
+ case 'C':
10485
+ addModel(new models.BezierCurve(currPoint, points[1], points[2], points[0], bezierAccuracy));
10486
+ break;
10487
+ case 'Q':
10488
+ addModel(new models.BezierCurve(currPoint, points[1], points[0], bezierAccuracy));
10489
+ break;
10490
+ }
10491
+ currPoint = points[0];
10492
+ });
10493
+ }
10339
10494
  return charModel;
10340
10495
  };
10496
+ /**
10497
+ * Convert fontkit path command to points array
10498
+ * @param cmd Fontkit path command
10499
+ * @param scale Scale factor
10500
+ * @returns Array of points
10501
+ */
10502
+ Text.convertFontkitCommand = function (cmd, scale) {
10503
+ var points = [];
10504
+ switch (cmd.command) {
10505
+ case 'moveTo':
10506
+ case 'lineTo':
10507
+ points.push([cmd.args[0] * scale, cmd.args[1] * scale]);
10508
+ break;
10509
+ case 'quadraticCurveTo':
10510
+ // Control point, end point
10511
+ points.push([cmd.args[0] * scale, cmd.args[1] * scale]);
10512
+ points.push([cmd.args[2] * scale, cmd.args[3] * scale]);
10513
+ break;
10514
+ case 'bezierCurveTo':
10515
+ // Control point 1, control point 2, end point
10516
+ points.push([cmd.args[0] * scale, cmd.args[1] * scale]);
10517
+ points.push([cmd.args[2] * scale, cmd.args[3] * scale]);
10518
+ points.push([cmd.args[4] * scale, cmd.args[5] * scale]);
10519
+ break;
10520
+ }
10521
+ return points;
10522
+ };
10341
10523
  return Text;
10342
10524
  }());
10343
10525
  models.Text = Text;
@@ -10350,6 +10532,7 @@ var MakerJs;
10350
10532
  ];
10351
10533
  })(models = MakerJs.models || (MakerJs.models = {}));
10352
10534
  })(MakerJs || (MakerJs = {}));
10353
- MakerJs.version = "0.18.2";
10535
+ MakerJs.version = "0.19.1";
10354
10536
 
10537
+ }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
10355
10538
  },{"clone":2,"graham_scan":3,"kdbush":4}]},{},[]);
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for Maker.js 0.18.2
1
+ // Type definitions for Maker.js 0.19.1
2
2
  // Project: https://github.com/Microsoft/maker.js
3
3
  // Definitions by: Dan Marshall <https://github.com/danmarshall>
4
4
  // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -3244,12 +3244,13 @@ declare namespace MakerJs.exporter {
3244
3244
  /**
3245
3245
  * Convert a chain to SVG path data.
3246
3246
  *
3247
- * @param chain Chain to convert.
3247
+ * @param c Chain to convert.
3248
3248
  * @param offset IPoint relative offset point.
3249
3249
  * @param accuracy Optional accuracy of SVG path data.
3250
+ * @param clockwise Optional flag to specify desired winding direction for nonzero fill rule.
3250
3251
  * @returns String of SVG path data.
3251
3252
  */
3252
- function chainToSVGPathData(chain: IChain, offset: IPoint, accuracy?: number): string;
3253
+ function chainToSVGPathData(c: IChain, offset: IPoint, accuracy?: number, clockwise?: boolean): string;
3253
3254
  /**
3254
3255
  * Export a path to SVG path data.
3255
3256
  *
@@ -3943,28 +3944,55 @@ declare namespace MakerJs.models {
3943
3944
  static InnerRadiusRatio(numberOfPoints: number, skipPoints: number): number;
3944
3945
  }
3945
3946
  }
3947
+ declare namespace fontkit {
3948
+ type Font = import('fontkit').Font;
3949
+ }
3950
+ declare namespace MakerJs {
3951
+ /**
3952
+ * Layout options for fontkit font rendering.
3953
+ * These options are passed to the fontkit layout engine.
3954
+ */
3955
+ interface IFontkitLayoutOptions {
3956
+ /** OpenType features to enable/disable (array of feature tags or object mapping feature tags to boolean) */
3957
+ features?: string[] | Record<string, boolean>;
3958
+ /** Script code (e.g., 'latn', 'arab') */
3959
+ script?: string;
3960
+ /** Language code (e.g., 'ENG', 'ARA') */
3961
+ language?: string;
3962
+ /** Text direction ('ltr' or 'rtl') */
3963
+ direction?: string;
3964
+ }
3965
+ }
3946
3966
  declare namespace MakerJs.models {
3947
3967
  class Text implements IModel {
3948
3968
  models: IModelMap;
3949
3969
  /**
3950
3970
  * Renders text in a given font to a model.
3951
- * @param font OpenType.Font object.
3971
+ * @param font OpenType.Font object or fontkit font object.
3952
3972
  * @param text String of text to render.
3953
3973
  * @param fontSize Font size.
3954
3974
  * @param combine Flag (default false) to perform a combineUnion upon each character with characters to the left and right.
3955
3975
  * @param centerCharacterOrigin Flag (default false) to move the x origin of each character to the center. Useful for rotating text characters.
3956
3976
  * @param bezierAccuracy Optional accuracy of Bezier curves.
3957
- * @param opentypeOptions Optional opentype.RenderOptions object.
3977
+ * @param opentypeOptions Optional opentype.RenderOptions object or fontkit layout options.
3958
3978
  * @returns Model of the text.
3959
3979
  */
3960
- constructor(font: opentype.Font, text: string, fontSize: number, combine?: boolean, centerCharacterOrigin?: boolean, bezierAccuracy?: number, opentypeOptions?: opentype.RenderOptions);
3980
+ constructor(font: opentype.Font | fontkit.Font, text: string, fontSize: number, combine?: boolean, centerCharacterOrigin?: boolean, bezierAccuracy?: number, opentypeOptions?: opentype.RenderOptions | IFontkitLayoutOptions);
3961
3981
  /**
3962
- * Convert an opentype glyph to a model.
3963
- * @param glyph Opentype.Glyph object.
3982
+ * Convert an opentype glyph or fontkit glyph to a model.
3983
+ * @param glyph Opentype.Glyph object or fontkit glyph.
3964
3984
  * @param fontSize Font size.
3965
3985
  * @param bezierAccuracy Optional accuracy of Bezier curves.
3986
+ * @param font Optional font object (needed for fontkit to get scale).
3966
3987
  * @returns Model of the glyph.
3967
3988
  */
3968
- static glyphToModel(glyph: opentype.Glyph, fontSize: number, bezierAccuracy?: number): IModel;
3989
+ static glyphToModel(glyph: any, fontSize: number, bezierAccuracy?: number, font?: any): IModel;
3990
+ /**
3991
+ * Convert fontkit path command to points array
3992
+ * @param cmd Fontkit path command
3993
+ * @param scale Scale factor
3994
+ * @returns Array of points
3995
+ */
3996
+ private static convertFontkitCommand;
3969
3997
  }
3970
3998
  }