0.0.2 • Published 7 months ago

ffont-loader v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

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'];
}