Enum Class BrowserFontFormat

All Implemented Interfaces:
Serializable, Comparable<BrowserFontFormat>, Constable

public enum BrowserFontFormat extends Enum<BrowserFontFormat>
The various browsers and font formats to choose.

The numbers in the table specifies the first browser version that fully supports the font format.

 Font format   IE     Chrome  Firefox   Safari   Opera         
 TTF/OTF       9.0*     4.0     3.5      3.1      10.0
 WOFF          9.0      5.0     3.6      5.1      11.1
 WOFF2          no       36      39       no      26.0    Android 5.x
 SVG            no      4.0      no      3.2       9.0
 EOT           6.0       no      no       no        no

* IE: The font format only works when set to be "installable".
* Firefox: Disabled by default, but can be enabled (need to set a flag to "true" to use WOFF2).

Verified on "caniuse.com" for WOFF2, WOFF, etc support.

Christopher Mindus
  • Enum Constant Details

  • Field Details

    • formats

      public final FontFormat[] formats
      The font formats possible, in priority order.
  • Method Details

    • values

      public static BrowserFontFormat[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static BrowserFontFormat valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      name - the name of the enum constant to be returned.
      the enum constant with the specified name
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromParsedUserAgent

      public static BrowserFontFormat fromParsedUserAgent(ua_parser.Client client)
      Finds the browser font format from the parsed client user agent.
      client - The parsed client user agent instance.
      The matching browser font format.