Syntax One
//TEXTRECTANGLE, left, top, right, bottom
bla bla bla bla bla bla bla bling
bla bla bla bla bla bla
//TEXTRECTANGLE
TEXTRECTANGLE is similar to the TEXTINDENT command, both in what it is used for and also in the fact that it consists of a starting and ending command (the ending command has no arguments), with any number of lines of text in between the two.
TEXTRECTANGLE formats the text (up to the ending //TEXTRECTANGLE) to fit within the rectangular coordinates provided, applying word wrap to the lines as needed. Note that any existing CRLF line terminators will be respected; in the example above, the word "bling" will mark the end of a line, no matter how the rest of it formats.
If the text does not all fit in the rectangle, the last word will be printed with an ellipsis (...) following it. See MX_GDICALC in the A-Shell XCALL Reference for information on calculating in advance how much text will fit.
Some text rotation options are also supported; see History below.
See the SOSLIB program MMOGDI for an example.
Syntax Two
//TEXTRECTANGLE, left, top, right, bottom, flags, text
This variation (identified by the six parameters) is both simpler to use than the traditional multi-part TEXTRECTANGLE sequence, and offers some additional features such as multi-line horizontal and vertical centering.
flags may be any sensible combination of the following:
|
Flag |
Value |
Meaning |
|
TRF_TOP |
&h00000000 |
top justification |
|
TRF_LEFT |
&h00000000 |
left justification |
|
TRF_HCENTER |
&h00000001 |
horizontal centering |
|
TRF_RIGHT |
&h00000002 |
right justification |
|
TRF_VCENTER |
&h00000004 |
vertical centering |
|
TRF_BOTTOM |
&h00000008 |
bottom justification |
|
TRF_WORDBREAK |
&h00000010 |
wrap the text onto multiple lines |
|
TRF_SINGLELINE |
&h00000020 |
output text as a single line |
|
TRF_EXPANDTABS |
&h00000040 |
expand tabs (8 spaces each) |
|
TRF_NOCLIP |
&h00000100 |
no clipping |
|
TRF_EXTERNALLEADING |
&h00000200 |
incl. ext. leading in spacing |
|
TRF_CALCRECT |
&h00000400 |
calc only (use with MX_GDICALC) |
|
TRF_PATH_ELLIPSIS |
&h00004000 |
path ellipsis |
|
TRF_END_ELLIPSIS |
&h00008000 |
end ellipsis |
|
TRF_WORD_ELLIPSIS |
&h00040000 |
word ellipsis |
As with other GDI printer directives, the flags can be specified as a decimal value, hex value, or using the symbol names.
text may be any string of up to 2048 characters. It may include "^M" symbol(s) to indicate hard CRLF(s).
History
2011 October, A-Shell 5.1.1235
//TEXTRECTANGLE now supports limited rotation options (TRF_SINGLELINE with 90, -90, or 180 degree rotation only). Note that the rectangle itself is not rotated, nor is the interpretation of the alignment options (TRF_LEFT, TRF_TOP, etc. remain relative to the rectangle in the standard orientation of the page. Only the text is rotated. See the new sample GDI text file, TEXTRECTR.TXT[908,37] for examples.
2011 August, A-Shell 5.1.1230: Added Syntax Two
2007 April, A-Shell build 986
Increased the maximum paragraph length supported by the //TEXTRECTANGLE command to 16K. This is considerably longer than can fit on a page, which is the effective limit for what a single //TEXTRECTANGLE can handle anyway. Larger paragraphs can still be analyzed by MX_GDICALC, it would inevitably break them up into rectangles (or entire pages) that were individually less than 16K (unless perhaps you used 2 point type in an effort to cram 16K of unreadable text on a page).
An error message box will be displayed if any single line of the printfile exceeds the 16K limit.
Note that neither MX_GDICALC nor //TEXTRECTANGLE support the line continuation character (\) so unless you want to insert your own line breaks, the entire paragraph has to be output as a single line (with the only CRLF being at the end).
2005 May, A-Shell build 986: Routine added to A-Shell