java.lang.Object
org.controlsfx.glyphfont.GlyphFont
- Direct Known Subclasses:
FontAwesome
Represents a glyph font, which can be loaded locally or from a specified URL.

Glyph
s can be created easily using specified character defined in the
font. For example, \uf013 in FontAwesome is used to represent
a gear icon.
To simplify glyph customization, methods can be chained, for example:
Glyph glyph = fontAwesome.create('\uf013').size(28).color(Color.RED); //GEAR
Here's a screenshot of two font packs being used to render images into
JavaFX Button controls:

-
Constructor Summary
ConstructorsConstructorDescriptionGlyphFont
(String fontName, int defaultSize, InputStream in) Loads glyph font from specifiedInputStream
GlyphFont
(String fontName, int defaultSize, InputStream in, boolean lazyLoad) Loads glyph font from specifiedInputStream
Load glyph font from specified URL.Load glyph font from specified URL. -
Method Summary
Modifier and TypeMethodDescriptioncreate
(char character) Creates an instance ofGlyph
using specified font characterCreates an instance ofGlyph
using a known Glyph enum valueCreates an instance ofGlyph
using glyph namegetCharacter
(String glyphName) Returns the character code which is mapped to this Name.double
Returns the default font sizegetName()
Returns font namevoid
Registers the given name-character mappingvoid
registerAll
(Iterable<? extends INamedCharacter> namedCharacters) Registers all given characters with their name.
-
Constructor Details
-
GlyphFont
Loads glyph font from specifiedInputStream
- Parameters:
fontName
- glyph font namedefaultSize
- default font sizein
- input stream to load the font from
-
GlyphFont
Load glyph font from specified URL. Example for a local file: "file:///C:/Users/Bob/Fonts/icomoon.ttf" "file:///Users/Bob/Fonts/icomoon.ttf"- Parameters:
fontName
- glyph font namedefaultSize
- default font sizeurlStr
- A URL to load the font from
-
GlyphFont
Loads glyph font from specifiedInputStream
- Parameters:
fontName
- glyph font namedefaultSize
- default font sizein
- input stream to load the font fromlazyLoad
- If true, the font will only be loaded when accessed
-
GlyphFont
Load glyph font from specified URL. Example for a local file: "file:///C:/Users/Bob/Fonts/icomoon.ttf" "file:///Users/Bob/Fonts/icomoon.ttf"- Parameters:
fontName
- glyph font namedefaultSize
- default font sizeurlStr
- A URL to load the font fromlazyLoad
- If true, the font will only be loaded when accessed
-
-
Method Details
-
getName
Returns font name- Returns:
- font name
-
getDefaultSize
public double getDefaultSize()Returns the default font size- Returns:
- default font size
-
create
Creates an instance ofGlyph
using specified font character- Parameters:
character
- font character- Returns:
- instance of
Glyph
-
create
Creates an instance ofGlyph
using glyph name- Parameters:
glyphName
- glyph name- Returns:
- glyph by its name or null if name is not found
-
create
Creates an instance ofGlyph
using a known Glyph enum value- Parameters:
glyph
-
-
getCharacter
Returns the character code which is mapped to this Name. If no match is found, NULL is returned.- Parameters:
glyphName
-
-
registerAll
Registers all given characters with their name.- Parameters:
namedCharacters
-
-
register
Registers the given name-character mapping- Parameters:
name
-character
-
-