• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

.replace() to change letter into a different glyph

Participant ,
May 20, 2020 May 20, 2020

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 

TOPICS
Expressions

Views

2.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 20, 2020 May 20, 2020

Copy link to clipboard

Copied

You need to force it with string.fromCharCode().

 

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 20, 2020 May 20, 2020

Copy link to clipboard

Copied

Thanks Mylenium, I'll dig into this and if stuck will get back! Cheers 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 20, 2020 May 20, 2020

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 21, 2020 May 21, 2020

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 21, 2020 May 21, 2020

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

 

Default a.png

Different style a.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 21, 2020 May 21, 2020

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 22, 2020 May 22, 2020

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 27, 2020 May 27, 2020

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! 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 16, 2024 Feb 16, 2024

Copy link to clipboard

Copied

Hey Liam!
Sorry to dig this up after such a long time, did you ever get this to work?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 18, 2024 Mar 18, 2024

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines