fontjs
Version:
FontJS (Font.js) is a packages for TrueType font parsing and manipulation
96 lines (95 loc) • 2.75 kB
TypeScript
import { SeqStream } from "bytestreamjs";
import { BaseClass } from "./BaseClass";
import * as Tables from "./tables";
import { Glyph, GlyphMap } from "./tables";
export declare enum ScalerTypes {
true = 1953658213,
x00010000 = 65536,
typ1 = 1954115633,
OTTO = 1330926671
}
interface FONTValues {
missingGlyph?: Tables.Glyph;
nullGlyph?: Tables.Glyph;
ascent?: number;
descent?: number;
lineGap?: number;
unitsPerEm?: number;
}
export interface FontSubsetParameters {
fontValues: FONTValues;
glyphIndexes: number[];
cmaps: Tables.CMAPType[];
cmapLanguage: number;
tables?: Map<number, BaseClass>;
}
export interface FontTTFParameters {
fontValues: FONTValues;
glyphs: Glyph[];
cmapFormat: number;
cmapLanguage: number;
tables?: Map<number, BaseClass>;
}
export interface FontParameters {
scalerType?: ScalerTypes;
searchRange?: number;
entrySelector?: number;
rangeShift?: number;
tables?: Map<any, any>;
warnings?: string[];
}
export declare class Font extends BaseClass {
scalerType: ScalerTypes;
searchRange: number;
entrySelector: number;
rangeShift: number;
tables: Map<any, any>;
warnings: string[];
private _glyphs?;
constructor(parameters?: FontParameters);
findUnicodeGlyphsMap(): GlyphMap | null;
/**
* Returns glyph by letter or unicode
* @param value One letter or unicode
*/
findUnicodeGlyph(value: string | number): Tables.Glyph | null;
toStream(stream: SeqStream, streamOffset?: number): boolean;
static fromStream(stream: SeqStream): Font;
get numGlyphs(): any;
get glyphs(): Tables.Glyph[];
get unitsPerEm(): number;
get bbox(): number[];
get italicAngle(): number;
/**
* TEST PURPOSE ONLY
*
* @param {string} value
*/
set fontFamily(value: string | null);
get fontFamily(): string | null;
/**
* TEST PURPOSE ONLY
*
* @param {string} value
*/
set postScriptName(value: string | null);
get postScriptName(): string | null;
subset(parameters?: FontSubsetParameters): Font;
static TTF(parameters?: FontTTFParameters): Font;
/**
*
* @param str
* @param platformID
* @param platformSpecificID
* @param bytes String representing bytes template ("00", "0000" etc.)
*/
stringToGIDs(str: string, platformID?: number, platformSpecificID?: number, bytes?: string | null): string[];
/**
* Return array GID (as array of GIDs) for particular string
* @param str
* @param platformID
* @param platformSpecificID
*/
stringToGIDsArray(str: string, platformID?: number, platformSpecificID?: number): any[];
}
export {};