Package com.iizix.prop.font
Enum BrowserFontFormat
- java.lang.Object
- java.lang.Enum<BrowserFontFormat>
- com.iizix.prop.font.BrowserFontFormat
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<BrowserFontFormat>
public enum BrowserFontFormat extends java.lang.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.
- Author:
- Christopher Mindus
Enum Constant Summary
Enum Constants Enum Constant Description Android4_4
Android 4.4+ to 5.x.Android5
Android 5.x, browser version 40 +.AndroidOlder
Android, before 4.4.Chrome
Chrome, before version 36.Chrome2
Chrome, version 36+Firefox
Firefox, version 38-Firefox2
Firefox, version 39+.MSIE
Internet Explorer 9+.Opera
Opera, not Opera Mini (but this is skipped as Opera Mini doesn't support FontFace at all).OTHER
All other browsers, to use WOFF and then TrueTypeSafari
Safari.
Field Summary
Fields Modifier and Type Field Description FontFormat[]
formats
The font formats possible, in priority order.
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BrowserFontFormat
fromParsedUserAgent(ua_parser.Client client)
Finds the browser font format from the parsed client user agent.static BrowserFontFormat
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static BrowserFontFormat[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
Enum Constant Detail
MSIE
public static final BrowserFontFormat MSIE
Internet Explorer 9+.
Chrome2
public static final BrowserFontFormat Chrome2
Chrome, version 36+
Chrome
public static final BrowserFontFormat Chrome
Chrome, before version 36.
Android5
public static final BrowserFontFormat Android5
Android 5.x, browser version 40 +.
Android4_4
public static final BrowserFontFormat Android4_4
Android 4.4+ to 5.x.
AndroidOlder
public static final BrowserFontFormat AndroidOlder
Android, before 4.4.
Safari
public static final BrowserFontFormat Safari
Safari.
Firefox2
public static final BrowserFontFormat Firefox2
Firefox, version 39+.
Firefox
public static final BrowserFontFormat Firefox
Firefox, version 38-
Opera
public static final BrowserFontFormat Opera
Opera, not Opera Mini (but this is skipped as Opera Mini doesn't support FontFace at all).
OTHER
public static final BrowserFontFormat OTHER
All other browsers, to use WOFF and then TrueType
Field Detail
formats
public final FontFormat[] formats
The font formats possible, in priority order.
Method Detail
values
public static BrowserFontFormat[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (BrowserFontFormat c : BrowserFontFormat.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
valueOf
public static BrowserFontFormat valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.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.- Parameters:
client
- The parsed client user agent instance.- Returns:
- The matching browser font format.