public class GlyphFont
extends java.lang.Object
Glyphs 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 and Description |
|---|
GlyphFont(java.lang.String fontName,
int defaultSize,
java.io.InputStream in)
Loads glyph font from specified
InputStream |
GlyphFont(java.lang.String fontName,
int defaultSize,
java.io.InputStream in,
boolean lazyLoad)
Loads glyph font from specified
InputStream |
GlyphFont(java.lang.String fontName,
int defaultSize,
java.lang.String urlStr)
Load glyph font from specified URL.
|
GlyphFont(java.lang.String fontName,
int defaultSize,
java.lang.String urlStr,
boolean lazyLoad)
Load glyph font from specified URL.
|
| Modifier and Type | Method and Description |
|---|---|
Glyph |
create(char character)
Creates an instance of
Glyph using specified font character |
Glyph |
create(java.lang.Enum<?> glyph)
Creates an instance of
Glyph using a known Glyph enum value |
Glyph |
create(java.lang.String glyphName)
Creates an instance of
Glyph using glyph name |
java.lang.Character |
getCharacter(java.lang.String glyphName)
Returns the character code which is mapped to this Name.
|
double |
getDefaultSize()
Returns the default font size
|
java.lang.String |
getName()
Returns font name
|
void |
register(java.lang.String name,
java.lang.Character character)
Registers the given name-character mapping
|
void |
registerAll(java.lang.Iterable<? extends INamedCharacter> namedCharacters)
Registers all given characters with their name.
|
public GlyphFont(java.lang.String fontName,
int defaultSize,
java.io.InputStream in)
InputStreamfontName - glyph font namedefaultSize - default font sizein - input stream to load the font frompublic GlyphFont(java.lang.String fontName,
int defaultSize,
java.lang.String urlStr)
fontName - glyph font namedefaultSize - default font sizeurlStr - A URL to load the font frompublic GlyphFont(java.lang.String fontName,
int defaultSize,
java.io.InputStream in,
boolean lazyLoad)
InputStreamfontName - glyph font namedefaultSize - default font sizein - input stream to load the font fromlazyLoad - If true, the font will only be loaded when accessedpublic GlyphFont(java.lang.String fontName,
int defaultSize,
java.lang.String urlStr,
boolean lazyLoad)
fontName - glyph font namedefaultSize - default font sizeurlStr - A URL to load the font fromlazyLoad - If true, the font will only be loaded when accessedpublic java.lang.String getName()
public double getDefaultSize()
public Glyph create(char character)
Glyph using specified font charactercharacter - font characterGlyphpublic Glyph create(java.lang.String glyphName)
Glyph using glyph nameglyphName - glyph namepublic Glyph create(java.lang.Enum<?> glyph)
Glyph using a known Glyph enum valueglyph - public java.lang.Character getCharacter(java.lang.String glyphName)
glyphName - public void registerAll(java.lang.Iterable<? extends INamedCharacter> namedCharacters)
namedCharacters - public void register(java.lang.String name,
java.lang.Character character)
name - character -