fontjs
Version:
FontJS (Font.js) is a packages for TrueType font parsing and manipulation
86 lines (85 loc) • 1.84 kB
TypeScript
import { BaseClass } from "../../BaseClass";
export interface CMAPSubTableParameters {
platformID?: CMAPPlatformIDs;
platformSpecificID?: number;
}
/**
* Platform IDs
* @see https://docs.microsoft.com/en-us/typography/opentype/spec/cmap#platform-ids
*/
export declare enum CMAPPlatformIDs {
/**
* Various
*/
Unicode = 0,
/**
* Script manager code
*/
Macintosh = 1,
/**
* ISO encoding
* @deprecated
*/
ISO = 2,
/**
* Windows encoding
*/
Windows = 3,
/**
* Custom
*/
Custom = 4
}
/**
* Represents CMAP subtable with language field
*/
export interface CMAPLanguage {
/**
* Language number
* @see https://docs.microsoft.com/en-us/typography/opentype/spec/cmap#use-of-the-language-field-in-cmap-subtables
*/
language: number;
}
/**
* Map <code, index>
*/
export declare type GlyphMap = Map<number, number>;
/**
* Representation of EncodingRecord
*/
export declare abstract class CMAPSubTable extends BaseClass {
/**
* Platform ID
*/
platformID: CMAPPlatformIDs;
/**
* Platform-specific encoding ID
*/
platformSpecificID: number;
/**
* Format number of CMAP subtable
*/
abstract readonly format: number;
/**
* Glyph mapping table by code
*/
private _glyphMap?;
constructor(parameters?: CMAPSubTableParameters);
static get className(): string;
/**
* Returns glyph mapping table by code
* @returns
*/
getGlyphMap(): GlyphMap;
protected abstract onGetGlyphMap(): GlyphMap;
/**
* Return character code by GID
* @param gid Glyph index (GID)
*/
code(gid: number): any[];
/**
* Return GID by character code
* @param code Character code
*/
gid(code: number): number;
}