tsxna-framework
Version:
A simple TypeScript Game Framework
42 lines (36 loc) • 1.17 kB
text/typescript
export {}
declare global {
const FontFace: FontFace;
interface Document {
fonts: FontFaceSet
}
type CSSOMString = string;
type FontFaceLoadStatus = 'unloaded' | 'loading' | 'loaded' | 'error';
type FontFaceSetStatus = 'loading' | 'loaded';
interface FontFace extends FontFaceDescriptors {
new(family: string, source: string | ArrayBuffer, descriptors?: FontFaceDescriptors): FontFace;
readonly status: FontFaceLoadStatus;
readonly loaded: Promise<FontFace>;
variationSettings: CSSOMString;
display: CSSOMString;
load(): Promise<FontFace>;
}
interface FontFaceDescriptors {
family: CSSOMString;
style: CSSOMString;
weight: CSSOMString;
stretch: CSSOMString;
unicodeRange: CSSOMString;
variant: CSSOMString;
featureSettings: CSSOMString;
}
interface FontFaceSet extends Iterable<FontFace> {
readonly status: FontFaceSetStatus;
readonly ready: Promise<FontFaceSet>;
add(font: FontFace): void;
check(font: string, text?: string): Boolean; // throws exception
load(font: string, text?: string): Promise<FontFace[]>
delete(font: FontFace): void;
clear(): void;
}
}