Copy link to clipboard
Copied
Hey Guys,
I have the source text of a layer referencing the comp name. I'd to edit the comp name and it update on the text layer. This is my code.
compName = comp("Liam Carlin").name.replace(/a/gi,"a");
However I am not trying to replace the letter a with the same letter a I wasnt to replace it with a different glyph version of that font family. Is it possible? I am unable to paste the correct glyph letter into the expression editor as it just see it as the letter 'a'.
Thanks
Liam
Copy link to clipboard
Copied
You need to force it with string.fromCharCode().
Mylenium
Copy link to clipboard
Copied
Thanks Mylenium, I'll dig into this and if stuck will get back! Cheers 🙂
Copy link to clipboard
Copied
Where would I be going wrong from here?
compName = comp("Liam Carlin").name.replace(/a/gi, String.fromCharCode(u+0061));
Thanks
Liam
Copy link to clipboard
Copied
I'm not clear what you are asking. You need to explain better what you are having issues with.
Mylenium
Copy link to clipboard
Copied
Thanks Mylenium,
So I am trying to replace the letter 'a' with a different style 'a'. The first image titled 'Default a' is the a you get when typed by default. The second image 'Different style a' is the style of a want. Is it possible to access this style a through the String.fromCharCode()?
The 'a' I would like is references as this in the illustrator glyphs pallette u+0061. If input 61 into the method it returns a but the incorrect a.
Thanks
Liam
Copy link to clipboard
Copied
String.fromCharCode() uses the regular decimal code, i.e. the linear enumeration in the order in which the glyphs are stored in the font file/ character set. You need to find out what that number is. There are tables for that.
Mylenium
Copy link to clipboard
Copied
Thanks Mylenium. So I can see when referencing the unicode tables that '97' and '0061' both work for a small latin letter a. When I look at the glyph I want in illustrator it give me this.
U+0061 (ss05). So I understand the 0061 is for a small latin letter 'a' but I do not know how to incorporate the 'ss05' as I think this is the actual 'a' that I am after.
Any ideas?
Thanks
Liam
Copy link to clipboard
Copied
With a little further digging I used the charCodeAt() Method with the correct 'a' I wanted. I ran this method in the source text. It came back as '97' which is the unicode decimal value for 'a' but not the a I want.
I don't think what I am trying to acheive is possible. Thats a shame but lots learned!
Copy link to clipboard
Copied
Hey Liam!
Sorry to dig this up after such a long time, did you ever get this to work?
Copy link to clipboard
Copied
Hey Finn,
Unfortunatley I didn't. It's not possible from the AE end. I spoke with Adobe and they said something along the lines of needing to code a actual plugin (c++) to have that kind of functionality and this was a couple of years ago.
The scripting side of things has changed. Check out the changelog from Oct 23 - https://ae-scripting.docsforadobe.dev/introduction/changelog.html
Cheers,
Liam