|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.rad.genui.UIResource<UI>
javax.rad.genui.UIFactoryResource<IFont>
javax.rad.genui.UIFont
public class UIFont
Platform and technology independent Font.
Field Summary |
---|
Fields inherited from class javax.rad.genui.UIResource |
---|
uiResource |
Fields inherited from interface javax.rad.ui.IFont |
---|
BOLD, DIALOG, DIALOG_INPUT, ITALIC, MONOSPACED, PLAIN, SANS_SERIF, SERIF |
Constructor Summary | |
---|---|
protected |
UIFont(IFont pFont)
Internal creation of an UIFont with an given IFont. |
|
UIFont(String pName,
int pStyle,
int pSize)
Creates a new instance of UIFont from the specified name,
style and point size. |
Method Summary | |
---|---|
IFont |
deriveFont(int pStyle)
Derives this font with a new style. |
IFont |
deriveFont(int pStyle,
int pSize)
Derives this font with a new style. |
static String[] |
getAvailableFontFamilyNames()
Returns an array containing the names of all font families in this GraphicsEnvironment localized for the default locale,
as returned by Locale.getDefault() . |
static UIFont |
getDefaultFont()
Returns the default UIFont . |
String |
getFamily()
Returns the family name of this IFont . |
String |
getFontName()
Returns the font face name of this IFont . |
String |
getName()
Returns the logical name of this IFont . |
int |
getSize()
Returns the point size of this IFont , rounded to
an integer. |
int |
getStyle()
Returns the style of this IFont . |
Methods inherited from class javax.rad.genui.UIFactoryResource |
---|
getResource, getUIResource |
Methods inherited from class javax.rad.genui.UIResource |
---|
equals, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.rad.ui.IResource |
---|
getResource |
Constructor Detail |
---|
public UIFont(String pName, int pStyle, int pSize)
UIFont
from the specified name,
style and point size.
The font name can be a font face name or a font family name.
It is used together with the style to find an appropriate font face.
When a font family name is specified, the style argument is used to
select the most appropriate face from the family. When a font face
name is specified, the face's style and the style argument are
merged to locate the best matching font from the same family.
For example if face name "Arial Bold" is specified with style
UIFont.ITALIC
, the font system looks for a face in the
"Arial" family that is bold and italic, and may associate the font
instance with the physical font face "Arial Bold Italic".
The style argument is merged with the specified face's style, not
added or subtracted.
This means, specifying a bold face and a bold style does not
double-embolden the font, and specifying a bold face and a plain
style does not lighten the font.
If no face for the requested style can be found, the font system
may apply algorithmic styling to achieve the desired style.
For example, if ITALIC
is requested, but no italic
face is available, glyphs from the plain face may be algorithmically
obliqued (slanted).
Font name lookup is case insensitive, using the case folding rules of the US locale.
If the name
parameter represents something other than a
logical font, i.e. is interpreted as a physical font face or family, and
this cannot be mapped by the implementation to a physical font or a
compatible alternative, then the font system will map the Font
instance to "Dialog", such that for example, the family as reported
by getFamily
will be "Dialog".
pName
- the font name. This can be a font face name or a font
family name, and may represent either a logical font or a physical
font found in this GraphicsEnvironment
.
The family names for logical fonts are: Dialog, DialogInput,
Monospaced, Serif, or SansSerif. Pre-defined String constants exist
for all of these names, eg @see #DIALOG. If name
is
null
, the logical font name of the new
UIFont
as returned by getName()
is set to
the name "Default".pStyle
- the style constant for the UIFont
The style argument is an integer bitmask that may
be PLAIN, or a bitwise union of BOLD and/or ITALIC
(for example, ITALIC or BOLD|ITALIC).
If the style argument does not conform to one of the expected
integer bitmasks then the style is set to PLAIN.pSize
- the point size of the UIFont
IFont
,
getAvailableFontFamilyNames()
protected UIFont(IFont pFont)
pFont
- the IFont.Method Detail |
---|
public String getName()
IFont
.
Use getFamily
to get the family name of the font.
Use getFontName
to get the font face name of the font.
getName
in interface IFont
String
representing the logical name of
this IFont
.IFont.getFamily()
,
IFont.getFontName()
public String getFamily()
IFont
.
The family name of a font is font specific. Two fonts such as
Helvetica Italic and Helvetica Bold have the same family name,
Helvetica, whereas their font face names are
Helvetica Bold and Helvetica Italic. The list of
available family names may be obtained by using the
GraphicsEnvironment.getAvailableFontFamilyNames()
method.
Use getName
to get the logical name of the font.
Use getFontName
to get the font face name of the font.
getFamily
in interface IFont
String
that is the family name of this
IFont
.IFont.getName()
,
IFont.getFontName()
public String getFontName()
IFont
. For example,
Helvetica Bold could be returned as a font face name.
Use getFamily
to get the family name of the font.
Use getName
to get the logical name of the font.
getFontName
in interface IFont
String
representing the font face name of
this IFont
.IFont.getFamily()
,
IFont.getName()
public int getStyle()
IFont
. The style can be
PLAIN, BOLD, ITALIC, or BOLD+ITALIC.
getStyle
in interface IFont
IFont
public int getSize()
IFont
, rounded to
an integer.
Most users are familiar with the idea of using point size to
specify the size of glyphs in a font. This point size defines a
measurement between the baseline of one line to the baseline of the
following line in a single spaced text document. The point size is
based on typographic points, approximately 1/72 of an inch.
The Java(tm)2D API adopts the convention that one point is equivalent to one unit in user coordinates. When using a normalized transform for converting user space coordinates to device space coordinates 72 user space units equal 1 inch in device space. In this case one point is 1/72 of an inch.
getSize
in interface IFont
IFont
in 1/72 of an
inch units.public IFont deriveFont(int pStyle)
pStyle
- the style.
public IFont deriveFont(int pStyle, int pSize)
pStyle
- the style.pSize
- the size.
public static UIFont getDefaultFont()
UIFont
.
IFont
IFont
public static String[] getAvailableFontFamilyNames()
GraphicsEnvironment
localized for the default locale,
as returned by Locale.getDefault()
.
Typical usage would be for presentation to a user for selection of a particular family name. An application can then specify this name when creating a font, in conjunction with a style, such as bold or italic, giving the font system flexibility in choosing its own best match among multiple fonts in the same font family.
String
containing font family names
localized for the default locale, or a suitable alternative
name if no name exists for this locale.IFont
,
IFont.getFamily()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |