The following routines are used to set the default text and graphic attributes of a document. These attributes determine the color, font, etc. of subsequently added document elements:
setTextFont Sets the default text font for non-styled text data
setTextSize Sets the default text size for non-styled text data
setTextStyle Sets the default text style for non-styled text data
setTextJust Sets the line justification of text elements
setTextLineSpacing Sets the line spacing of text elements
setColor Sets the default color of text and graphic elements
setGray Sets the default gray value of text and graphic elements
setLineWeight Sets the line weight of stroked graphic elements
setTextFont
Syntax: setTextFont document, fontName
Returns: TRUE if the requested font was available
FALSE if the requested font could not be found
This command sets the text font that will be applied to non-styled text data (such as strings) that are subsequently appended to the PrintOMatic document. If the requested font is not available, the default font (Geneva on the Macintosh, Arial on Windows) is used.
Note that the current font set using setTextFont will be overridden by the fonts, sizes and styles within styled text field cast members that you subsequently append to your document. The default font used for non-styled text data after appending a styled text field will be the last font contained within the text field.
setTextSize
Syntax: setTextSize document, fontSize
This command sets the text size that will be applied to non-styled text data (such as strings) that are subsequently appended to the PrintOMatic document.
setTextStyle
Syntax: setTextStyle document, styleString
This command sets the text style that will be applied to non-styled text data (such as strings) that are subsequently appended to the PrintOMatic document. The names of the style values correspond exactly to the Director "textStyle" property. Possible values for text styles are:
normal
plain
bold
italic
underline
On the Macintosh, the following additional styles are available:
outline
condense
extend
shadow
All values except normal or plain are added together in a call to setTextStyle, so you can combine a number of styles together in a single call.
Example:
The following example creates a PrintOMatic document, sets the default font to bold italicized 10 point Helvetica, and prints a short text string:
set doc = new(xtra "PrintOMatic")
if not objectP(doc) then exit
setTextStyle doc, "bold, italic"
setTextFont doc, "Helvetica"
setTextSize doc, 10
append doc, "Some sample text to print out."
if doJobSetup(doc) then print doc
set doc = 0
setTextJust
Syntax: setTextJust document, justCode(s)
The setTextJust command sets the line justification applied to all subsequently added text elements. Possible values are:
left
right
centered
Justification applies to an entire text block (or the set of linked text blocks), so if you set justification to "right" and call append for a block that was previously centered, the justification of the entire block will be changed to right-justified as the new text is added.
setTextLineSpacing
Syntax: setTextLineSpacing document, spacing
Sets the line spacing of text elements
setColor
Syntax: setColor document, red, green, blue
Sets the default color of text and graphic elements
setGray
Syntax: setGray document, grayLevel
Sets the default gray value of text and graphic elements