Name
Font
Synopsis
This class represents a font that can be used to render text in the low-level API.
A device has a default font that can be obtained from the static
getDefaultFont()
method. Other fonts, if there are any, can be
obtained from the getFont()
method, which requires three attributes:
- Font face
An integer value that describes the type of font based on its appearance. The legal values are
FACE_MONOSPACE
,FACE_PROPORTIONAL
andFACE_SYSTEM
, which corresponds to a platform-dependent system font.- Font style
Selects a style of the given font face. Legal values are
STYLE_PLAIN
,STYLE_ITALIC
,STYLE_BOLD
andSTYLE_UNDERLINE
.STYLE_ITALIC
andSTYLE_BOLD
may be used together to request a bold, italic font.STYLE_UNDERLINE
may be combined with any of the other styles.- Font size
The relative size of the font, chosen from
SIZE_SMALL
,SIZE_MEDIUM
andSIZE_LARGE
.
Since the capabilities of MIDP devices vary widely, the
application is only able to select a font based on this narrow set of logical attributes.
The getFont()
method returns the font from the set available to it
that most closely matches the arguments supplied to it.
Some devices may be able to closely match a wide range of requested fonts, while others might only be
able to accurately represent a very small number.
In order to minimize memory usage, the same Font
instance will be returned by this method whenever the arguments supplied to it resolve to
the same device font. This is possible because Font
objects are immutable. ...
Get J2ME in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.