modern-text 0.2.6 → 0.2.8

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.
package/dist/index.cjs CHANGED
@@ -173,8 +173,7 @@ class Character {
173
173
  __publicField$4(this, "boundingBox", new modernPath2d.BoundingBox());
174
174
  __publicField$4(this, "textWidth", 0);
175
175
  __publicField$4(this, "textHeight", 0);
176
- // glyph
177
- __publicField$4(this, "commands", []);
176
+ __publicField$4(this, "path", new modernPath2d.Path2D());
178
177
  }
179
178
  get computedStyle() {
180
179
  return this.parent.computedStyle;
@@ -220,7 +219,7 @@ class Character {
220
219
  this.centerPoint = this.glyphBox.getCenterPoint();
221
220
  return this;
222
221
  }
223
- updateCommands() {
222
+ updatePath() {
224
223
  const font = this._font();
225
224
  if (!font) {
226
225
  return this;
@@ -292,11 +291,11 @@ class Character {
292
291
  }
293
292
  }
294
293
  commands.push(...this._decoration());
295
- this.commands = commands;
294
+ this.path = new modernPath2d.Path2D(commands);
296
295
  return this;
297
296
  }
298
297
  update() {
299
- this.updateCommands();
298
+ this.updatePath();
300
299
  return this;
301
300
  }
302
301
  _decoration() {
@@ -376,71 +375,16 @@ class Character {
376
375
  return cmd;
377
376
  });
378
377
  }
379
- forEachCommand(cb) {
380
- const commands = this.commands;
381
- const last = { x: 0, y: 0 };
382
- const first = { x: 0, y: 0 };
383
- let isFirst = true;
384
- let doSetFirstPoint = false;
385
- for (let i = 0, len = commands.length; i < len; i++) {
386
- if (isFirst) {
387
- doSetFirstPoint = true;
388
- isFirst = false;
389
- }
390
- let command = commands[i];
391
- command = cb(command, i, { last, first }) ?? command;
392
- switch (command.type) {
393
- case "M":
394
- case "L":
395
- case "Q":
396
- last.x = command.x;
397
- last.y = command.y;
398
- if (doSetFirstPoint) {
399
- first.x = last.x;
400
- first.y = last.y;
401
- }
402
- break;
403
- case "Z":
404
- last.x = first.x;
405
- last.y = first.y;
406
- isFirst = true;
407
- break;
408
- }
409
- }
410
- return this;
378
+ getMinMax(min, max) {
379
+ return this.path.getMinMax(min, max);
411
380
  }
412
- getMinMax(min = modernPath2d.Point2D.MAX, max = modernPath2d.Point2D.MIN) {
413
- let last = { x: 0, y: 0 };
414
- this.commands.forEach((cmd) => {
415
- switch (cmd.type) {
416
- case "L":
417
- case "M":
418
- min.x = Math.min(min.x, cmd.x);
419
- min.y = Math.min(min.y, cmd.y);
420
- max.x = Math.max(max.x, cmd.x);
421
- max.y = Math.max(max.y, cmd.y);
422
- last = { x: cmd.x, y: cmd.y };
423
- break;
424
- case "Q": {
425
- const x1 = 0.5 * (last.x + cmd.x1);
426
- const y1 = 0.5 * (last.y + cmd.y1);
427
- const x2 = 0.5 * (last.x + cmd.x);
428
- const y2 = 0.5 * (last.y + cmd.y);
429
- min.x = Math.min(min.x, last.x, cmd.x, x1, x2);
430
- min.y = Math.min(min.y, last.y, cmd.y, y1, y2);
431
- max.x = Math.max(max.x, last.x, cmd.x, x1, x2);
432
- max.y = Math.max(max.y, last.y, cmd.y, y1, y2);
433
- last = { x: cmd.x, y: cmd.y };
434
- break;
435
- }
436
- }
437
- });
438
- return { min, max };
381
+ getBoundingBox() {
382
+ return this.path.getBoundingBox();
439
383
  }
440
384
  drawTo(ctx, config = {}) {
441
385
  drawPaths({
442
386
  ctx,
443
- paths: [new modernPath2d.Path2D(this.commands)],
387
+ paths: [this.path],
444
388
  fontSize: this.computedStyle.fontSize,
445
389
  color: this.computedStyle.color,
446
390
  ...config
@@ -579,8 +523,8 @@ class Highlighter extends Feature {
579
523
  if (!this.paths.length) {
580
524
  return new modernPath2d.BoundingBox();
581
525
  }
582
- const min = modernPath2d.Point2D.MAX;
583
- const max = modernPath2d.Point2D.MIN;
526
+ const min = modernPath2d.Vector2.MAX;
527
+ const max = modernPath2d.Vector2.MIN;
584
528
  this.paths.forEach((path) => path.getMinMax(min, max));
585
529
  return new modernPath2d.BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
586
530
  }
@@ -614,8 +558,8 @@ class Highlighter extends Feature {
614
558
  _parseSvg(url) {
615
559
  const svg = modernPath2d.parseSvgToDom(url);
616
560
  const paths = modernPath2d.parseSvg(svg);
617
- const min = modernPath2d.Point2D.MAX;
618
- const max = modernPath2d.Point2D.MIN;
561
+ const min = modernPath2d.Vector2.MAX;
562
+ const max = modernPath2d.Vector2.MIN;
619
563
  paths.forEach((path) => path.getMinMax(min, max));
620
564
  const { x, y, width, height } = new modernPath2d.BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
621
565
  const viewBox = svg.getAttribute("viewBox").split(" ").map(Number);
@@ -1043,12 +987,12 @@ class Text {
1043
987
  __publicField(this, "paragraphs", []);
1044
988
  __publicField(this, "boundingBox", new modernPath2d.BoundingBox());
1045
989
  __publicField(this, "renderBoundingBox", new modernPath2d.BoundingBox());
1046
- __publicField(this, "_parser", new Parser(this));
1047
- __publicField(this, "_measurer", new Measurer(this));
1048
- __publicField(this, "_deformer", new Deformer(this));
1049
- __publicField(this, "_effector", new Effector(this));
1050
- __publicField(this, "_highlighter", new Highlighter(this));
1051
- __publicField(this, "_renderer2D", new Renderer2D(this));
990
+ __publicField(this, "parser", new Parser(this));
991
+ __publicField(this, "measurer", new Measurer(this));
992
+ __publicField(this, "deformer", new Deformer(this));
993
+ __publicField(this, "effector", new Effector(this));
994
+ __publicField(this, "highlighter", new Highlighter(this));
995
+ __publicField(this, "renderer2D", new Renderer2D(this));
1052
996
  const { content = "", style = {}, effects, deformation, measureDom } = options;
1053
997
  this.content = content;
1054
998
  this.style = style;
@@ -1062,8 +1006,8 @@ class Text {
1062
1006
  measure(dom = this.measureDom) {
1063
1007
  this.computedStyle = { ...defaultTextStyles, ...this.style };
1064
1008
  const old = this.paragraphs;
1065
- this.paragraphs = this._parser.parse();
1066
- const result = this._measurer.measure(dom);
1009
+ this.paragraphs = this.parser.parse();
1010
+ const result = this.measurer.measure(dom);
1067
1011
  this.paragraphs = old;
1068
1012
  return result;
1069
1013
  }
@@ -1077,12 +1021,12 @@ class Text {
1077
1021
  this.boundingBox = boundingBox;
1078
1022
  const characters = this.characters;
1079
1023
  characters.forEach((c) => c.update());
1024
+ this.highlighter.highlight();
1080
1025
  if (this.deformation) {
1081
- this._deformer.deform();
1026
+ this.deformer.deform();
1082
1027
  }
1083
- this._highlighter.highlight();
1084
- const min = modernPath2d.Point2D.MAX;
1085
- const max = modernPath2d.Point2D.MIN;
1028
+ const min = modernPath2d.Vector2.MAX;
1029
+ const max = modernPath2d.Vector2.MIN;
1086
1030
  characters.forEach((c) => c.getMinMax(min, max));
1087
1031
  this.renderBoundingBox = new modernPath2d.BoundingBox(min.x, min.y, max.x - min.x, max.y - min.y);
1088
1032
  return this;
@@ -1100,23 +1044,23 @@ class Text {
1100
1044
  this.renderBoundingBox = modernPath2d.BoundingBox.from(
1101
1045
  this.boundingBox,
1102
1046
  this.renderBoundingBox,
1103
- this._effector.getBoundingBox(),
1104
- this._highlighter.getBoundingBox()
1047
+ this.effector.getBoundingBox(),
1048
+ this.highlighter.getBoundingBox()
1105
1049
  );
1106
1050
  } else {
1107
1051
  this.renderBoundingBox = modernPath2d.BoundingBox.from(
1108
1052
  this.boundingBox,
1109
1053
  this.renderBoundingBox,
1110
- this._highlighter.getBoundingBox()
1054
+ this.highlighter.getBoundingBox()
1111
1055
  );
1112
1056
  }
1113
- this._renderer2D.setupView({ pixelRatio, ctx });
1114
- this._renderer2D.uploadColors({ ctx });
1115
- this._highlighter.draw({ ctx });
1057
+ this.renderer2D.setupView({ pixelRatio, ctx });
1058
+ this.renderer2D.uploadColors({ ctx });
1059
+ this.highlighter.draw({ ctx });
1116
1060
  if (this.effects?.length) {
1117
- this._effector.draw({ ctx });
1061
+ this.effector.draw({ ctx });
1118
1062
  } else {
1119
- this._renderer2D.draw({ ctx });
1063
+ this.renderer2D.draw({ ctx });
1120
1064
  }
1121
1065
  return this;
1122
1066
  }
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { BoundingBox, Path2D, Point2D } from 'modern-path2d';
2
- import { GlyphPathCommand, Sfnt } from 'modern-font';
1
+ import { BoundingBox, Path2D, VectorLike, Vector2 } from 'modern-path2d';
2
+ import { Sfnt, GlyphPathCommand } from 'modern-font';
3
3
  export * from 'modern-font';
4
4
 
5
5
  type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
@@ -12,10 +12,6 @@ type TextAlign = 'center' | 'end' | 'left' | 'right' | 'start';
12
12
  type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
13
13
  type TextTransform = 'uppercase' | 'lowercase' | 'none';
14
14
  type TextDecoration = 'none' | 'underline' | 'line-through';
15
- interface PointLike {
16
- x: number;
17
- y: number;
18
- }
19
15
  interface TextLayoutStyle {
20
16
  writingMode: WritingMode;
21
17
  textOrientation: TextOrientation;
@@ -103,7 +99,7 @@ declare class Character {
103
99
  boundingBox: BoundingBox;
104
100
  textWidth: number;
105
101
  textHeight: number;
106
- commands: GlyphPathCommand[];
102
+ path: Path2D<any>;
107
103
  glyphHeight: number;
108
104
  glyphWidth: number;
109
105
  underlinePosition: number;
@@ -113,27 +109,24 @@ declare class Character {
113
109
  baseline: number;
114
110
  centerDiviation: number;
115
111
  glyphBox: BoundingBox;
116
- centerPoint: PointLike;
112
+ centerPoint: VectorLike;
117
113
  get computedStyle(): TextStyle;
118
114
  get isVertical(): boolean;
119
115
  get fontSize(): number;
120
116
  constructor(content: string, index: number, parent: Fragment);
121
117
  protected _font(): Sfnt | undefined;
122
118
  updateGlyph(font?: Sfnt | undefined): this;
123
- updateCommands(): this;
119
+ updatePath(): this;
124
120
  update(): this;
125
121
  protected _decoration(): GlyphPathCommand[];
126
- protected _italic(commands: GlyphPathCommand[], startPoint?: PointLike): GlyphPathCommand[];
127
- protected _rotation90(commands: GlyphPathCommand[], point: PointLike): GlyphPathCommand[];
122
+ protected _italic(commands: GlyphPathCommand[], startPoint?: VectorLike): GlyphPathCommand[];
123
+ protected _rotation90(commands: GlyphPathCommand[], point: VectorLike): GlyphPathCommand[];
128
124
  protected _transform(commands: GlyphPathCommand[], cb: (x: number, y: number) => number[]): GlyphPathCommand[];
129
- forEachCommand(cb: (command: GlyphPathCommand, index: number, context: {
130
- first: PointLike;
131
- last: PointLike;
132
- }) => void | GlyphPathCommand): this;
133
- getMinMax(min?: Point2D, max?: Point2D): {
134
- min: Point2D;
135
- max: Point2D;
125
+ getMinMax(min?: Vector2, max?: Vector2): {
126
+ min: Vector2;
127
+ max: Vector2;
136
128
  };
129
+ getBoundingBox(): BoundingBox;
137
130
  drawTo(ctx: CanvasRenderingContext2D, config?: Partial<TextEffect>): void;
138
131
  }
139
132
 
@@ -194,12 +187,12 @@ declare class Text {
194
187
  paragraphs: Paragraph[];
195
188
  boundingBox: BoundingBox;
196
189
  renderBoundingBox: BoundingBox;
197
- protected _parser: Parser;
198
- protected _measurer: Measurer;
199
- protected _deformer: Deformer;
200
- protected _effector: Effector;
201
- protected _highlighter: Highlighter;
202
- protected _renderer2D: Renderer2D;
190
+ parser: Parser;
191
+ measurer: Measurer;
192
+ deformer: Deformer;
193
+ effector: Effector;
194
+ highlighter: Highlighter;
195
+ renderer2D: Renderer2D;
203
196
  get characters(): Character[];
204
197
  constructor(options?: TextOptions);
205
198
  measure(dom?: HTMLElement | undefined): MeasuredResult;
@@ -344,4 +337,4 @@ declare function getPointPosition(point: {
344
337
  y: number;
345
338
  };
346
339
 
347
- export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, type PointLike, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, drawPaths, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };
340
+ export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, drawPaths, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { BoundingBox, Path2D, Point2D } from 'modern-path2d';
2
- import { GlyphPathCommand, Sfnt } from 'modern-font';
1
+ import { BoundingBox, Path2D, VectorLike, Vector2 } from 'modern-path2d';
2
+ import { Sfnt, GlyphPathCommand } from 'modern-font';
3
3
  export * from 'modern-font';
4
4
 
5
5
  type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
@@ -12,10 +12,6 @@ type TextAlign = 'center' | 'end' | 'left' | 'right' | 'start';
12
12
  type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
13
13
  type TextTransform = 'uppercase' | 'lowercase' | 'none';
14
14
  type TextDecoration = 'none' | 'underline' | 'line-through';
15
- interface PointLike {
16
- x: number;
17
- y: number;
18
- }
19
15
  interface TextLayoutStyle {
20
16
  writingMode: WritingMode;
21
17
  textOrientation: TextOrientation;
@@ -103,7 +99,7 @@ declare class Character {
103
99
  boundingBox: BoundingBox;
104
100
  textWidth: number;
105
101
  textHeight: number;
106
- commands: GlyphPathCommand[];
102
+ path: Path2D<any>;
107
103
  glyphHeight: number;
108
104
  glyphWidth: number;
109
105
  underlinePosition: number;
@@ -113,27 +109,24 @@ declare class Character {
113
109
  baseline: number;
114
110
  centerDiviation: number;
115
111
  glyphBox: BoundingBox;
116
- centerPoint: PointLike;
112
+ centerPoint: VectorLike;
117
113
  get computedStyle(): TextStyle;
118
114
  get isVertical(): boolean;
119
115
  get fontSize(): number;
120
116
  constructor(content: string, index: number, parent: Fragment);
121
117
  protected _font(): Sfnt | undefined;
122
118
  updateGlyph(font?: Sfnt | undefined): this;
123
- updateCommands(): this;
119
+ updatePath(): this;
124
120
  update(): this;
125
121
  protected _decoration(): GlyphPathCommand[];
126
- protected _italic(commands: GlyphPathCommand[], startPoint?: PointLike): GlyphPathCommand[];
127
- protected _rotation90(commands: GlyphPathCommand[], point: PointLike): GlyphPathCommand[];
122
+ protected _italic(commands: GlyphPathCommand[], startPoint?: VectorLike): GlyphPathCommand[];
123
+ protected _rotation90(commands: GlyphPathCommand[], point: VectorLike): GlyphPathCommand[];
128
124
  protected _transform(commands: GlyphPathCommand[], cb: (x: number, y: number) => number[]): GlyphPathCommand[];
129
- forEachCommand(cb: (command: GlyphPathCommand, index: number, context: {
130
- first: PointLike;
131
- last: PointLike;
132
- }) => void | GlyphPathCommand): this;
133
- getMinMax(min?: Point2D, max?: Point2D): {
134
- min: Point2D;
135
- max: Point2D;
125
+ getMinMax(min?: Vector2, max?: Vector2): {
126
+ min: Vector2;
127
+ max: Vector2;
136
128
  };
129
+ getBoundingBox(): BoundingBox;
137
130
  drawTo(ctx: CanvasRenderingContext2D, config?: Partial<TextEffect>): void;
138
131
  }
139
132
 
@@ -194,12 +187,12 @@ declare class Text {
194
187
  paragraphs: Paragraph[];
195
188
  boundingBox: BoundingBox;
196
189
  renderBoundingBox: BoundingBox;
197
- protected _parser: Parser;
198
- protected _measurer: Measurer;
199
- protected _deformer: Deformer;
200
- protected _effector: Effector;
201
- protected _highlighter: Highlighter;
202
- protected _renderer2D: Renderer2D;
190
+ parser: Parser;
191
+ measurer: Measurer;
192
+ deformer: Deformer;
193
+ effector: Effector;
194
+ highlighter: Highlighter;
195
+ renderer2D: Renderer2D;
203
196
  get characters(): Character[];
204
197
  constructor(options?: TextOptions);
205
198
  measure(dom?: HTMLElement | undefined): MeasuredResult;
@@ -344,4 +337,4 @@ declare function getPointPosition(point: {
344
337
  y: number;
345
338
  };
346
339
 
347
- export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, type PointLike, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, drawPaths, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };
340
+ export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, drawPaths, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { BoundingBox, Path2D, Point2D } from 'modern-path2d';
2
- import { GlyphPathCommand, Sfnt } from 'modern-font';
1
+ import { BoundingBox, Path2D, VectorLike, Vector2 } from 'modern-path2d';
2
+ import { Sfnt, GlyphPathCommand } from 'modern-font';
3
3
  export * from 'modern-font';
4
4
 
5
5
  type WritingMode = 'horizontal-tb' | 'vertical-lr' | 'vertical-rl';
@@ -12,10 +12,6 @@ type TextAlign = 'center' | 'end' | 'left' | 'right' | 'start';
12
12
  type VerticalAlign = 'baseline' | 'top' | 'middle' | 'bottom' | 'sub' | 'super' | 'text-top' | 'text-bottom';
13
13
  type TextTransform = 'uppercase' | 'lowercase' | 'none';
14
14
  type TextDecoration = 'none' | 'underline' | 'line-through';
15
- interface PointLike {
16
- x: number;
17
- y: number;
18
- }
19
15
  interface TextLayoutStyle {
20
16
  writingMode: WritingMode;
21
17
  textOrientation: TextOrientation;
@@ -103,7 +99,7 @@ declare class Character {
103
99
  boundingBox: BoundingBox;
104
100
  textWidth: number;
105
101
  textHeight: number;
106
- commands: GlyphPathCommand[];
102
+ path: Path2D<any>;
107
103
  glyphHeight: number;
108
104
  glyphWidth: number;
109
105
  underlinePosition: number;
@@ -113,27 +109,24 @@ declare class Character {
113
109
  baseline: number;
114
110
  centerDiviation: number;
115
111
  glyphBox: BoundingBox;
116
- centerPoint: PointLike;
112
+ centerPoint: VectorLike;
117
113
  get computedStyle(): TextStyle;
118
114
  get isVertical(): boolean;
119
115
  get fontSize(): number;
120
116
  constructor(content: string, index: number, parent: Fragment);
121
117
  protected _font(): Sfnt | undefined;
122
118
  updateGlyph(font?: Sfnt | undefined): this;
123
- updateCommands(): this;
119
+ updatePath(): this;
124
120
  update(): this;
125
121
  protected _decoration(): GlyphPathCommand[];
126
- protected _italic(commands: GlyphPathCommand[], startPoint?: PointLike): GlyphPathCommand[];
127
- protected _rotation90(commands: GlyphPathCommand[], point: PointLike): GlyphPathCommand[];
122
+ protected _italic(commands: GlyphPathCommand[], startPoint?: VectorLike): GlyphPathCommand[];
123
+ protected _rotation90(commands: GlyphPathCommand[], point: VectorLike): GlyphPathCommand[];
128
124
  protected _transform(commands: GlyphPathCommand[], cb: (x: number, y: number) => number[]): GlyphPathCommand[];
129
- forEachCommand(cb: (command: GlyphPathCommand, index: number, context: {
130
- first: PointLike;
131
- last: PointLike;
132
- }) => void | GlyphPathCommand): this;
133
- getMinMax(min?: Point2D, max?: Point2D): {
134
- min: Point2D;
135
- max: Point2D;
125
+ getMinMax(min?: Vector2, max?: Vector2): {
126
+ min: Vector2;
127
+ max: Vector2;
136
128
  };
129
+ getBoundingBox(): BoundingBox;
137
130
  drawTo(ctx: CanvasRenderingContext2D, config?: Partial<TextEffect>): void;
138
131
  }
139
132
 
@@ -194,12 +187,12 @@ declare class Text {
194
187
  paragraphs: Paragraph[];
195
188
  boundingBox: BoundingBox;
196
189
  renderBoundingBox: BoundingBox;
197
- protected _parser: Parser;
198
- protected _measurer: Measurer;
199
- protected _deformer: Deformer;
200
- protected _effector: Effector;
201
- protected _highlighter: Highlighter;
202
- protected _renderer2D: Renderer2D;
190
+ parser: Parser;
191
+ measurer: Measurer;
192
+ deformer: Deformer;
193
+ effector: Effector;
194
+ highlighter: Highlighter;
195
+ renderer2D: Renderer2D;
203
196
  get characters(): Character[];
204
197
  constructor(options?: TextOptions);
205
198
  measure(dom?: HTMLElement | undefined): MeasuredResult;
@@ -344,4 +337,4 @@ declare function getPointPosition(point: {
344
337
  y: number;
345
338
  };
346
339
 
347
- export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, type PointLike, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, drawPaths, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };
340
+ export { Character, Deformer, type DrawShapePathsOptions, type EffectOptions, Effector, type FontKerning, type FontStyle, type FontWeight, Fragment, type FragmentContent, type FragmentHighlight, Highlighter, type LinearGradient, type MeasuredCharacter, type MeasuredFragment, type MeasuredParagraph, type MeasuredResult, Measurer, Paragraph, type ParagraphContent, Parser, Reflector, type Render2dOptions, Renderer2D, Text, type TextAlign, type TextContent, type TextDecoration, type TextDeformation, type TextDrawStyle, type TextEffect, type TextLayoutStyle, type TextOptions, type TextOrientation, type TextRenderOptions, type TextStyle, type TextTransform, type TextWrap, type VerticalAlign, type WritingMode, defaultTextStyles, drawPaths, filterEmpty, getPointPosition, getRotationPoint, getScalePoint, getSkewPoint, parseColor, uploadColor };