|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.jeuclid.font.FontFactory
public abstract class FontFactory
Abstract factory to be used to create instances of java.awt.Font. The rationale behind this approach is that out-of-the box there is no way in java platform to load and register and internal font. In other words, Font.createFont and Font's constructor are not aware of each other.
The abstract FontFactory just provides a centralized access and extension point, delegating the actual functionality to subclasses.
How a concrete subclass of FontFactory is identified is subject to change in the future versions.
Field Summary | |
---|---|
static String |
SANSSERIF
Name for the default (sans serif) font. |
Constructor Summary | |
---|---|
FontFactory()
|
Method Summary | |
---|---|
abstract Font |
getFont(List<String> preferredFonts,
int codepoint,
int style,
float size)
Create a font object which is able to display the requested code point. |
abstract Font |
getFont(String name,
int style,
float size)
Create a font object with specified properties. |
static FontFactory |
getInstance()
Return an instance of the currently configured concrete FontFactory. |
abstract Set<String> |
listFontNames()
Retrieve a list of all fonts registered with this fontFactory. |
abstract Font |
registerFont(int format,
File fontFile)
Load an external font from a file and 'register' (aka 'cache') it for future use. |
abstract Font |
registerFont(int format,
InputStream fontStream)
Load an external font from a stream and 'register' (aka 'cache') it for future use. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String SANSSERIF
Constructor Detail |
---|
public FontFactory()
Method Detail |
---|
public static FontFactory getInstance()
public abstract Font getFont(String name, int style, float size)
name
- font name or font family namestyle
- font stylesize
- font size
Font.Font(String, int, int)
public abstract Font getFont(List<String> preferredFonts, int codepoint, int style, float size)
preferredFonts
- List of preferred fontscodepoint
- code point which must be displayablestyle
- font stylesize
- font size
public abstract Font registerFont(int format, File fontFile) throws IOException, FontFormatException
format
- font format (TTF or TYPE_1 currently supported by the
platform)fontFile
- file which contains the font
FontFormatException
- if font contained in the file doesn't match the specified
format
IOException
- in case of problem while reading the fileFont.createFont(int, File)
public abstract Font registerFont(int format, InputStream fontStream) throws IOException, FontFormatException
format
- font format (TTF or TYPE_1 currently supported by the
platform)fontStream
- file which contains the font
FontFormatException
- if font contained in the stream doesn't match the specified
format
IOException
- in case of problem while reading the streamFont.createFont(int, InputStream)
public abstract Set<String> listFontNames()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |