Sg2.9
Strange behavior when outlini...
Recent RSS
Strange behavior when outlining text
Date:  18. June 2011, 17:21

I have noticed that creating outlines behaves rather erratic.

This is the code I use:

var x = 30
var objectHeight = 20
var objectToTextGap = 1

var p = new Path.Rectangle(0, 0, x, objectHeight)

// Place text
var newText = new PointText(new Point(0, 0))

// Assign a string
newText.content = 'some text'

// Choose font
newText.characterStyle.font = app.fonts['OCR A Std']

// Create the outlines
b = newText.createOutline()

// Scale the new outlines to a given ratio of the arbitrary object (in this case based on height)
b.scale((objectHeight / textToObjectRatio) / b.bounds.height)

// Move center of text outlines to match center of object
b.translate(new Point(-(b.bounds.center.x - (x / 2)), -(b.bounds.topLeft.y - objectHeight - objectToTextGap)))

// Remove the original text
newText.remove()

Now, two things happen when I use this code.
#1 - When using a custom made monospaced font I've made the letters in the outlined group change ( ie. 'hej' turned into 'A°B').
#2 - When using another monospaced font such as 'OCR A Std' the spaces between letters became all messed up. This does not seem to happen when using standard fonts.

Could it be that I'm trying to scale a group that is somehow the problem?
If so, how would I create a compound path of all the objects in the group with least effort?

{
OSX 10.6.7
3.2 GHz Intel Core i3
4GB 1333 MHz DDR3

AI CS5 (15.2)

Scriptographer 2.9.072
Java 1.6.0_24
}

Thanks
/Håkan

Re: Strange behavior when outlining text
Date:  19. June 2011, 10:23

This problem have apparently been reported earlier (here). Sorry about that. The suggested solution is to place the font assigning line BEFORE the text string line (ie. switch place of lines 11 and 14. Will try out as soon as possible.

Though curious why this happens and why my own font completely changes letters and not just shifting the letters one step.

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
Parallel Arrangement 07.04.12