Command |
TEXT |
|
|
Description |
Create or update Text.
Use Carriage Return and/or Line Feed for multi line entry "\\0D\\0A".
The font and colour are defined in the style.
If the cursor relative position is 'CC' (Centre Centre) it is easy to locate text in the centre of images like buttons.
Text areas can overlap other text areas when for example a 'drop shadow'
is required. Text can include embedded hex codes to access Unicode
fonts and a cursor.
Faster display updates occur if text uses a solid background colour (ie no alpha blending). |
|
|
Syntax/Parameters |
TEXT(Name,Text,Style)
TExt(Name,Text,Style,PosX,PosY); |
|
|
Style |
STYLE(Txt32ASC16,TEXT) //assign a name for
the style like Txt32ASC16
{
font="ASC16B,16THAI"; //define fonts using
built in or preloaded .FNT files via LIB command
size=2;
//a 24x24 font is expanded to a 48x48 font. default=1
col=white;
//"\\000000" to "\\FFFFFF" or reserved words from the colour chart.
back=black;
//ONLY USE where a page has a style updated=changed;
opacity =
n;
// n = 0..100 where 0=transparent..100=opaque (default=100)
maxLen=64;
//maximum length of text. default =32, maximum=512
maxRows=4;
//maximum number of rows=32 where new line code
\\0D\\0A is used.
rotate=90;
//rotation relative to screen 0, 90, 180, 270. default=0
justify = cur; // Default. Justification is determined by curRel. (TL,CL,BL=left;
TC,CC,BC=centre; TR,CR,BR=right)
yAlign = cur; // Default. Vertical alignment is determined by curRel. (TL,TC,TR=top;
CL,CC,CR=centre; BL,BC,BR=bottom)
xtrim=y;
//trim text box to width of text. Set to N for numbers to prevent them
moving according to width.
curRel=CC;
//specify placement relative to cursor. CC Centre Centre , TC Top
Centre,
}
//BC Bottom Centre, LC Left Centre,
RC Right Centre, TL Top Left,
// BL Bottom Left, TR Top Right, BR
Bottom Right |
|
|
Options |
Editable Text and Visible Cursor - v37.00
A text can contain single byte hex of the form \\00 to \\FF
A text can contain hidden codes for use in password and editable fields.
\\01 defines the text as a PASSWORD so that only ***** are shown.
\\02 defines a hidden cursor and \\03 a hidden cursor with insert ON
\\04 defines an underline cursor and \\05 an underline cursor with insert ON
\\06 defines a block cursor and \\07 a vertical cursor with insert ON
Always place the cursor before the applicable character.
When a page or text is hidden, the cursor remains at its current
location.
The CALC() command can then be used to manipulate the text and cursor in
EditBox.
Example Editable Text:
TEXT(EditBox,"Hello\\04World",8ptTextRed); this places an underline cursor at W
Fonts
Fonts are available using single byte, 2 byte and UTF8 multi-byte
coding.
Built in ASCII fonts have the
reserved names Ascii8, Ascii16, Ascii32 (case sensitive).
Other library fonts are uploaded using the LIB() command and have file type .FNT
These are available for download from the character fonts web page at
www.itrontft.com.
Unique Font Overlay
It is possible to overlay one font over another to enable single byte
operation with ASCII from \\20 to \\7F and Cyrillic, Greek, Hebrew,
Bengali, Tamil, Thai or Katakana from \\80 to \\FF. The LIB() command is
used to load the extended font at \\0080 instead of it's normal UNICODE
location. The style for a text can then specify font="MyASCII,MyThai";
causing the Thai to overlap the ASCII from \\80 to FF.
Text Alignment - v49.00
To support "monospaced"
fonts (ie those that have the same x-advance), the text style parameter
xtrim=Y|N
is used.
The default is Y which makes text boxes fit to the width of the visible
text. However, for monospaced fonts (eg numbers) this can cause problems
with the numbers 'shifting' left and right (eg number 1 is narrower than
2). To stop this, set
xtrim=N;
Text Justification - v49.14
Text justification style property for displaying multiple lines in text box:
justify = left; (or L) // Justify left (default)
justify = right; (or R) // Justify right
justify = centre; (or C) // Justify centre
Example1: STYLE( stText, text ) { font=Ascii16; col=blue; justify=right; }
Example2: LOAD( stText.justify, centre );;
TEXT Styles
Support for accepting both "centre" and "center" in parameters
- v49.16.
Support for opacity - v49.00.
Text rotation supported - v38.00.
New Text Parameters - width, bcol, padding, xSpace, ySpace [work in
progress] - v49.37
* Added parameters to create text box to text style:
width - width of border (default = 0)
bcol - colour of border (default = white)
padding - number of pixels to add between text area and border (default = 0)
xSpace - extra spacing between chars (default = 0)
ySpace - extra spacing between lines (default = 0)
Structure support in TEXT() commands - v49.44
* Structure
variables can now be used for the source in the TEXT() command.
Support for immediate ints and floats in TEXT(); - v49.46
Changed
TEXT(name,text,...) to support text = int, flt as well as existing
var, "txt".
TEXT( txt1, "String", stTxt );
TEXT( txt2, 100, stTxt ); // Now supported
TEXT( txt3, 3.142, stTxt ); // Now supported
TEXT( txt4, varTxt, stTxt );
TEXT( txt5, varU8, stTxt );
TEXT( txt6, varFlt, stTxt );
Text Alignment not correct with rotated text - v49.43
* Default text alignment fixed for rotated text and multi-line text.
Text Wrapping & Text Boxes - v49.49
View text wrapping editor application
* Can now pass width/height in TEXT command, similar to DRAW, so
that a text box/area can be created.
* This gives the following combinations:
- Create Text:
TEXT( name, "Text", style );
TEXT( name, "Text", style, posX, posY );
TEXT( name, "Text", sizeX, sizeY, style );
TEXT( name, "Text", sizeX, sizeY, style, posX, posY );
- Update Text:
TEXT( name, "Text" );
TEXT( name, sizeX, sizeY );
TEXT( name, "Text", sizeX, sizeY );
* The text area can be one of the following types:
type=a | auto; (default)
if no solid back colour specified, text area resizes to fit text
if solid back colour is specified, text area keeps keeps maximum x
and y of text
the maxLen x maxRows properties are only used for initial allocation
of memory
type=r | resize;
text area resizes to fit current text
if sizeX and/or sizeY specified then minimum box size is sizeX/sizeY
type=m | max;
text area remains maximum text width/height of text box
if sizeX and/or sizeY specified then minimum box size is sizeX/sizeY
this is used primarily for page update=changed to wipe any previous
text
type=f | fixed;
text a rea size is fixed to sizeX x sizeY
* New Text styles available:
width = border width
bcol = border colour
xSpace = character spacing
ySpace = row spacing
padding = space between border and text
maxX = maximum box width
maxY = maximum box height
wrap = text wrap (see below)
* Text wrapping options:
wrap = n; // no wrap (default)
wrap = cc; // char cols = wrap text at character at maxLen (ie num
cols)
wrap = wc; // word cols = wrap text at word within maxLen (ie num
cols)
wrap = cb; // char box = wrap text at character at box width
wrap = wb; // word box = wrap text at word within box width
View text wrapping editor application
Using PAGE STYLE Update=Changed
To gain the faster refreshing, a few rules apply.
1/ Only the screen area where the changed entity is located is redrawn.
2/ The entity is redrawn on top of any existing pixels being displayed
in that area.
3/ Entities with transparent backgrounds will show all previous
rendering at that location in the transparent area.
4/ Hiding an entity will not produce any visible difference until a full
page refresh is performed.
To support the
"update=changed;" method.
1/ Do not use images with transparent backgrounds
2/ Specify the "back" colour in the style for text.
3/ To hide an entity, a “masking” image will need to be placed over the
entity.
4/ To refresh only the entities on a page that have been modified, use
the double semi-colon ";;" refresh method after the last entity,
e.g. TEXT( txt1, "Hello" );;.
5/ To refresh the whole page, use the SHOW( page ); method.
|
|
|
Example |
TEXT(EditBox,"Hello World",st8Red12); //creates Edit Box with user defined style st8Red12
TEXT(EditBox,"Hello People");
//modifies content of EditBox
TEXT(EditBox,TextVar);
//modifies content of EditBox with content of variable
TEXT(EditBox,"Hello\\w0020World"); // example of unicode embedded character (see fonts page)
|
|
|
|