lcdui.font — Font information and manipulation command.
lcdui.font
[names]
[
fontname
| cget
-face
| -size
| -plain
| -bold
| -italic
| -underlined
| -height
| -baselineposition
]
[
fontname
charwidth
string
[
offset
[length
]
]
]
[
fontname
stringwidth
string
[offset
[length
]
]
]
The lcdui.font command is used to fetch information about fonts. For an in-depth look at the Java code that this command is based on, see: javax.microedition.lcdui.Font
It accepts several subcommands:
names: Returns a list of all the available fonts.
fontname
charwidth
:
Returns the width, in pixels, of the given characters.
Takes optional
string
and
offset
parameters.
length
fontname
stringwidth
:
Returns the width, in pixels, of the given string.
Takes optional
string
and
offset
parameters.
length
fontname
cget
:
Used to fetch information about a font. Allowed
options are as follows:
-option
-face
: One of "system",
"proportional", or "monospace".
-size
: One of "small",
"medium" or "large".
-plain
: Returns a 1 if the
font is "plain" - not bold, underlined or italic, or
0 if it isn't.
-bold
: Returns 1 or 0 if the
font is bold or not.
-italic
: Returns 1 or 0 if the
font is italic or not.
-underlined
: Returns 1 or 0 if the
font is underlined or not.
-height
: Returns the standard
height of a line of text in this font, in pixels.
-baselineposition
: Returns
the distance in pixels from the top of the text to
the text's baseline.
set form [lcdui.form -title "Font examples"] $form setcurrent foreach f [sort [lcdui.font names]] { set s [lcdui.stringitem -text $f] $s configure -font $f $form append $s }
Live example: http://www.heclbuilder.com/scripts/show/147