derek1906 / jFont-Checker

This API checks for the existence of a specified font.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jFont Checker

This simple tool checks for the existence of a specified font. It ultilizes the font fallback mechanism in CSS for font checking.

Usage

Simply call checkfont, and it will return the font status in boolean:

var isTimesExist = checkfont("Times"),           //true (if exists)
    someWeirdFont = checkfont("CookieMonster");  //false

For whatever reason you need to test on a different DOM, another window for example (limited by SOP), you can pass that in too.

var win = window.open("/another_page");
checkfont("Century Gothic", win.document);

About

This API checks for the existence of a specified font.

License:MIT License


Languages

Language:JavaScript 75.9%Language:HTML 24.1%