mathpix-markdown-it
Version:
Mathpix-markdown-it is an open source implementation of the mathpix-markdown spec written in Typescript. It relies on the following open source libraries: MathJax v3 (to render math with SVGs), markdown-it (for standard Markdown parsing)
27 lines (26 loc) • 696 B
TypeScript
import { Font } from "opentype.js";
export interface IFontMetricsOptions {
font: ArrayBuffer;
fontBold?: ArrayBuffer;
fontSize?: number;
ex?: number;
fontWeight?: eFontType;
}
export declare enum eFontType {
normal = "normal",
bold = "bold"
}
export declare class FontMetrics {
font: Font;
fontBold: Font;
fontSize: number;
ex: number;
fontWeight: eFontType;
constructor();
loadFont(options: IFontMetricsOptions): void;
isFontLoaded(): boolean;
private getGlyph;
getWidth(text: string, fontType?: eFontType): number;
getWidthInEx(text: string, fontType?: eFontType): number;
}
export declare const fontMetrics: FontMetrics;