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?
3.2 GHz Intel Core i3
4GB 1333 MHz DDR3
AI CS5 (15.2)