@mlightcad/shx-parser
Version:
A TypeScript library for parsing AutoCAD SHX font files
40 lines (39 loc) • 1.25 kB
TypeScript
import { Point } from './point';
/**
* Represents a shape defined by a collection of polylines and an optional last point.
* Used to describe the geometry of a character in the SHX font.
*/
export declare class ShxShape {
/** The last point in the shape's geometry, if any */
readonly lastPoint?: Point;
/** Array of polylines, where each polyline is an array of points */
readonly polylines: Point[][];
constructor(lastPoint?: Point, polylines?: Point[][]);
/**
* Get the bounding box of the shape
* @returns Bounding box of the shape
*/
get bbox(): {
minX: number;
minY: number;
maxX: number;
maxY: number;
};
/**
* Offset the shape by a point
* @param p The point to offset the shape by
* @param isNewInstance Whether to return a new instance of the shape or modify the current instance
* @returns The offset shape
*/
offset(p: Point, isNewInstance?: boolean): ShxShape;
/**
* Converts the shape to an SVG string
* @param options SVG rendering options
* @returns SVG string
*/
toSVG(options?: {
strokeWidth?: string;
strokeColor?: string;
isAutoFit?: boolean;
}): string;
}