has-font

1.0.2 • Public • Published

hasFont.js

A simple script to check that the user has the font or not. It's vanilla JavaScript, no dependency required.

You can see it in action here: https://codincat.github.io/hasFont.js/

Usage

npm install --save has-font

or

<script type="text/javascript" src="hasfont.min.js"></script>
import hasFont from 'has-font'
 
// hasFont(fontNameString)
 
if (hasFont('monaco')) {
  element.style.fontSize = '10px'
} else {
  element.style.fontSize = '12px'
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    7
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    7
  • 1.0.1
    1
  • 1.0.0
    1

Package Sidebar

Install

npm i has-font

Weekly Downloads

9

Version

1.0.2

License

none

Last publish

Collaborators

  • codincat