|
EchoPoint API - 3.0.0b5 App Webcontainer |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectechopoint.util.FontKit
public class FontKit
A utility to class to help with Font manipulation
| Method Summary | |
|---|---|
static void |
addBold(Component c)
Adds bold to a Component's font. |
static Font |
addBold(Font font)
Adds the Font.BOLD attribute to an exisitng Font object and returns a new Font. |
static void |
addItalic(Component c)
Adds italic to a Component's font. |
static Font |
addItalic(Font font)
Adds the Font.ITALIC attribute to an exisitng Font object and returns a new Font. |
static void |
addSize(Component c,
int sizeDelta)
Sets a component's font smaller or large by the specified delta amount. |
static Font |
addSize(Font font,
int sizeDelta)
Makes a font smaller or larger by adding the specified amount to its current font size. |
static void |
addStyle(Component c,
int style)
Adds the specified style to a Component's font. |
static Font |
addStyle(Font font,
int style)
Adds the specified style to the Font
and returns a new Font. |
static void |
addUnderline(Component c)
Adds underline to a Component's font. |
static Font |
addUnderline(Font font)
Adds the Font.UNDERLINE attribute to an exisitng Font object and returns a new Font. |
static Font |
findFont(Component comp)
Searchs the heirarchy tree of the component and finds the first non null Font object. |
static Font |
font(String fontString)
Shortcut synonym for makeFont(fontString); |
static Font.Typeface |
getSystemTypeface(String name)
Returns one the standard Echo Font.Typefaces if the name string matches the first Typeface in the chain. |
static boolean |
isFont(String fontString)
Returns true if the fontString is a valid
representation of a Font value. |
static Font |
makeAwtFont(Font echoFont,
Font awtDefaultFont)
Creates an AWT font object from a Echo font object. |
static String |
makeCSSFont(Font font)
Makes a W3C CSS font string in the special format fontstyle, fontsize, fontnames |
static Font |
makeFont(String fontString)
Returns the Font value of the given Font string representation. |
static String |
makeFontString(Font font)
Makes a string representation of a font in the format font(fontName, fontStyle, fontSize) where : fontName - is a font name such as 'Verdana' or 'Times New Roman'. |
static Font.Typeface |
makeTypeface(String typeFaceNames)
This will return a Font.Typeface object by first rtying to match the names against System provided ones and failing that it will create a font.Typeface for you. |
static void |
setBold(Component c)
Sets Component's font to bold. |
static void |
setItalic(Component c)
Sets Component's font to italic. |
static Font |
setName(Font font,
String fontName)
Returns a new Font object, based on font, that
has the specified fontName. |
static Font |
setNames(Font font,
Font.Typeface typeFace)
Returns a new Font object, based on font, that
has the specified typeFace. |
static void |
setSize(Component c,
int size)
Sets the size of a Component's font. |
static Font |
setSize(Font font,
int size)
Returns a new Font object, based on font, that
has the specified size. |
static Font |
setStyle(Font font,
int style)
Returns a new Font object, based on font, that
has the specified style. |
static void |
setUnderline(Component c)
Sets Component's font to underline. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Font makeAwtFont(Font echoFont,
Font awtDefaultFont)
echoFont - - the nextapp.echo2.app.Font object to convertawtDefaultFont - - a default AWT font to use if the conversion cant be done.
public static String makeCSSFont(Font font)
fontstyle, fontsize, fontnames
font - - the font to represent as a W3C CSS string
public static void addBold(Component c)
If the component has no font, a findFont is performed and
the result is set in as the font.
c - - the component in questionaddBold(Font)public static void addItalic(Component c)
If the component has no font, a findFont is performed and
the result is set in as the font.
c - - the component in questionaddItalic(Font)public static void addUnderline(Component c)
If the component has no font, a findFont is performed and
the result is set in as the font.
c - - the component in questionaddUnderline(Font)
public static void addStyle(Component c,
int style)
style to a Component's font.
If the component has no font, a findFont is performed and
the result is set in as the font.
c - - the component in questionaddStyle(Font, int)
public static void addSize(Component c,
int sizeDelta)
If the component has no font, a findFont is performed and
the result is set in as the font.
c - - the component in questionsizeDelta - - a positive or negative delta amountaddSize(Font, int)public static void setBold(Component c)
If the component has no font, a findFont is performed and
the result is set in as the font.
c - - the component in questionsetStyle(Font, int)public static void setItalic(Component c)
If the component has no font, a findFont is performed and
the result is set in as the font.
c - - the component in questionsetStyle(Font, int)public static void setUnderline(Component c)
If the component has no font, a findFont is performed and
the result is set in as the font.
c - - the component in questionsetStyle(Font, int)
public static void setSize(Component c,
int size)
If the component has no font, a findFont is performed and
the result is set in as the font.
c - - the component in questionsize - - the new font sizesetSize(Font, int)public static Font findFont(Component comp)
Font(Font.SANS_SERIF,Font.PLAIN,new Extent(10,Extent.PT)
if no ancestor components have a Font set.
public static Font makeFont(String fontString)
The allowable forms are :
- fontName,fontStyle,fontSize
- font( fontName, fontStyle, fontSize)
where
fontName - eg. Verdana or 'Times New Roman'.
If multiple font names are specified or there is
white space in the font name, then it must be enclosed
in single quotes and commas eg. 'Verdana, Times New Roman, Tahoma'.
fontStyle - PLAIN|BOLD|ITALIC|UNDERLINE|OVERLINE|LINETHROUGH or nothing! (this is case insenstive)
fontSize - an integer size value or an Extent value. (In the case where
only an integer is specified, the default Extent units
are points (pt).
Examples :
Verdana,,9 - is a legal font string
Verdana,PLAIN,9 - is a legal font string
Verdana,plain,9 - is a legal font string
Verdana,plain,9em - is a legal font string
Verdana,plain,9pt - is a legal font string
Verdana,bold|italic,9 - is a legal font string
'Times New Roman',plain,9 - is a legal font string
'Verdana, Times New Roman',plain,9 - is a legal font string
font(Verdana,,9) - is a legal font string
font(Verdana,PLAIN,9pt) - is a legal font string
font(Verdana,plain,9) - is a legal font string
font(Verdana,bold|italic,9em) - is a legal font string
font('Verdana, Times New Roman',plain,9) - is a legal font string
Verdana, 3, 9 - is an ILLEGAL font string
Verdana, Times New Roman,PLAIN,9 - is an ILLEGAL font string
font(Verdana, 3, 9) - is an ILLEGAL font string
font(Verdana, Times New Roman,PLAIN,9) - is an ILLEGAL font string
The results of this operations is cached in a global static cache, so that Font objects can be re-used. This is okay since Font objects are immutable once created.
fontString - - the font string in question
IllegalArgumentException - - if the fontString is in an invalid formatpublic static Font font(String fontString)
makeFont(String)public static boolean isFont(String fontString)
fontString is a valid
representation of a Font value.
The allowable forms are :
- fontName,fontStyle,fontSize
- font( fontName, fontStyle, fontSize)
where
fontName - eg. Verdana or 'Times New Roman'.
If multiple font names are specified or there is
white space in the font name, then it must be enclosed
in single quotes and commas eg. 'Verdana, Times New Roman, Tahoma'.
fontStyle - PLAIN|BOLD|ITALIC|UNDERLINE|OVERLINE|LINETHROUGH or nothing! (this is case insenstive)
fontSize - an integer size value or an Extent value. (In the case where
only an integer is specified, the default Extent units
are points (pt).
Examples :
Verdana,,9 - is a legal font string
Verdana,PLAIN,9 - is a legal font string
Verdana,plain,9 - is a legal font string
Verdana,bold|italic,9 - is a legal font string
'Times New Roman',plain,9 - is a legal font string
'Verdana, Times New Roman',plain,9 - is a legal font string
font(Verdana,,9) - is a legal font string
font(Verdana,PLAIN,9) - is a legal font string
font(Verdana,plain,9) - is a legal font string
font(Verdana,bold|italic,9) - is a legal font string
font('Verdana, Times New Roman',plain,9) - is a legal font string
Verdana, 3, 9 - is an ILLEGAL font string
Verdana, Times New Roman,PLAIN,9 - is an ILLEGAL font string
font(Verdana, 3, 9) - is an ILLEGAL font string
font(Verdana, Times New Roman,PLAIN,9) - is an ILLEGAL font string
fontString - - the font string representation to check
public static Font.Typeface makeTypeface(String typeFaceNames)
Multi named type faces must be encluded in spaces.
Valid typeface name forms are :
'Font1, Font 2, Font2' 'Font1' Font1
typeFaceNames - - the name(s) of the intended typefacepublic static String makeFontString(Font font)
font(fontName, fontStyle, fontSize)
where :
fontName - is a font name such as 'Verdana' or 'Times New Roman'. fontStyle - PLAIN|BOLD|ITALIC|UNDERLINE fontSize - an integer size value or an Extent value. (In the case where only an integer is specified, the default Extent units are points (pt).
font - - the font to make into a String representation
public static Font.Typeface getSystemTypeface(String name)
name - - the font typeface name to match.
public static Font addBold(Font font)
font - - the font in question
public static Font addItalic(Font font)
font - - the font in question
public static Font addUnderline(Font font)
font - - the font in question
public static Font addStyle(Font font,
int style)
style to the Font
and returns a new Font.
font - - the font in questionstyle - - the new font style to added to the font
public static Font addSize(Font font,
int sizeDelta)
font - - the font in questionsizeDelta - - the size delta to add to the current size
public static Font setSize(Font font,
int size)
font, that
has the specified size.
font - - the font to use as a templatesize - - the new size
public static Font setStyle(Font font,
int style)
font, that
has the specified style.
font - - the font to use as a templatestyle - - the new style
public static Font setNames(Font font,
Font.Typeface typeFace)
font, that
has the specified typeFace.
font - - the font to use as a templatetypeFace - - the new TypeFace to use
public static Font setName(Font font,
String fontName)
font, that
has the specified fontName.
If fontName has whitespace in it, then
you need to surround it in single quotes.
font - - the font to use as a templatefontName - - the new font name to use
|
EchoPoint API - 3.0.0b5 App Webcontainer |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||