GitXplorerGitXplorer
R

font-face-render-check

public
15 stars
2 forks
1 issues

Commits

List of commits on branch master.
Unverified
98f0adda9cfe44fe97f6d538aa893a37905a7add

Moved back to TTF as its supported in more browsers than WOFF

committed 11 years ago
Unverified
4ddeace53b61b76d34b9f69297ae0e0c13e320b3

Moved to WOFF, brought minified JS below 2K

RRoelN committed 11 years ago
Unverified
66259fa5c07826bfec4ca06274adfc90c7827c17

Merge branch 'master' of https://github.com/RoelN/font-face-render-check

committed 11 years ago
Unverified
039ba027d14fcbec31f6afd2ca04bde7630a457b

Added EOT to dev dir

committed 11 years ago
Unverified
d5d4a3bf76f5fdd2abd74d380ad2e57c74e8e965

Un-shaved-off some bytes of the EOT file, as that seemed to break it :(

committed 11 years ago
Unverified
e432d935388aad05a365b2faba8beaa20ea66a8f

README updated

RRoelN committed 11 years ago

README

The README file for this repository.

@Font-face render check

Detect if @font-face is supported by actually trying to render a test icon. This avoids false positives given by Internet Explorer when downloading fonts is disabled in the security settings. Use this if you want to be absolutely sure @font-face is supported, regardless of what the browser tells you.

Works on all browsers that support Javascript and TTF fonts --- and even antique IE by use of an external EOT font file.

Inspired and partly based on the solution by Paul Irish.

Read more about it here.

Usage

Because Webkit and Gecko load data-uris asynchronously, there is a small delay before @font-face support can be determined. There are two ways to use the check:

Let it add a class to the HTML tag...

If you call fontFaceCheck.support();, either a fontfacerender or a no-fontfacerender class will be added to the HTML tag.

...or catch the result in a variable

Pass a callback function as the second parameter to grab the test result:

fontFaceCheck.support( false, function(isSupported) { alert(isSupported) } );

If you want to support IE8 and below, you have to pass the path to the EOT font as the first parameter: fontFaceCheck.support('/path/to/font/'). Pass false or null and it defaults to "./".