gemini-viewer-examples
gemini-viewer-examples copied to clipboard
How does the dxf shx font file handle display? Do you have any tips or codes related to this
How does the dxf shx font file handle display? Do you have any tips or codes related to this
Shx font file will be parsed to line segments then display. Is this what you want to know?
I want to use the shx parse library or code ...
The viewer sets font files like this:
const fontFiles = ["libs/fonts/simplex.shx", "libs/fonts/hztxt.shx"];
await viewer.setFont(fontFiles);
You can find some code from https://www.npmjs.com/package/@pattern-x/gemini-viewer-threejs?activeTab=code
export declare class ShxFont extends BaseFont {
isExtend: boolean;
isUniCode: boolean;
isEmbedded: boolean;
static DEFAULT_SIZE: number;
fontType: ShxFontType;
private textShapesCache;
private graphicData;
constructor(fileName: string, fileData: ArrayBuffer | FontDataTableRecord);
generateShapes(text: string, size: number): TextShape[];
/**
* Gets TextShape by a char
*/
getCharShape(char: string, size: number): TextShape | undefined;
/**
* Gets TextShape by a char code
*/
getGraphicDataByCode(code: number, size: number): TextShape | undefined;
/**
* Gets TextShape by char's code, font size and offset
*/
getGraphicDataByCodeWithOffset(code: number, size: number, translate: THREE.Vector2): TextShape | undefined;
private parseBigFont;
private parseUniFont;
private parseShapeFont;
/**
* For an unsupported char, use "?" as a replacement.
*/
getNotFoundTextShape(size: number): TextShape | undefined;
protected getFontFile(): {
fontType: ShxFontType;
order: number;
data: any;
info: string;
orientation: import("./shx/Shx.constants").Orientation;
baseUp: number;
baseDown: number;
fileName: string;
fileHeader: string;
fileVersion: string;
};
setFontFile(data: FontDataTableRecord): void;
releaseFontData(): void;
}