Top Fields Methods
com.sun.javafx.font

public Interface FontFactory

Known Direct Implementers
com.sun.javafx.font.PrismFontFactory, com.sun.prism.j2d.J2DFontFactory
Imports
java.io.InputStream

Field Summary

Modifier and TypeField and Description
public static final String

Method Summary

Modifier and TypeMethod and Description
public PGFont
createFont(String name, float size)

public PGFont
createFont(String family, boolean bold, boolean italic, float size)

public PGFont

Returns:

the new font.
deriveFont
(PGFont
the original font.
font
,
boolean
the bold style for the new font.
bold
,
boolean
the italic style fort the new font.
italic
,
float
the size for the new font.
size
)

Creates a new Font object by replicating the current Font object and applying a new bold style, italic style, and size to it.

public String[]
public String[]
public String[]
public boolean
public PGFont[]

Returns:

the Font, or null if the font cannot be created.
loadEmbeddedFont
(String
the name for font, it can be null.
name
,
InputStream
the stream from which to load the font.
stream
,
float
the size for the font.
size
,
boolean
whether the font should be register.
register
,
boolean
whether to load all fonts from a TTC
all
)

Loads a font from the specified input stream.

public PGFont[]

Returns:

the Font, or null if the font cannot be created.
loadEmbeddedFont
(String
the name for font, it can be null.
name
,
String
the path from which to load the font.
path
,
float
the size for the font.
size
,
boolean
whether the font should be register.
register
,
boolean
whether to load all fonts from a TTC
all
)

Loads a font from the specified path.

Field Detail

DEFAULT_FULLNAMEback to summary
public static final String DEFAULT_FULLNAME

Method Detail

createFontback to summary
public PGFont createFont(String name, float size)
createFontback to summary
public PGFont createFont(String family, boolean bold, boolean italic, float size)
deriveFontback to summary
public 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.

Note

bold and italic are hints.

Parameters
font:PGFont

the original font.

bold:boolean

the bold style for the new font.

italic:boolean

the italic style fort the new font.

size:float

the size for the new font.

Returns:PGFont

the new font.

getFontFamilyNamesback to summary
public String[] getFontFamilyNames()
getFontFullNamesback to summary
public String[] getFontFullNames()
getFontFullNamesback to summary
public String[] getFontFullNames(String family)
isPlatformFontback to summary
public boolean isPlatformFont(String name)
loadEmbeddedFontback to summary
public PGFont[] loadEmbeddedFont(String name, InputStream stream, float size, boolean register, boolean all)

Loads a font from the specified input stream. If the load is successful such that the stream can be fully read, and it represents a supported font format then a 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.

Parameters
name:String

the name for font, it can be null.

stream:InputStream

the stream from which to load the font.

size:float

the size for the font.

register:boolean

whether the font should be register.

all:boolean

whether to load all fonts from a TTC

Returns:PGFont[]

the Font, or null if the font cannot be created.

loadEmbeddedFontback to summary
public PGFont[] loadEmbeddedFont(String name, String path, float size, boolean register, boolean all)

Loads a font from the specified path. If the load is successful such that the location is readable, and it represents a supported font format then a 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.

Parameters
name:String

the name for font, it can be null.

path:String

the path from which to load the font.

size:float

the size for the font.

register:boolean

whether the font should be register.

all:boolean

whether to load all fonts from a TTC

Returns:PGFont[]

the Font, or null if the font cannot be created.