ffont-loader
v0.0.2
Published
Dynamic custom font loader for JavaScript.
Downloads
12
Readme
ffont-loader
A tool used to load fonts.
install
npm install --save ffont-loader
or
yarn install ffont-loader
Then
// using ES6 modules
import loadFont from 'ffont-loader';
// using CommonJS modules
var loadFont = require('ffont-loader')
Usage
import loadFont from 'ffont-loader';
const fontFamily = 'Custom Font';
loadFont({
source: 'https://xxx.ttf',
family: fontFamily,
}).then(() => {
document.body.style.fontFamily = fontFamily;
})
Optios
interface Options {
source: string;
family: FontFace['family'];
target?: HTMLElement;
display?: FontFace['display'];
style?: FontFace['style'];
weight?: FontFace['weight'];
stretch?: FontFace['stretch'];
unicodeRange?: FontFace['unicodeRange'];
variant?: FontFace['variant'];
featureSettings?: FontFace['featureSettings'];
}