public interface FontFactory
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_FULLNAME |
Modifier and Type | Method and Description |
---|---|
PGFont |
createFont(String family,
boolean bold,
boolean italic,
float size) |
PGFont |
createFont(String name,
float size) |
PGFont |
deriveFont(PGFont font,
boolean bold,
boolean italic,
float size)
Creates a new Font object by replicating the current Font object
and applying a new bold style, italic style, and size to it.
|
String[] |
getFontFamilyNames() |
String[] |
getFontFullNames() |
String[] |
getFontFullNames(String family) |
boolean |
hasPermission() |
boolean |
isPlatformFont(String name) |
PGFont |
loadEmbeddedFont(String name,
InputStream stream,
float size,
boolean register)
Loads a font from the specified input stream.
|
PGFont |
loadEmbeddedFont(String name,
String path,
float size,
boolean register)
Loads a font from the specified path.
|
static final String DEFAULT_FULLNAME
PGFont deriveFont(PGFont font, boolean bold, boolean italic, float size)
NOTE: bold and italic are hints.
font
- the original font.bold
- the bold style for the new font.italic
- the italic style fort the new font.size
- the size for the new font.String[] getFontFamilyNames()
String[] getFontFullNames()
boolean hasPermission()
PGFont loadEmbeddedFont(String name, InputStream stream, float size, boolean register)
PGFont
object will be returned.
Any failure such as abbreviated input, or an unsupported font format
will result in a null
return. It is the application's
responsibility to check this before use.
If the register
flag is true, and the loading operation
completes successfully, then the returned font is registered
with the FX graphics system for creation by available constructors
and factory methods, and the application should use it in this
manner rather than calling this method again, which would
repeat the overhead of re-reading and installing the font.
When the font is registered, an alternative name
can be
supplied. This name can be used for creation by available constructors
and factory methods.
The font size
parameter is a convenience so that in
typical usage the application can directly use the returned (non-null)
font rather than needing to create one via a constructor. Invalid sizes
are those <=0 and will result in a default size.
This method does not close the input stream.
name
- the name for font, it can be null
.stream
- the stream from which to load the font.size
- the size for the font.register
- whether the font should be register.PGFont loadEmbeddedFont(String name, String path, float size, boolean register)
PGFont
object will be returned.
Any failure such as a file being unable to locate or read
from the resource, or if it doesn't represent a font, will result in
a null
return. It is the application's responsibility
to check this before use.
If the register
flag is true, and the loading operation
completes successfully, then the returned font is registered
with the FX graphics system for creation by available constructors
and factory methods, and the application should use it in this
manner rather than calling this method again, which would
repeat the overhead of re-reading and installing the font.
When the font is registered, an alternative name
can be
supplied. This name can be used for creation by available constructors
and factory methods.
The font size
parameter is a convenience so that in
typical usage the application can directly use the returned (non-null)
font rather than needing to create one via a constructor. Invalid sizes
are those <=0 and will result in a default size.
name
- the name for font, it can be null
.path
- the path from which to load the font.size
- the size for the font.register
- whether the font should be register.boolean isPlatformFont(String name)
Copyright © 2020. All rights reserved.