|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.livescribe.display.Font
public abstract class Font
Font encapsulates the metrics as well as support for rendering
(see TextRenderer ) text on a destination
surface. The following methods allows the application to access the platform
fonts
The method Graphics.setFont(Font) is used by
the application to set the font to be used for any graphics operations.
| Field Summary | |
|---|---|
protected int |
face
|
static int |
FACE_MONOSPACE
|
static int |
FACE_PROPORTIONAL
|
static int |
FACE_SYSTEM
|
protected String |
faceName
|
static int |
FONT_INPUT_TEXT
|
static int |
FONT_STATIC_TEXT
|
protected int |
size
|
static int |
SIZE_LARGE
|
static int |
SIZE_MEDIUM
|
static int |
SIZE_SMALL
|
protected int |
style
|
static int |
STYLE_BOLD
|
static int |
STYLE_ITALIC
|
static int |
STYLE_PLAIN
|
| Constructor Summary | |
|---|---|
protected |
Font(int face,
int style,
int size,
String faceName)
Construct an instance of Font with the attributes specified. |
| Method Summary | |
|---|---|
int |
charsWidth(char[] cs,
int offset,
int length)
Gets the width of the characters in the array passed. |
abstract int |
charWidth(char ch)
Gets the width of the character based on the metrics. |
abstract int |
getBaselinePosition()
Gets the baseline position for this font. |
static Font |
getDefaultFont()
Returns the default font for the current locale. |
static Font |
getDefaultFont(Locale locale)
Returns the default font for the locale specified. |
int |
getFace()
Gets the face type of the font. |
static Font |
getFont(int face,
int style,
int size)
Gets the font for the attributes specified for the current locale. |
static Font |
getFont(Locale locale,
int face,
int style,
int size)
Returns the font for the locale and the attributes specified. |
static Font |
getFont(Locale locale,
String faceName,
int style,
int size)
Returns the font for the locale and the attributes specified. |
static Font |
getFont(String faceName,
int style,
int size)
Returns the font for the attributes specified for the current locale. |
abstract int |
getHeight()
Gets the height of the font. |
protected abstract TextRenderer |
getRenderer()
Gets the renderer that can render text using this font. |
int |
getSize()
Gets the size of the font. |
int |
getStyle()
Gets the style of the font. |
boolean |
isBold()
Deprecated. use getStyle() |
boolean |
isItalic()
Deprecated. use getStyle() |
boolean |
isPlain()
Deprecated. use getStyle() |
protected static void |
render(Font font,
Graphics destination,
String text,
int offset,
int len,
int x,
int y)
Renders the text on the destination graphics using the font's renderer. |
abstract int |
stringWidth(String text)
Gets the string width using based on the metrics of the font. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int STYLE_PLAIN
public static final int STYLE_BOLD
public static final int STYLE_ITALIC
public static final int SIZE_SMALL
public static final int SIZE_MEDIUM
public static final int SIZE_LARGE
public static final int FACE_SYSTEM
public static final int FACE_MONOSPACE
public static final int FACE_PROPORTIONAL
public static final int FONT_STATIC_TEXT
public static final int FONT_INPUT_TEXT
protected final int face
protected final int style
protected final int size
protected final String faceName
| Constructor Detail |
|---|
protected Font(int face,
int style,
int size,
String faceName)
Font with the attributes specified.
face - face type. This should be one of the constants (
FACE_MONOSPACE,FACE_PROPORTIONAL,
FACE_SYSTEM)style - style of the font. This should be one of the constants (
STYLE_BOLD,STYLE_ITALIC, STYLE_PLAIN)size - the font size. This should be one of the constants (
SIZE_MEDIUM,SIZE_LARGE, SIZE_SMALL)faceName - name of the font face. This cannot be null.| Method Detail |
|---|
public static Font getDefaultFont()
FACE_SYSTEMSTYLE_PLAINSIZE_MEDIUM
To get to the default font for the default locale, use
getDefaultFont(Locale)(Locale.getDefault())
public static Font getFont(String faceName,
int style,
int size)
null would be
returned.
faceName - the face namestyle - the font stylesize - the font size
null if a suitable font cannot be found that match
the attributes.
public static Font getFont(int face,
int style,
int size)
face - face type. This should be one of the constants (
FACE_MONOSPACE,FACE_PROPORTIONAL,
FACE_SYSTEM)style - style of the font. This should be one of the constants (
STYLE_BOLD,STYLE_ITALIC, STYLE_PLAIN)size - the font size. This should be one of the constants (
SIZE_MEDIUM,SIZE_LARGE, SIZE_SMALL)
public static Font getDefaultFont(Locale locale)
null then default locale is used. It would be
equivalent to calling this as getDefaultFont(Locale.getDefault()).
locale - locale
public static Font getFont(Locale locale,
int face,
int style,
int size)
null then default locale is used. It
would be equivalent to calling this as
Font.getFont(Locale.getDefault(),...)
locale - the localeface - face type. This should be one of the constants (
FACE_MONOSPACE,FACE_PROPORTIONAL,
FACE_SYSTEM)style - style of the font. This should be one of the constants (
STYLE_BOLD,STYLE_ITALIC, STYLE_PLAIN)size - the font size. This should be one of the constants (
SIZE_MEDIUM,SIZE_LARGE, SIZE_SMALL)
public static Font getFont(Locale locale,
String faceName,
int style,
int size)
null then default locale is used. It
would be equivalent to calling this as
Font.getFont(Locale.getDefault(),...)
locale - the localefaceName - face name of the font. This cannot be null.style - style of the font. This should be one of the constants (
STYLE_BOLD,STYLE_ITALIC, STYLE_PLAIN)size - the font size. This should be one of the constants (
SIZE_MEDIUM,SIZE_LARGE, SIZE_SMALL)
public int getStyle()
STYLE_BOLD,
STYLE_ITALIC,
STYLE_PLAINpublic int getSize()
SIZE_LARGE,
SIZE_MEDIUM,
SIZE_SMALLpublic int getFace()
FACE_MONOSPACE,
FACE_PROPORTIONAL,
FACE_SYSTEMpublic boolean isPlain()
getStyle()
public boolean isBold()
getStyle()
public boolean isItalic()
getStyle()
public abstract int getHeight()
public abstract int getBaselinePosition()
public abstract int charWidth(char ch)
ch - character whose width
public int charsWidth(char[] cs,
int offset,
int length)
cs - character array containing text.offset - offset within the character arraylength - number if characters from the offset specified.
public abstract int stringWidth(String text)
text - text whose width needs to be computed. This should not be a
null value.
protected abstract TextRenderer getRenderer()
TextRenderer
protected static void render(Font font,
Graphics destination,
String text,
int offset,
int len,
int x,
int y)
font - destination - text - offset - len - x - y -
|
PenProfile 2.x | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||