2021-06-17 10:43:55 +00:00
|
|
|
type CSSOMString = string
|
|
|
|
type FontFaceLoadStatus = 'unloaded' | 'loading' | 'loaded' | 'error'
|
|
|
|
type FontFaceSetStatus = 'loading' | 'loaded'
|
|
|
|
|
|
|
|
interface FontFace {
|
|
|
|
family: CSSOMString
|
|
|
|
style: CSSOMString
|
|
|
|
weight: CSSOMString
|
|
|
|
stretch: CSSOMString
|
|
|
|
unicodeRange: CSSOMString
|
|
|
|
variant: CSSOMString
|
|
|
|
featureSettings: CSSOMString
|
|
|
|
variationSettings: CSSOMString
|
|
|
|
display: CSSOMString
|
|
|
|
readonly status: FontFaceLoadStatus
|
|
|
|
readonly loaded: Promise<FontFace>
|
|
|
|
load(): Promise<FontFace>
|
|
|
|
}
|
|
|
|
|
|
|
|
interface FontFaceSet {
|
|
|
|
readonly status: FontFaceSetStatus
|
|
|
|
readonly ready: Promise<FontFaceSet>
|
2021-06-21 21:35:28 +00:00
|
|
|
check(font: string, text?: string): boolean
|
2021-06-17 10:43:55 +00:00
|
|
|
load(font: string, text?: string): Promise<FontFace[]>
|
|
|
|
}
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
interface Document {
|
|
|
|
fonts: FontFaceSet
|
|
|
|
}
|
|
|
|
}
|