Highlighted

.replace() to change letter into a different glyph

Community Beginner ,
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

1.0K

Likes

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

.replace() to change letter into a different glyph

Community Beginner ,
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

1.0K

Likes

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
May 20, 2020 0
Most Valuable Participant ,
May 20, 2020

Copy link to clipboard

Copied

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

 

Mylenium

Likes

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
Reply
Loading...
May 20, 2020 0
Community Beginner ,
May 20, 2020

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
May 20, 2020 0
Community Beginner ,
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

Likes

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
Reply
Loading...
May 20, 2020 0
Most Valuable Participant ,
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

Likes

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
Reply
Loading...
May 21, 2020 0
Community Beginner ,
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

Likes

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
Reply
Loading...
May 21, 2020 0
Most Valuable Participant ,
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

Likes

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
Reply
Loading...
May 21, 2020 0
Community Beginner ,
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

Likes

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
Reply
Loading...
May 22, 2020 0
Community Beginner ,
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! 

Likes

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
Reply
Loading...
May 27, 2020 0