|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnextapp.echo2.app.Font
com.sptci.echo2.style.Font
public class Font
A custom font class to use in styles. This class by default uses
TYPEFACE as the Font.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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class nextapp.echo2.app.Font |
|---|
Font.Typeface |
| Field Summary | |
|---|---|
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. |
| Fields inherited from class nextapp.echo2.app.Font |
|---|
ARIAL, BOLD, COURIER, COURIER_NEW, HELVETICA, ITALIC, LINE_THROUGH, MONOSPACE, OVERLINE, PLAIN, SANS_SERIF, SERIF, TIMES, TIMES_NEW_ROMAN, TIMES_ROMAN, UNDERLINE, VERDANA |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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)
Return the embedded Map value in cache. |
| Methods inherited from class nextapp.echo2.app.Font |
|---|
equals, getSize, getTypeface, isBold, isItalic, isLineThrough, isOverline, isPlain, isUnderline, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Font.Typeface TYPEFACE
public static final Extent SIZE
public static final int STYLE
protected static final Map<String,Map<String,Font>> cache
Font.Typeface values.
protected static final Map<String,Font> defaultCache
TYPEFACE.
| Constructor Detail |
|---|
@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.| Method Detail |
|---|
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
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)
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)
Map value in cache.
typeface - The key for the Font.Typeface.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||