Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 

ChromaCheck

ChromaCheck is a feature test to check if browsers support one of the four color font formats when loaded as webfonts through @font-face. See it in action here!

Please note that ChromaCheck currently doesn't work for Edge 18+ :-(

How it works

We test for color font support by rendering color glyphs to canvas, and then reading out the pixels to see if we have any color.

Older versions of Firefox, the first browser to support color fonts, had some bugs that needed to be circumvented. This was done by sticking the font in an SVG image, and then drawing that image on canvas. This is how ChromaCheck still works today.

How to use

Include chromacheck-min.js in your page and it'll add classes to the html element for each supported color format:

  • chromacheck-svg if there's support for OpenType-SVG.
  • chromacheck-colr if there's support for COLR.
  • chromacheck-sbix if there's support for SBIX.
  • chromacheck-cbdt if there's support for CBDT/CBLC.

Take note that this test is async, so it can take a split millisecond before the classes are added.

Known issues

  • IE11 on Windows 8 will report false negatives because of a bug in drawing SVG to canvas in IE11.
  • IE10 in Windows 8 will report false negatives because of a very strict security measure when drawing SVG to canvas.
  • CBDT/CBLC might be reported as not being supported, because ChromaCheck checks for the implementation as described by the spec. A few implementations in the wild, specifically Chrome on Android, do support CBDT/CBLC, but only when implemented with the specs during the proposal phase instead of the final specs. More info.

The SVG-on-canvas method might be replaced or extended with a non-SVG method to address the SVG related issues. Likewise it'd be possible to include two CBDT/CBLC fonts to test with: one on the old specs, one one the new. If you have a need for that right now, check out the feature/regular-test-page branch.

License

ChromaCheck is released under the MIT license.

About

Feature test for color font support in browsers

Resources

License

Releases

No releases published

Packages

No packages published