Upgrading Paint 8 scripts to Paint 9

In transition of Corel PHOTO-PAINT from version 8 to version 9, there are some drastic changes in graphic engines and as such in the way some scripting commands work. Aside from a bunch of new commands, some old ones have been changed in syntax, behavior and even the resulting effects.

This might cause some difficulties when translating scripts that have worked just fine under Photo-Paint 8 to work the same way under Paint 9.

I hope that this document will help you do this job easier. Let's see what was changed in Paint 9. Please note, that this document doesn't claim to be precise or complete.

Text Handling

First, Photo-Paint 9 uses CorelDRAW's text engine and as a result, text handling is completely different now. As you might have guessed, text-related commands in scripting were changed as well.

Now, in order to create a text string, you should use the following scheme:

  1. Use TextTool command to set position and basic rendering properties (anti-aliasing, render to mask or object, etc).
  2. Specify text settings (font, size, color, spacing, etc) using a set of TextSetting commands.
  3. Add some text using the specified formatting using TextAppend.
  4. Issue TextRender to render the text into an object or mask or TextEdit to apply changes to existing text object

Note that you may repeat steps 2 and 3 to add characters with different formatting into the same text object.

Now let's see how to use each of these commands.


Sub TextTool(X AS Long, Y AS Long, RenderToMask AS Boolean,
             AntiAlias AS Boolean, DrawMode AS Long)
  • X, Y - coordinates of the reference point of the text object in the document. The reference point differs depending on the justification of the text. For left-justified text, it is the upper left corner of the text object. For the right-justified text - upper right corner; for centered text - upper middle of the text object bounding box.
  • RenderToMask should be set to True if the text should become a mask, otherwise it will be created as separate floating object
  • AntiAlias - set to True to smooth the font edges
  • DrawMode specified the combining mode of the mask. 0 = Normal, 1 = Add, 2 = Subtract, 3 = XOR


Sub TextSetting(Arg AS String, Value AS String)
  • Arg - a text property name whose value should be set (see below for details)
  • Value - a string value of the specified property

You should use this command for each individual text property. You don't have to set all the properties though. The default values will be used for properties not set explicitly. The list of available properties follows:

Name Description Possible Values Example
Fill Text color "R,G,B" "Fill","255,0,0" - sets red text color
Font Font name "Name" "Font","Arial"
TSWeight Font weight "64" - Normal
"128" - Italic
"4096" - Bold
"8192" - Bold-Italic
TSUnderline Underline "0" - none
"1" - single thin
"2" - single thin word
"3" - single thick
"4" - single thick word
"5" - double thin
"6" - double thin word
TypeSize Font size Fractional number "TypeSize","10.5"
Justify Text justification "0" - none
"1" - left
"2" - center
"3" - right
"4" - full
"5" - force
"Justify","2" - centered text
InterCharSpacing Character spacing Percent*10,000 "InterCharSpacing", "500000" - 50%
InterLineSpacing Line spacing Percent*10,000 "InterLineSpacing", "1200000" - 120%
Direction Text flow direction "0" - horizontal
"1" - vertical
TSOverline Overline as TSUnderline  "TSOverline","2"
TSStrikeout Strike thru as TSUnderline  "TSStrikeout","2"
TSScript Sub/superscript "0" - none
"1" - superscript
"2" - subscript
TSEffect Effect "0" - none
"1" - small caps
"2" - all caps
TSShadow Shadow "0" - no shadow
"1" - shadow
For Mac use only
TypeAngle Character rotation angle Angle*1,000,000 "TypeAngle","15000000" - 15
HKern Horizontal char shift Number "HKern","5" - 5%
VKern Vertical char shift Number "VKern",10 - 10%


Sub TextAppend(Text AS String) 
  • Text - a text string to append

Appends text using predefined formatting.


Sub TextRender()

Renders the composed text object either as a new floating object or as mask


Sub TextEdit(ObjectID AS Long)
  • ObjectID - number of object to edit. Object #1 is the first object above the background.

Applies changes to the specified text object.

Here is an example of script that creates a text object:

.TextTool 224, 47, FALSE, TRUE, 0
	.TextSetting "Fill", "255,0,0"
	.TextSetting "Font", "Arial"
	.TextSetting "TypeSize", "20.000"
	.TextSetting "TSWeight", "4096"
	.TextSetting "TSUnderline", "1"
	.TextSetting "Justify", "2"
	.TextAppend "Red"
	.TextSetting "TSWeight", "128"
	.TextSetting "Fill", "0,0,255"
	.TextSetting "TSUnderline", "0"
	.TextAppend " text"

This script creates a text object containing two independent text runs: first, a word "Red" typed in red bold underlined font, and second "text" - blue plain italic. The resulting text object will look like this:

Red text

That covers text handling in Photo-Paint 9.

Next page >>

[ CorelSCRIPT Tips&Tricks | Learning CorelSCRIPT | Oberon Home Page ]

Copyright 2000 by Alex Vakulenko. All rights reserved.
This page was last revised on 02/27/00.