Copy link to clipboard
Copied
I am trying to replace all characters in my text with a manually skeletonized version of said text. I get cleaner, more flexible and faster results in milling, laser marking and embroidery this way. So i would like to find the transformation matrix of each individual character so that I can lookup that caharacter in a reference document and get the skeleton and transform it to replace the text.
Ok so far so good. Ive found some scripting tools like this script by Carlos Canto that unfortunately does not work for all cases and does not account for kerning properly. Is there a wat transformation matrix of each character in the scripting engine? If not, is it possible to get this in the SDK? Or do i really have to expand the text, get two points as reference for each character, calculat ethe transform and then copy?
Any ideas.
Yeah I found a more in depth description of how to do this with the API here. Seems that its a bit badly documented indeed. I would have wished to try to avoid using the API for this becasue it would just make it harder for me to deploy the thing.
Copy link to clipboard
Copied
Hi @J5E74, I have no experience with the prcoesses you mention, so please forgive me if I have too many questions due to my ignorance. Here goes.
1. What is a "skeletonized" character? Can you show in outline mode maybe? Do you mean a single stroked line making up the glyph? That wouldn't be easy to script at all.
2. Are you sure you mean "transformation matrix"? In a given text frame item, every glyph has the same transformation matrix. I can't imagine why finding the transformation matrix would help with anything. Maybe you are thinking of another term?
3. What is the reference document? Sounds very interesting!
4. The script of Carlos' you linked-to, seems to divide up a text frame into individual characters. Is that what you want? I have written my own version of a text dividerāif you post a sample file (save as pdf to post here)āI can try it out. Or let me know if you want me to post the script.
5. You mention getting two points as reference for each character and calculating the transform? Can you show an example of what you are doing? It is hard to picture without more information.
- Mark
Copy link to clipboard
Copied
1. What is a "skeletonized" character? Can you show in outline mode maybe? Do you mean a single stroked line making up the glyph? That wouldn't be easy to script at all.
Its the midline of a character. Im not asking how to do this ive allready done this part. And yes i know how to also do this automatically in most cases, but thst not the cleanest solution so i prefer to draw a clean midline (and sometimes not follow it like in the B character example). Besides i might not want the skeleton as i might want to do a zigzag for embroidery.
If i would be in outline mode you'd see even less than now on account of characters being solid in outline mode and the lines that are now in red would be black, really hard to see black on black. But that image is as close as a outline mode as you can get.
2. Are you sure you mean "transformation matrix"?
Yes, absolutely, transformation matix has all the full info. In text frames sure the orientation is the same, but translation and rotation may be changed by character. Clearly in a text to curve object each character is separate orientation.
3. What is the reference document? Sounds very interesting!
Any document that has the individual glyph data and what it should be replaced with.
4. The script of Carlos' you linked-to, seems to divide up a text frame into individual characters. Is that what you want? I have written my own version of a text dividerāif you post a sample file (save as pdf to post here)āI can try it out. Or let me know if you want me to post the script.
Sort of, it does nearly what i want, but it does not attack text on curve objects and it does not account for kerning or individual character skaling or rotation.
5. You mention getting two points as reference for each character and calculating the transform? Can you show an example of what you are doing? It is hard to picture without more information.
An affine 2D transformation matrix has 6 degrees of freedom. Two points have 4 degrees of freedom. If I assume that the shape has not been skewed then thats enough (unlike indesign illustrator does not allow for skewing of characters independently of base object). Since i can solve for rotation with dot product between original 2 points and new 2 points. I can solve for scale by calculating magnitude. Postion is just the first point to point difference. But yes i could take 3 points if i want to solve skew.
Copy link to clipboard
Copied
Thanks for the detailed response @J5E74. Very interesting. I've never thought about some of those details before and you have opened my eyes a bit. It makes sense that via the SDK you can get the transform matrix of each glyphāthat the scripting API doesn't seem to provide. I am the same as Dirk, too, in that I have never encountered the hard/soft points idea. Also the idea that there are references to render (or convert?) glyphs for different processes, eg. embroideryāwell this seems sort of obvious now that you say it, but it is a concept I've never thought about.
Anyway, all the best with your project.
Copy link to clipboard
Copied
From the SDK, file ATESuites.h
file IText.h
So either way you can retrieve the matrix of a run and concat the tx per glyph in the run. A new rotation in your type on path would give you a new run. Note that this is talking about glyphs, so it might differ from characters at the scripting level e.g. when multiple characters are combined into a ligature, or the opposite way (dependent on the font's implementation). Therefor you'd deal with glyph shapes at the same level.
Copy link to clipboard
Copied
Yeah I found a more in depth description of how to do this with the API here. Seems that its a bit badly documented indeed. I would have wished to try to avoid using the API for this becasue it would just make it harder for me to deploy the thing.
Copy link to clipboard
Copied
Interesting, I had not yet come across the concept of hard/soft points.