com.vaadin.server.
Class GenericFontIcon
- java.lang.Object
-
- com.vaadin.server.GenericFontIcon
-
-
Constructor Summary
Constructors Constructor Description GenericFontIcon(String fontFamily, int codepoint)
Creates a new instance of GenericFontIcon with given font family and codepoint.
-
Method Summary
All Methods Modifier and Type Method Description boolean
equals(Object obj)
int
getCodepoint()
Returns the unicode codepoint (character location) for this icon within the font given in
FontIcon.getFontFamily()
.String
getFontFamily()
Returns the name (font family) of the font from which this icon comes.
String
getHtml()
Returns HTML that can be used to display the icon in places where HTML can be used, such as a
Label
withContentMode.HTML
.static String
getHtml(String fontFamily, int codePoint)
Utility method for generating HTML that displays an icon from specific fontFamiliy with a given codePoint in the font.
String
getMIMEType()
Gets the MIME type of the resource.
int
hashCode()
-
-
-
Constructor Detail
-
GenericFontIcon
public GenericFontIcon(String fontFamily, int codepoint)
Creates a new instance of GenericFontIcon with given font family and codepoint.
Parameters:
fontFamily
- Name of the type face that is used to display iconscodepoint
- Numerical code point in the font
-
-
Method Detail
-
getFontFamily
public String getFontFamily()
Description copied from interface:
FontIcon
Returns the name (font family) of the font from which this icon comes. The name is used to apply the correct font where the icon is used.
Specified by:
getFontFamily
in interfaceFontIcon
Returns:
-
getMIMEType
public String getMIMEType()
Description copied from interface:
Resource
Gets the MIME type of the resource.
Specified by:
getMIMEType
in interfaceResource
Returns:
the MIME type of the resource.
-
getCodepoint
public int getCodepoint()
Description copied from interface:
FontIcon
Returns the unicode codepoint (character location) for this icon within the font given in
FontIcon.getFontFamily()
.For example, 0x0021 would in a regular font be the codepoint for the exclamation-point character.
When constructing icon fonts, it might be a good idea to use the codepoints in the "Private use area", from 0xE000 0xF8FF.Specified by:
getCodepoint
in interfaceFontIcon
Returns:
-
getHtml
public String getHtml()
Description copied from interface:
FontIcon
Returns HTML that can be used to display the icon in places where HTML can be used, such as a
Label
withContentMode.HTML
.
-
getHtml
public static String getHtml(String fontFamily, int codePoint)
Utility method for generating HTML that displays an icon from specific fontFamiliy with a given codePoint in the font.
Parameters:
fontFamily
- Name of the font familycodePoint
- Icon's character code point in the fontReturns:
-
-