Mobile app version of vmapp.org
Login or Join

Login to follow query

More posts by @Vandalay110

2 Comments

Sorted by latest first Latest Oldest Best

 

@Alves566

Not sure how proficient you are with scripting, but here is a snippet which takes one point text item and turns it into a text path item.
You can ask here or on the Adobe Illustrator scripting forum, how to extend this snippet to do more complex operations - for example, right now it will throw errors for many things if the conditions are not just right.
#target illustrator
function test(){
var doc = app.activeDocument;
var t = doc.textFrames[0];
var point = t.anchor;
var width = t.width;
var newPath = doc.pathItems.add();
newPath.setEntirePath([[point[0], point[1]], [point[0] + width, point[1]]]);
var newPathText = doc.textFrames.pathText(newPath);
newPathText.contents = t.contents;
t.remove();
};
test();


-------------------------- EDIT #1 -------------------------
#target illustrator
function test(){
var doc = app.activeDocument;
doc.selection = null;
var t = doc.textFrames[0];
var point = t.anchor;
var width = t.width;
t.selected = true;
t.convertPointObjectToAreaObject();
app.redraw();
t = doc.selection[0];
doc.selection = null;
var tempTextPath = t.textPath;
var angle = Math.atan2(tempTextPath.pathPoints[1].anchor[1] - tempTextPath.pathPoints[0].anchor[1], tempTextPath.pathPoints[1].anchor[0] - tempTextPath.pathPoints[0].anchor[0]) * 180 / Math.PI;

var newPath = doc.pathItems.add();
newPath.setEntirePath([[point[0], point[1]], [point[0] + width, point[1]]]);
newPath.rotate(angle, undefined, undefined, undefined, undefined, Transformation.BOTTOMLEFT);
var newPathText = doc.textFrames.pathText(newPath);
newPathText.contents = t.contents;
t.remove();
};
test();


-------------------------- EDIT #2 -------------------------

#target illustrator
function test(){
function convertPointText(pointText){
var doc = app.activeDocument;
doc.selection = null;
var t = pointText;
var point = t.anchor;
var width;
var size = t.textRange.characterAttributes.size;
t.selected = true;
t.convertPointObjectToAreaObject();
app.redraw();
t = doc.selection[0];
doc.selection = null;
var tempTextPath = t.textPath;
var angle = Math.atan2(tempTextPath.pathPoints[1].anchor[1] - tempTextPath.pathPoints[0].anchor[1], tempTextPath.pathPoints[1].anchor[0] - tempTextPath.pathPoints[0].anchor[0]) * 180 / Math.PI;
t.rotate(-angle, undefined, undefined, undefined, undefined, Transformation.BOTTOMLEFT);
width = tempTextPath.width;

var newPath = doc.pathItems.add();
newPath.setEntirePath([[point[0], point[1]], [Math.round(point[0] + width), point[1]]]);
newPath.rotate(angle, undefined, undefined, undefined, undefined, Transformation.BOTTOMLEFT);
var newPathText = doc.textFrames.pathText(newPath);
newPathText.contents = t.contents;
newPathText.textRange.characterAttributes.size = size;
t.remove();
};

var doc = app.activeDocument;
var sel = doc.selection;
var workTextFramesArray = [];
for (var i = 0; i < sel.length; i++) {
workTextFramesArray[i] = sel[i];
}
for (var i = 0; i < workTextFramesArray.length; i++) {
convertPointText(workTextFramesArray[i]);
}
};
test();

10% popularity Vote Up Vote Down


 

@Turnbaugh909

Copy, paste.

There's no automated solution to create text on a path. It requires the path(s) to be drawn, then the Type in a Path tool to click a path. (Then you can paste text).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme