![](http://datasheet.mmic.net.cn/260000/PPSMMANUAL_datasheet_15946768/PPSMMANUAL_54.png)
8-6
TText Display Management
Programmer’s Manual
reserved for future extensions and is set to zero.
Example 8-3 Setting text properties
U32
tId;
/* text template id */
/* text to be displayed */
TEXT
moto[] = {’M’, ’o’, ’t’, ’o’, ’r’, ’o’, ’l’, ’a’, 0};
/* this is to initialize every ASCII character in
2-byte format with high byte being zero */
len;
/* # chars to be displayed */
FONTATTR
fontAttr;
/* font attributes */
.
.
.
/* create a text template */
TextCreate(&tId);
U16
/* calculate # chars to be displayed */
len = Strlen(moto);
/* subsequent text displayed with text template tId will be located at (102, 344 /* Set up the text attributes */
length of moto characters wide and 6 characters high, starting at text cu345 if(TextSetup(tId, font, style, greylev, xSrc, ySrc, len, 1) != PPSM_OK)
position zero. */
TextSetDisplay(tId, 102, 0, len, 6, 0);
/* subsequent text displayed with text template tId will be exclusive OR’ed w349 if(TextMap(tId, (P_TEXT)str, len) != PPSM_OK);
the existing image on screen, with grey level BLACK. */
TextSetOutlook(tId, EXOR_STYLE, BLACK);
/* set up font attributes */
fontAttr.type = BIG5_VARIABLE_FONT;
fontAttr.width = fontAttr.height = 20;
fontAttr.attrib = 0;
/* subsequent text displayed with text template tId will be of BIG5 Variable font
type of size 20x20 pixels. */
TextSetFont(tId, &fontAttr);
/* delete unused text template */
Table 8-4 Text Properties Default Values
Text Properties
Default Value
(x,y)-coordinate of the origin (top left corner) of the
text display area
(0, 0)
Width of text display area in number of characters
0
Height of text display area in number of characters
0
Character cursor position relative to origin of text
display area
0
Font type
SMALL_NORMAL_FONT
Font width
8
Font height
10
Special font attributes
0
Text grey level value
BLACK
Text output style
OR_STYLE
Personal Portable System Manager
Programmer’s Manual
8-7
TextDelete(tId);
.
.
.
Text Mapping
Mapping functions are provided for applications to display and remove text on the
panning display screen area. The display and removal of text are tied to a text
template.
8.5.1
Displaying text
STATUS
TextMap
(U32
)
The given text is displayed, one character at a time, starting at the current
character cursor position of the text display area and with text attributes as
described by the specified text template.
There is no word-wrap function. Text is treated as individual characters, i.e.
characters of a word that extends beyond a row will appear on the next row of the
text display area. Text displaying stops when the character cursor position is at the
end of the text display area, when all characters supplied by the application are
mapped, or when numCharcharacters are mapped. After displaying characters
on panning screen, character cursor position will be advanced to the next
available position, or (the end of the template + 1) if the last character displayed is
at the end of the template. Any out standing characters are going to be ignored
without returning any error.
Example 8-4 Display text on text display area
333 STATUS DisplayString(U8 font, U8 style, U8 greylev, U16 xSrc, U16 ySrc, TEXT str[])
334 {
335 U16 len; /* length of the string */
336 U32 tId; /* textId for the text template */
.
.
.
341 /* get the string length */
342 if (len = Strlen(str))
343 {
346
return PPSM_ERROR;
347
348 /* Map the text to the screen */
350 return PPSM_ERROR;
8.5.2
Removing text
STATUS
TextUnmap
)
The unmapping of text means clearing the entire text display area. The location
and size of the text display area to be cleared is specified in the given text
template.
F
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
.