Tuesday, April 18, 2023

Dynamically loading font resources

Did you know, that fonts can be downloaded with Javascript using a new API, the CSS Font Loading API?

The API exposes 2 objects - FontFace and FontFaceSet. A FontFace represents a font. After loaded it, the font can be added to the list of available fonts (called FontFaceSet), and then can be used normally.

See example:

No comments:

Post a Comment