![]() UJML Language Reference |
Visual elements which draw text on the screen need to specify the string to draw and, optionally, how to draw it.
For a visual element that draws text, you specify a string value with the text property element. See text. Optionally, you can specify the font used to draw the text with the size, style, and face property elements. See size, style, face.
Figure 1. A label displayed by the helloworld2.ujml sample.
The size of the string value to draw on the screen is limited only by system memory. However, more realistically, you are limited by the amount of text that will fit on the screen. The font property elements (size, style, and face) also affect how much screen space a given string value will require.
You can determine how much screen space a string will require using the _multi_text_height(), _text_height() and _text_width() functions. See _multi_text_height() function, _text_height() function, _text_width() function.
Single line text visual elements draw the text horizontally until the edge of the screen or a clipping boundary is encountered. Multi-line text visual elements do word-wrapping to fit the text into the elements bounding rectangle as much as possible. Overflow text is not displayed in either case.
Support for fonts varies from device to device and cannot be determined at run time.
All font property elements use int values. UJML supplies predefined entities for each font property element. See Font Entities.
|
Font Property Element |
Description |
|
Determines the size of the text drawn on the device screen. | |
|
Determines the font 'style' (bold, italic, etc.) used to draw text on the device screen. Style values may be combined by adding them together. | |
|
Determines the design of the characters used to draw the text, including the width and height of each character. Depending on the device and the font family the face belongs to, it also affects character spacing. |
The following example shows how to display a label using predefined Font Entities for the label font properties. It is part of the helloworld2.ujml sample.
<label>
<text>&SALUTATION;</text>
<x>&SPACING;</x>
<y>&SPACING;</y>
<fg>&_COLOR_WHITE;</fg>
<size>&_FONT_SIZE_LARGE;</size>
<style>&_FONT_STYLE_ITALIC;</style>
<face>&_FONT_FACE_SYSTEM;</face>
</label>|
Copyright (c) 2000-2007 UIEvolution, Inc. All rights reserved.
|
|
What do you think about this topic? Send feedback!
|