UNPKG

gw-canvas

Version:

Library for rendering colorized bitmap fonts. Very fast, suitable for applications where the whole canvas needs frequent redrawing.

35 lines (34 loc) 1.02 kB
declare type CTX = CanvasRenderingContext2D; declare type DrawFunction = (ctx: CTX, x: number, y: number, width: number, height: number) => void; declare type DrawType = string | DrawFunction; export interface Options { font?: string; fontSize?: number; size?: number; tileWidth?: number; tileHeight?: number; basicOnly?: boolean; basic?: boolean; } export declare class Glyphs { private _node; private _ctx; private _tileWidth; private _tileHeight; needsUpdate: boolean; private _map; static fromImage(src: string | HTMLImageElement): Glyphs; static fromFont(src: Options | string): Glyphs; private constructor(); get node(): HTMLCanvasElement; get ctx(): CanvasRenderingContext2D; get tileWidth(): number; get tileHeight(): number; get pxWidth(): number; get pxHeight(): number; forChar(ch: string): number; private _configure; draw(n: number, ch: DrawType): void; _initGlyphs(basicOnly?: boolean): void; } export {};