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_PROPORTIONALandFACE_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_BOLDandSTYLE_UNDERLINE.STYLE_ITALICandSTYLE_BOLDmay be used together to request a bold, italic font.STYLE_UNDERLINEmay be combined with any of the other styles.- Font size
The relative size of the font, chosen from
SIZE_SMALL,SIZE_MEDIUMandSIZE_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. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access