@types/opentype.js 1.3.3 → 1.3.4

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.
opentype.js/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for opentype.js (https://github.com/opent
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/opentype.js.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Mon, 09 Aug 2021 19:31:27 GMT
11
+ * Last updated: Fri, 12 Aug 2022 18:32:41 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `opentype`
14
14
 
opentype.js/index.d.ts CHANGED
@@ -36,7 +36,7 @@ export class Font {
36
36
  x?: number,
37
37
  y?: number,
38
38
  fontSize?: number,
39
- options?: RenderOptions
39
+ options?: RenderOptions,
40
40
  ): void;
41
41
  drawMetrics(
42
42
  ctx: CanvasRenderingContext2D,
@@ -44,7 +44,7 @@ export class Font {
44
44
  x?: number,
45
45
  y?: number,
46
46
  fontSize?: number,
47
- options?: RenderOptions
47
+ options?: RenderOptions,
48
48
  ): void;
49
49
  drawPoints(
50
50
  ctx: CanvasRenderingContext2D,
@@ -52,7 +52,7 @@ export class Font {
52
52
  x?: number,
53
53
  y?: number,
54
54
  fontSize?: number,
55
- options?: RenderOptions
55
+ options?: RenderOptions,
56
56
  ): void;
57
57
  forEachGlyph(
58
58
  text: string,
@@ -60,38 +60,13 @@ export class Font {
60
60
  y: number | undefined,
61
61
  fontSize: number | undefined,
62
62
  options: RenderOptions | undefined,
63
- callback: (
64
- glyph: Glyph,
65
- x: number,
66
- y: number,
67
- fontSize: number,
68
- options?: RenderOptions
69
- ) => void
70
- ): number;
71
- getAdvanceWidth(
72
- text: string,
73
- fontSize?: number,
74
- options?: RenderOptions
63
+ callback: (glyph: Glyph, x: number, y: number, fontSize: number, options?: RenderOptions) => void,
75
64
  ): number;
65
+ getAdvanceWidth(text: string, fontSize?: number, options?: RenderOptions): number;
76
66
  getEnglishName(name: string): string;
77
- getKerningValue(
78
- leftGlyph: Glyph | number,
79
- rightGlyph: Glyph | number
80
- ): number;
81
- getPath(
82
- text: string,
83
- x: number,
84
- y: number,
85
- fontSize: number,
86
- options?: RenderOptions
87
- ): Path;
88
- getPaths(
89
- text: string,
90
- x: number,
91
- y: number,
92
- fontSize: number,
93
- options?: RenderOptions
94
- ): Path[];
67
+ getKerningValue(leftGlyph: Glyph | number, rightGlyph: Glyph | number): number;
68
+ getPath(text: string, x: number, y: number, fontSize: number, options?: RenderOptions): Path;
69
+ getPaths(text: string, x: number, y: number, fontSize: number, options?: RenderOptions): Path[];
95
70
  glyphIndexToName(gid: number): string;
96
71
  glyphNames: GlyphNames;
97
72
  hasChar(c: string): boolean;
@@ -192,66 +167,48 @@ export interface Field {
192
167
 
193
168
  export class Glyph {
194
169
  index: number;
195
- private xMin;
196
- private xMax;
197
- private yMin;
198
- private yMax;
199
- private points;
200
-
201
- name: string;
202
- path: Path | (() => Path);
203
- unicode: number;
170
+ name: string | null;
171
+ unicode?: number | undefined;
204
172
  unicodes: number[];
205
- advanceWidth: number;
173
+ xMin?: number | undefined;
174
+ xMax?: number | undefined;
175
+ yMin?: number | undefined;
176
+ yMax?: number | undefined;
177
+ advanceWidth?: number | undefined;
178
+ leftSideBearing?: number | undefined;
179
+ path: Path;
206
180
 
181
+ private bindConstructorValues(options: GlyphOptions): void;
207
182
  constructor(options: GlyphOptions);
208
183
 
209
184
  addUnicode(unicode: number): void;
210
- bindConstructorValues(options: GlyphOptions): void;
211
- draw(
212
- ctx: CanvasRenderingContext2D,
213
- x?: number,
214
- y?: number,
215
- fontSize?: number,
216
- options?: RenderOptions
217
- ): void;
218
- drawMetrics(
219
- ctx: CanvasRenderingContext2D,
220
- x?: number,
221
- y?: number,
222
- fontSize?: number,
223
- options?: RenderOptions
224
- ): void;
225
- drawPoints(
226
- ctx: CanvasRenderingContext2D,
227
- x?: number,
228
- y?: number,
229
- fontSize?: number,
230
- options?: RenderOptions
231
- ): void;
232
185
  getBoundingBox(): BoundingBox;
186
+ getPath(x?: number, y?: number, fontSize?: number, options?: RenderOptions, font?: Font): Path;
233
187
  getContours(): Contour;
234
188
  getMetrics(): Metrics;
235
- getPath(
189
+ draw(ctx: CanvasRenderingContext2D, x?: number, y?: number, fontSize?: number, options?: RenderOptions): void;
190
+ drawPoints(ctx: CanvasRenderingContext2D, x?: number, y?: number, fontSize?: number, options?: RenderOptions): void;
191
+ drawMetrics(
192
+ ctx: CanvasRenderingContext2D,
236
193
  x?: number,
237
194
  y?: number,
238
195
  fontSize?: number,
239
196
  options?: RenderOptions,
240
- font?: Font
241
- ): Path;
197
+ ): void;
242
198
  }
199
+
243
200
  export interface GlyphOptions {
244
- advanceWidth?: number | undefined;
245
201
  index?: number | undefined;
246
- font?: Font | undefined;
247
202
  name?: string | undefined;
248
- path?: Path | undefined;
249
203
  unicode?: number | undefined;
250
204
  unicodes?: number[] | undefined;
251
- xMax?: number | undefined;
252
205
  xMin?: number | undefined;
253
- yMax?: number | undefined;
254
206
  yMin?: number | undefined;
207
+ xMax?: number | undefined;
208
+ yMax?: number | undefined;
209
+ advanceWidth?: number | undefined;
210
+ leftSideBearing?: number | undefined;
211
+ path?: Path | (() => Path) | undefined;
255
212
  }
256
213
 
257
214
  export class GlyphNames {
@@ -264,7 +221,7 @@ export class GlyphNames {
264
221
  export class GlyphSet {
265
222
  private font;
266
223
  private glyphs;
267
- constructor(font: Font, glyphs: Glyph[] | Array<(() => Glyph)>);
224
+ constructor(font: Font, glyphs: Glyph[] | Array<() => Glyph>);
268
225
  get(index: number): Glyph;
269
226
  length: number;
270
227
  push(index: number, loader: () => Glyph): void;
@@ -294,9 +251,11 @@ export interface RenderOptions {
294
251
  yScale?: number | undefined;
295
252
  letterSpacing?: number | undefined;
296
253
  tracking?: number | undefined;
297
- features?: {
298
- [key: string]: boolean;
299
- } | undefined;
254
+ features?:
255
+ | {
256
+ [key: string]: boolean;
257
+ }
258
+ | undefined;
300
259
  }
301
260
 
302
261
  export interface Metrics {
@@ -323,25 +282,11 @@ export class Path {
323
282
  stroke: string | null;
324
283
  strokeWidth: number;
325
284
  constructor();
326
- bezierCurveTo(
327
- x1: number,
328
- y1: number,
329
- x2: number,
330
- y2: number,
331
- x: number,
332
- y: number
333
- ): void;
285
+ bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x: number, y: number): void;
334
286
  close: () => void;
335
287
  closePath(): void;
336
288
  commands: PathCommand[];
337
- curveTo: (
338
- x1: number,
339
- y1: number,
340
- x2: number,
341
- y2: number,
342
- x: number,
343
- y: number
344
- ) => void;
289
+ curveTo: (x1: number, y1: number, x2: number, y2: number, x: number, y: number) => void;
345
290
  draw(ctx: CanvasRenderingContext2D): void;
346
291
  extend(pathOrCommands: Path | PathCommand[] | BoundingBox): void;
347
292
  getBoundingBox(): BoundingBox;
@@ -356,35 +301,35 @@ export class Path {
356
301
  }
357
302
 
358
303
  export type PathCommand =
359
- | {
360
- type: "M";
361
- x: number;
362
- y: number;
363
- }
364
- | {
365
- type: "L";
366
- x: number;
367
- y: number;
368
- }
369
- | {
370
- type: "C";
371
- x1: number;
372
- y1: number;
373
- x2: number;
374
- y2: number;
375
- x: number;
376
- y: number;
377
- }
378
- | {
379
- type: "Q";
380
- x1: number;
381
- y1: number;
382
- x: number;
383
- y: number;
384
- }
385
- | {
386
- type: "Z";
387
- };
304
+ | {
305
+ type: 'M';
306
+ x: number;
307
+ y: number;
308
+ }
309
+ | {
310
+ type: 'L';
311
+ x: number;
312
+ y: number;
313
+ }
314
+ | {
315
+ type: 'C';
316
+ x1: number;
317
+ y1: number;
318
+ x2: number;
319
+ y2: number;
320
+ x: number;
321
+ y: number;
322
+ }
323
+ | {
324
+ type: 'Q';
325
+ x1: number;
326
+ y1: number;
327
+ x: number;
328
+ y: number;
329
+ }
330
+ | {
331
+ type: 'Z';
332
+ };
388
333
 
389
334
  /******************************************
390
335
  * UTIL CLASSES
@@ -417,16 +362,14 @@ export type Substitution = (font: Font) => any;
417
362
  * STATIC
418
363
  ******************************************/
419
364
 
420
- export function load(
421
- url: string,
422
- callback: (error: any, font?: Font) => void
423
- ): void;
424
- export function load(
425
- url: string,
426
- ): Promise<Font>;
365
+ export function load(url: string, callback: (error: any, font?: Font) => void): void;
366
+ export function load(url: string): Promise<Font>;
427
367
 
428
- export function loadSync(url: string, opt?: {
429
- lowMemory: boolean;
430
- }): Font;
368
+ export function loadSync(
369
+ url: string,
370
+ opt?: {
371
+ lowMemory: boolean;
372
+ },
373
+ ): Font;
431
374
 
432
375
  export function parse(buffer: any): Font;
opentype.js/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/opentype.js",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "TypeScript definitions for opentype.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/opentype.js",
6
6
  "license": "MIT",
@@ -30,6 +30,6 @@
30
30
  },
31
31
  "scripts": {},
32
32
  "dependencies": {},
33
- "typesPublisherContentHash": "54dd6ba58b3c3e225056368a0ca1ecfcbdc73933c6b79eac5f87bea0e4e4fe1c",
34
- "typeScriptVersion": "3.6"
33
+ "typesPublisherContentHash": "f078cc7dc6765d292e7a82eec88544233cc979cc16b5bb26029ec7e231cf6bae",
34
+ "typeScriptVersion": "4.0"
35
35
  }