Jump to content

Change size of "@" character in email field


MeeshKB

Recommended Posts

I apologize if this has been answered elsewhere. My search didn't turn up anything, but I was having a challenge figuring out the most efficient search terms.

 

I need to create a rule which will find the @ character in the email field and change its size. Our client has chosen a font with a ridiculously large @ symbol, and their solution in offline typesetting has been to reduce the size of that character by 2 points. I would like to replicate this in FusionPro.

 

I am thinking a replace rule would do the trick but I am not sure how to apply formatting tags to that. Am I on the right track? How might this be achieved?

Link to comment
Share on other sites

Thanks so much, Dan. This works like a charm.

 

So, just so I understand what this code is doing, here is my understanding.

 

The ReplaceSubstring indicates the function.

The first segment of code indicates the affected field.

The "@" indicates the item to be replaced.

The third segment of the code defines the magnification factor for the "@", then resets it to normal for the remaining text.

 

Correct?

Link to comment
Share on other sites

So, just so I understand what this code is doing, here is my understanding.

 

The ReplaceSubstring indicates the function.

The first segment of code indicates the affected field.

The "@" indicates the item to be replaced.

The third segment of the code defines the magnification factor for the "@", then resets it to normal for the remaining text.

 

Correct?

Yes, that's correct.

Link to comment
Share on other sites

Don, that works perfectly too. Thank you.

 

In terms of understanding the code, the only thing I don't recognize is the /@/g. Obviously the /@/ defines the character to be replaced, but what is the g? Can you please give me a quick explanation of that bit?

Link to comment
Share on other sites

As I understand the "g" is for global, so it would do the replace for every instance in the variable field. So it may not be needed for just a single email field.

 

Learning this stuff on the fly the best I can and it is a slow process.

Link to comment
Share on other sites

  • 1 month later...

How can I adjust my existing rule:

return Field("Email").replace(/@/g,'<span pointSize="7"font="Monaco">@</span>');

 

To add superscripting of the @ symbol. The font wanted doesn't line up on the baseline with the text font so I thought I could use superscripting to get it inline.

 

I have this rule for superscripting but need a little help on how to combine the two correctly.

var s = Field("Email");
return s.replace(/\@/g,"<superscript>@</superscript>");

 

TIA

Edited by dreimer
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...