public abstract class PrismFontFactory extends Object implements FontFactory
Modifier and Type | Field and Description |
---|---|
static int |
cacheLayoutSize |
static boolean |
debugFonts |
static boolean |
isAndroid |
static boolean |
isEmbedded |
static boolean |
isIOS |
static boolean |
isLinux |
static boolean |
isMacOSX |
static boolean |
isWindows |
static int |
SUB_PIXEL_NATIVE |
static int |
SUB_PIXEL_ON |
static int |
SUB_PIXEL_Y |
DEFAULT_FULLNAME
Constructor and Description |
---|
PrismFontFactory() |
Modifier and Type | Method and Description |
---|---|
PGFont |
createFont(String familyName,
boolean bold,
boolean italic,
float size) |
PGFont |
createFont(String name,
float size) |
protected abstract PrismFontFile |
createFontFile(String name,
String filename,
int fIndex,
boolean register,
boolean embedded,
boolean copy,
boolean tracked) |
abstract GlyphLayout |
createGlyphLayout() |
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.
|
static PrismFontFactory |
getFontFactory() |
String[] |
getFontFamilyNames() |
String[] |
getFontFullNames() |
String[] |
getFontFullNames(String family) |
FontResource |
getFontResource(String familyName,
boolean bold,
boolean italic,
boolean wantComp) |
FontResource |
getFontResource(String name,
String file,
boolean wantComp) |
static float |
getFontSizeLimit() |
static float |
getLCDContrast() |
int |
getSubPixelMode() |
static String |
getSystemFont(String name) |
static float |
getSystemFontSize() |
boolean |
hasPermission() |
static boolean |
isJreFont(FontResource fr) |
boolean |
isLCDTextSupported() |
boolean |
isPlatformFont(String name) |
PGFont |
loadEmbeddedFont(String name,
InputStream fontStream,
float size,
boolean register)
Loads a font from the specified input stream.
|
PGFont |
loadEmbeddedFont(String name,
String path,
float size,
boolean register)
registerEmbeddedFont(String name, String path) is a small subset of
registerEmbeddedFont(String name, InputStream fontStream)
It does not attempt to create a temporary file and has different
parameters.
|
protected boolean |
registerEmbeddedFont(String path) |
int |
test_getNumEmbeddedFonts() |
public static final boolean debugFonts
public static final boolean isWindows
public static final boolean isLinux
public static final boolean isMacOSX
public static final boolean isIOS
public static final boolean isAndroid
public static final boolean isEmbedded
public static final int cacheLayoutSize
public static final int SUB_PIXEL_ON
public static final int SUB_PIXEL_Y
public static final int SUB_PIXEL_NATIVE
public static float getFontSizeLimit()
public static PrismFontFactory getFontFactory()
protected abstract PrismFontFile createFontFile(String name, String filename, int fIndex, boolean register, boolean embedded, boolean copy, boolean tracked) throws Exception
Exception
public abstract GlyphLayout createGlyphLayout()
public FontResource getFontResource(String familyName, boolean bold, boolean italic, boolean wantComp)
public PGFont createFont(String familyName, boolean bold, boolean italic, float size)
createFont
in interface FontFactory
public PGFont createFont(String name, float size)
createFont
in interface FontFactory
public PGFont deriveFont(PGFont font, boolean bold, boolean italic, float size)
FontFactory
NOTE: bold and italic are hints.
deriveFont
in interface FontFactory
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.public FontResource getFontResource(String name, String file, boolean wantComp)
public String[] getFontFamilyNames()
getFontFamilyNames
in interface FontFactory
public String[] getFontFullNames()
getFontFullNames
in interface FontFactory
public String[] getFontFullNames(String family)
getFontFullNames
in interface FontFactory
public final int getSubPixelMode()
public boolean isLCDTextSupported()
public boolean isPlatformFont(String name)
isPlatformFont
in interface FontFactory
public static boolean isJreFont(FontResource fr)
public static float getLCDContrast()
public PGFont loadEmbeddedFont(String name, InputStream fontStream, float size, boolean register)
FontFactory
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.
loadEmbeddedFont
in interface FontFactory
name
- the name for font, it can be null
.fontStream
- the stream from which to load the font.size
- the size for the font.register
- whether the font should be register.public PGFont loadEmbeddedFont(String name, String path, float size, boolean register)
loadEmbeddedFont
in interface FontFactory
name
- font namepath
- Path name to system filesize
- font sizeregister
- whether the font should be registered.protected boolean registerEmbeddedFont(String path)
public int test_getNumEmbeddedFonts()
public final boolean hasPermission()
hasPermission
in interface FontFactory
public static float getSystemFontSize()
Copyright © 2020. All rights reserved.