ffont-loader
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i ffont-loader

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

32.8 kB

Total Files

16

Last publish

Collaborators

  • hzpeng