MeeshKB Posted May 15, 2014 Share Posted May 15, 2014 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? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted May 15, 2014 Share Posted May 15, 2014 Something like this: return ReplaceSubstring(Field("Email"), "@", '<magnify factor=80>@<magnify factor=125>'); Quote Link to comment Share on other sites More sharing options...
dreimer Posted May 15, 2014 Share Posted May 15, 2014 Think this should work. Assuming you used 10 point for the email field. return Field("Email").replace(/@/g,'<span pointSize="8">@</span>'); Quote Link to comment Share on other sites More sharing options...
MeeshKB Posted May 15, 2014 Author Share Posted May 15, 2014 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? Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted May 15, 2014 Share Posted May 15, 2014 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. Quote Link to comment Share on other sites More sharing options...
MeeshKB Posted May 15, 2014 Author Share Posted May 15, 2014 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? Quote Link to comment Share on other sites More sharing options...
dreimer Posted May 15, 2014 Share Posted May 15, 2014 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. Quote Link to comment Share on other sites More sharing options...
MeeshKB Posted May 15, 2014 Author Share Posted May 15, 2014 I hear you on that, Don. I'm in the same boat. I'm so grateful for the folks around here who are willing to share their knowledge. Thanks so much for your help! Quote Link to comment Share on other sites More sharing options...
dreimer Posted July 3, 2014 Share Posted July 3, 2014 (edited) 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 July 3, 2014 by dreimer Quote Link to comment Share on other sites More sharing options...
David Miller Posted July 3, 2014 Share Posted July 3, 2014 Have you tried adding the superscript tags to your existing code: return Field("Email").replace(/@/g,'<span pointSize="7"font="Monaco">[color="Red"]<superscript>[/color]@[color="red"]</superscript>[/color]</span>'); Edits are in red above. Quote Link to comment Share on other sites More sharing options...
dreimer Posted July 3, 2014 Share Posted July 3, 2014 Thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.