UNPKG

autokerning

Version:

autokerning computes suggested kerning values for glyph pairs from TrueType/OpenType fonts by rendering glyph bitmaps, applying a small Gaussian blur, and measuring pixel overlap across horizontal offsets. It can be used programmatically (as an imported E

23 lines 859 B
import * as opentype from "opentype.js"; /** * Find overlap calibration thresholds with adaptive kernel width adjustment. * Matches Python algorithm: find kernel size where min_s > max_s / 2 * @returns [minS, maxS, usedKernelWidth] */ export declare function findS(font: opentype.Font): [number, number, number]; /** * Generate kerning table for a font file. * @param fontfile Path to font file * @param outputfile Output file path (optional) * @param pairs Array of pairs to analyze (optional) */ export type GenerateKerningOptions = { pairs?: string[]; outputfile?: string; writeFile?: boolean; }; export declare function generateKerningTable(fontfile: string, opts?: GenerateKerningOptions | undefined): Promise<{ outputPath?: string; kerningTable: Record<string, number>; }>; //# sourceMappingURL=generateKerningTable.d.ts.map