Copy link to clipboard
Copied
Hello
If you create text on a path, in the "Type on a Path Options" panel you can Flip the text. Does anyone know how to do this in code?
Thanks
Copy link to clipboard
Copied
The easy answer is to reverse the path the text is attached to. That should flip the text.
Copy link to clipboard
Copied
A. Patterson wrote:
The easy answer is to reverse the path the text is attached to. That should flip the text.
Thank you for your reply.
Do you have a difficult answer as well? Reversing the path segments works for unclosed paths, but gets more complicated with closed paths. I am fairly sure the Flip control does something else as if I examine the text frames and paths for flipped and unflipped text I can't find any differences and the paths are not reversed. I thought it would use AIArt::SetArtTextWrapProperty, but it doesn't seem to use this either.
Copy link to clipboard
Copied
Why would the path being closed complicate things? If it was a normal polygon it could potentially alter the way it was considered (hole or shell) but that shoudn't matter for a text-along-a-path path object since it's not rendered. We've done this for years, and we just call AIPathSuite::ReversePathSegments().
I've never used that flip option, or investigated it very closely so I can't say what they use. If the paths aren't reversed, I'm not sure what they're calling.
Copy link to clipboard
Copied
It gets complicated with closed paths if you want to maintain the position of the text, because as far as I can tell with a closed path, the text cannot flow across the point where the path is joined.
The position of the joining point changes when you reverse the segments. E.g. if you have a clockwise circle with 4 points that starts and is joined at the north point, when you reverse the segments it is joined at the west point. This means that is some cases as well as reversing the segments you also have to reorder them.
Do you know how the align to path ("Ascender", "Descender", "Center" and "Baseline") options are achieved?
Copy link to clipboard
Copied
Ah, I see what you mean. Yeah, it would affect that.
I looked at the align-to-path options and I don't see anything in the API for it. I haven't used it before, so let me ask this: if you set it for a particular text, say, 'descender' for something like 'test' and then edit the text to have a descender like 'testy', does the text automatically shift? If so, then we're missing an API possibly. If it doesn't automatically shift, then it's likely the alignment is just calculated manually. After all, you could run through a piece of text and figure out what the ascender, etc. values were then calculate the baseline shift yourself. It'd be great if there was an API to do this, but it's possible there isn't.
Copy link to clipboard
Copied
I think the decender option is based on the lowest possible descender in the font as you get the same result if you apply it to test or testy. If you look at the baseline shift in the character panel it doesn't change when you change the "Align to Path" option. It seems as though AIArt::SetTextWrapProperty would be the API as it has both an offset and an invert (flip) parameter, but I can't seem to get it or GetArtTextWrapProperty to work.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more