1
0
mirror of https://github.com/lensapp/lens.git synced 2024-09-20 05:47:24 +03:00
lens/types/font-face.d.ts
2022-02-16 14:43:03 -05:00

47 lines
1.3 KiB
TypeScript

/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
export {};
declare global {
const FontFace: FontFace;
interface Document {
fonts: FontFaceSet;
}
type CSSOMString = string;
type FontFaceLoadStatus = "unloaded" | "loading" | "loaded" | "error";
type FontFaceSetStatus = "loading" | "loaded";
class FontFace implements FontFaceDescriptors {
constructor(family: string, source: string | ArrayBuffer, descriptors?: FontFaceDescriptors);
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; // might not work, throws exception
load(font: string, text?: string): Promise<FontFace[]>;
delete(font: FontFace): void;
clear(): void;
}
}