npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jquery-fontspy

v3.0.0

Published

jQuery-FontSpy.js works by checking the change in width of a string. Courier New is used as the font to compare against as it is one of the most widely distrubuted default fonts. Using a very large font-size, we are able to determine even the slightest ch

Downloads

1,563

Readme

jQuery-FontSpy.js

Style your @font-face elements while they load or upon catastrophic failure.

jQuery-FontSpy.js works by checking the change in width of a string. Courier New is used as the font to compare against as it is one of the most widely distrubuted default fonts. Using a very large font-size, we are able to determine even the slightest change. When the width of the string changes, we know that the custom font-face file has been loaded and applied.

Install:

Grab it with Bower: bower install fontspy

Usage:

fontSpy('My Icons', {
  glyphs: '\ue81a\ue82d\ue823',
  success: function() {
    //alert("My Icons loaded successfully");
  },
  failure: function() {
    //alert("My Icons failed to load");
  }
});

The first argument passed to fontSpy is the name of the font-family. This is used to style the test string when checking width changes.

The second argument is for options that can be passed to jQuery-FontSpy.

If a custom font is loaded, a class with the font name is added to the html element. If a custom font fails to load, a class with the font name prefixed with no- is add to the HTML element.

Font names are converted to lowercase and spaces are removed when converted to class names to be used on the HTML element. For example, the font name, My Icons will render as myicons when used an HTML class.

Options

glyphs: If your font is mapped to PUA characters, you can pass a few of the glyphs contained in the custom font. We measure these characters to make sure the font has loaded successfully.

success: If the font specified as in the first arguement passed to fontSpy loads, you can excute custom JavaScript here.

failure: If the font specified as in the first arguement passed to fontSpy fails to load, you can excute custom JavaScript here.

Browser Support

fontcheck has been tested and works in the following environments.

  • Chrome 40
  • Firefox 35
  • Safari 7.1
  • Internet Explorer 8, 9, 10, 11
  • Android 4.4.4 Stock Browser
  • iOS Safari 8.1