Sg2.9
createOutline() Character shift
Recent RSS
createOutline() Character shift
From:  Felix
Date:  11. March 2011, 13:04

I found out that createOutline() is the right function to convert Text into Paths. But I have strange bug, I think.

This is my code:

var position = new Point(100,-100); 
var textItem = new PointText(position);
textItem.content = "1234";
textItem.characterStyle.font  = app.fonts["Arial"];
var outline = textItem.createOutline();
outline.fillColor = new CMYKColor(1, 0, 0, 0);

and this is the result:

looks like if the character gets a shift (2 becomes 0, 3 bekomes 1 etc.)

I am using (Mac OS X 10.6.6 Illustrator CS 5 (15.0.2) and Scriptographer 2.9.070)

Re: createOutline() Character shift
From:  Carl Hillig
Date:  11. March 2011, 17:49

Hey Felix,

Your code produced the same result on my system PC - XP(SP2) CS 5.

As a general rule I will set the characteristics of a text item, i.e. color, justification, point size, prior to assigning content to the text item.

I was able to get your code to work perfectly simply by switching the order of lines 3 and 4. The script should then work as expected.

thanks,

Carl

Re: createOutline() Character shift
From:  Felix
Date:  11. March 2011, 20:18

Yeah!
Changing lines 3 and 4 works for me too!
Thank you so much!
Felix

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Stroke Translation 10.03.09