Module
Web.Font.Loading
- Package
- purescript-web-font-loading
- Repository
- rowtype-yoga/purescript-web-font-loading
Bindings to the CSS Font Loading API in documents and workers.
The browser only guarantees a requested font face is available to draw with
once it has been loaded; loadFont resolves when the matching faces are
ready, so a caller can repaint with the real face instead of a fallback.
#FontShorthand Source
newtype FontShorthandA CSS font shorthand, as accepted by document.fonts.load and the 2D
context font property, e.g. 800 144px "Sinistre", serif.
Constructors
Instances
#loadFont Source
loadFont :: FontShorthand -> Aff UnitLoad the font faces matching a shorthand, resolving once they are usable. Resolves immediately when the Font Loading API is unavailable (e.g. SSR).
#fontsReady Source
fontsReady :: Aff UnitResolves once every pending font in the document has settled.
#checkFont Source
checkFont :: FontShorthand -> Effect BooleanNative font checks require an available font set; callers choose fallback
policy by querying hasFontSet first.
#newFontFace Source
newFontFace :: String -> ArrayBuffer -> { display :: String, weight :: String } -> Effect FontFace