@mlightcad/shx-parser
Version:
A TypeScript library for parsing AutoCAD SHX font files
27 lines (26 loc) • 1.03 kB
TypeScript
import { ShxFileReader } from './fileReader';
import { ShxFontContentData, ShxFontType } from './fontData';
/**
* Splits a compiled shape entry into its optional name label and bytecode payload.
* Shape files store an uppercase name followed by a null byte before the bytecode.
* Text-font entries use a leading null byte when no name is stored.
*/
export declare function splitShapeNameAndBytecode(bytes: Uint8Array): {
name: string | null;
bytecode: Uint8Array;
};
/**
* Interface for parsing the content section of a SHX font file.
* Different font types may have different parsing implementations.
*/
export interface ShxContentParser {
/**
* Parses the content section of a SHX font file.
* @param reader - The file reader positioned at the start of the content section
* @returns The parsed font content data
*/
parse(reader: ShxFileReader): ShxFontContentData;
}
export declare class ShxContentParserFactory {
static createParser(fontType: ShxFontType): ShxContentParser;
}