Webfont Compression

The Webfont Compression allows to dynamically rewrite @font-face CSS rules for webfonts.

In case a TrueType font, but no WOFF2 or WOFF font is referenced in the @font-face rule, entries for WOFF2 and WOFF are added in front of the TrueType entry to ensure browsers supporting the WOFF2 or WOFF formats will choose one of them instead of the TrueType format.

In case a WOFF and a TrueType font, but no WOFF2 font is referenced in the @font-face rule, an entry for WOFF2 is added in front of the WOFF entry to ensure browsers supporting the WOFF2 format will choose it instead of the WOFF format.

Webfont compression does not affect data URIs in src descriptors of @font-face CSS rules.

The generated font file is created by the FIT server from the original TrueType (1st choice) or WOFF (2nd choice) file. This action is only attempted on files that are positively identified as TrueType or WOFF. All other filetypes are passed through to the browser without change.

A WOFF2 font file is typically about 20% smaller than the corresponding WOFF file.

For this feature to work properly, all fonts referenced in a @font-face rule must provide glyphs for the same set of characters. Otherwise the browser may try to get a non-existent glyph.

Usage

To use Webfont Compression, webfont-compression must be turned on via the following conf/config.xml entry:

<config>
  <acceleration>
    <webfont-compression />
  </acceleration>
</config>