public class Font extends Font
TYPEFACE as the Typeface and ensures
consistent font typeface across the application. It is recomended that you
use the getInstance() method or its overloaded derivatives to avoid
replication across sessions.
The following shows the recommended way to use this class:
import com.sptci.echo2.style.Extent;
import com.sptci.echo2.style.Font;
...
Font normalFont = Font.getInstance();
Font largeFont = Font.getInstance( Extent.getInstance( 14 ) );
Font boldFont = Font.getInstance( Font.BOLD );
© Copyright 2006 Sans Pareil Technologies, Inc.
Font.Typeface| Modifier and Type | Field and Description |
|---|---|
protected static Map<String,Map<String,Font>> |
cache
The cache of reusable font instances.
|
protected static Map<String,Font> |
defaultCache
The nested map used to store the fonts for the default
TYPEFACE. |
static Extent |
SIZE
The default font size to use.
|
static int |
STYLE
The default font style to use.
|
static Font.Typeface |
TYPEFACE
The application wide default typeface.
|
ARIAL, BOLD, COURIER, COURIER_NEW, HELVETICA, ITALIC, LINE_THROUGH, MONOSPACE, OVERLINE, PLAIN, SANS_SERIF, SERIF, TIMES, TIMES_NEW_ROMAN, TIMES_ROMAN, UNDERLINE, VERDANA| Constructor and Description |
|---|
Font()
Deprecated.
Use
getInstance() instead. |
Font(Extent size)
Deprecated.
Use
getInstance( Extent ) instead. |
Font(Font.Typeface typeface,
int style,
Extent size)
Deprecated.
Use
getInstance( Font.Typeface, int, Extent ) instead. |
Font(int style)
Deprecated.
Use
getInstance( int ) instead. |
Font(int style,
Extent size)
Deprecated.
Use
getInstance( int, Extent ) instead. |
| Modifier and Type | Method and Description |
|---|---|
static Font |
getInstance()
Factory method to use to retrieve the cached default font instance.
|
static Font |
getInstance(Extent size)
Factory method to use to retrieve a cached font instance.
|
static Font |
getInstance(Font.Typeface typeface,
Extent size)
Deprecated.
Warning, you are creating a non-standard font.
|
static Font |
getInstance(Font.Typeface typeface,
int style,
Extent size)
Deprecated.
Warning, you are creating a non-standard font.
|
static Font |
getInstance(int style)
Factory method to use to retrieve a cached font instance.
|
static Font |
getInstance(int style,
Extent size)
Factory method to use to retrieve a cached font instance.
|
protected static String |
getKey(Extent size)
Return a key for the extent specified.
|
protected static String |
getKey(Font.Typeface typeface)
Return a key for the
Font.Typeface
chain. |
protected static String |
getKey(int style,
Extent size)
Return a key for the style and extent specified.
|
protected static Map<String,Font> |
getMap(String typeface)
|
equals, getSize, getTypeface, isBold, isItalic, isLineThrough, isOverline, isPlain, isUnderline, toStringpublic static final Font.Typeface TYPEFACE
public static final Extent SIZE
public static final int STYLE
protected static final Map<String,Map<String,Font>> cache
Typeface values.@Deprecated public Font()
getInstance() instead.@Deprecated public Font(int style)
getInstance( int ) instead.style - The style to use for the font. Styles are usually
specified using the constants in the Font
class.@Deprecated public Font(Extent size)
getInstance( Extent ) instead.size - The font size to use.@Deprecated public Font(int style, Extent size)
getInstance( int, Extent ) instead.style - The style to use for the font. Styles are usually
specified using the constants in the Font
class.size - The font size to use.@Deprecated public Font(Font.Typeface typeface, int style, Extent size)
getInstance( Font.Typeface, int, Extent ) instead.typeface - The typeface chain to use for the font.style - The style to use for the font. Styles are usually
specified using the constants in the Font
class.size - The font size to use.public static Font getInstance()
getInstance( int, Extent )public static Font getInstance(Extent size)
Note: This method can be refactored to delegate to getInstance( Font.Typeface, Extent ), however has been left as a separate
implementation to avoid the lookup process involved in getKey(nextapp.echo2.app.Extent).
size - The font size to use.getKey( Extent ),
defaultCachepublic static Font getInstance(int style)
style - The style to use for the font. Styles are usually
specified using the constants in the Font
class.getInstance( int, Extent )public static Font getInstance(int style, Extent size)
Note: This method can be refactored to delegate to getInstance( Font.Typeface, int, Extent ), however has been left as a
separate implementation to avoid the normalisation process involved in
getKey(nextapp.echo2.app.Extent).
style - The style to use for the font. Styles are usually
specified using the constants in the Font
class.size - The font size to use.getKey( int, Extent ),
defaultCache@Deprecated public static Font getInstance(Font.Typeface typeface, Extent size)
typeface - The typeface chain to use for the font.size - The font size to use.getKey( Font.Typeface ),
getKey( Extent ),
getMap(java.lang.String)@Deprecated public static Font getInstance(Font.Typeface typeface, int style, Extent size)
typeface - The typeface chain to use for the font.style - The style to use for the font. Styles are usually
specified using the constants in the Font
class.size - The font size to use.protected static String getKey(Extent size)
size - The extent whose key is to be returned.protected static String getKey(int style, Extent size)
style - The style to use for the font.size - The extent whose key is to be returned.protected static String getKey(Font.Typeface typeface)
Font.Typeface
chain.typeface - The typeface whose key chain is to be returned.protected static Map<String,Font> getMap(String typeface)
typeface - The key for the Font.Typeface.