mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
[opentype.js] add annotations for BoundingBox and some tests, finish prev todo
This commit is contained in:
Vendored
+13
-2
@@ -367,8 +367,19 @@ export interface PathCommand {
|
||||
* UTIL CLASSES
|
||||
******************************************/
|
||||
|
||||
export type BoundingBox = () => any;
|
||||
// TODO add methods
|
||||
export class BoundingBox {
|
||||
x1: number;
|
||||
y1: number;
|
||||
x2: number;
|
||||
y2: number;
|
||||
|
||||
isEmpty(): boolean;
|
||||
addPoint(x: number, y: number): void;
|
||||
addX(x: number): void;
|
||||
addY(y: number): void;
|
||||
addBezier(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x: number, y: number): void;
|
||||
addQuad(x0: number, y0: number, x1: number, y1: number, x: number, y: number): void;
|
||||
}
|
||||
|
||||
export interface Encoding {
|
||||
charset: string;
|
||||
|
||||
@@ -113,6 +113,8 @@ aPath.extend(aPath);
|
||||
aPath.extend(aPath.commands);
|
||||
aPath.extend(aPath.getBoundingBox());
|
||||
const pathBBox: opentype.BoundingBox = aPath.getBoundingBox();
|
||||
pathBBox.addQuad(1, 1, 1, 1, 1, 1);
|
||||
const yDist = pathBBox.y2 - pathBBox.y1;
|
||||
aPath.draw(ctx);
|
||||
const pathData: string = aPath.toPathData(7);
|
||||
const pathSvg: string = aPath.toSVG(7);
|
||||
|
||||
Reference in New Issue
Block a user