Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library > Formatting Text

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old May 15th, 2014, 09:44 AM
MeeshKB MeeshKB is offline
Regular Contributor
 
Join Date: Jun 2012
Location: Alberta, Canada
Posts: 64
Default Change size of "@" character in email field

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?
__________________
Michelle
Digital Services Coordinator at Rileys (print and electronic services provider) in Alberta, Canada
FusionPro VDP 9.1.0, Windows 7, Acrobat Pro XI , InDesign CS6, Avanti eAccess, EFI Digital Storefront
Reply With Quote
  #2  
Old May 15th, 2014, 10:45 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,381
Default Re: Change size of "@" character in email field

Something like this:
Code:
return ReplaceSubstring(Field("Email"), "@", '<magnify factor=80>@<magnify factor=125>');
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #3  
Old May 15th, 2014, 10:48 AM
dreimer dreimer is offline
Senior Contributor
 
Join Date: Oct 2010
Location: Shakopee, MN
Posts: 473
Default Re: Change size of "@" character in email field

Think this should work. Assuming you used 10 point for the email field.

Code:
return Field("Email").replace(/@/g,'<span pointSize="8">@</span>');
__________________
Don Reimer - JavaScript Novice

MAC OS 10.13.6 Acrobat DC FP Creator 10.1.11
Windows 7 Acrobat X 10.1.4 FP Creator 9.3.9
Reply With Quote
  #4  
Old May 15th, 2014, 11:11 AM
MeeshKB MeeshKB is offline
Regular Contributor
 
Join Date: Jun 2012
Location: Alberta, Canada
Posts: 64
Default Re: Change size of "@" character in email field

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?
__________________
Michelle
Digital Services Coordinator at Rileys (print and electronic services provider) in Alberta, Canada
FusionPro VDP 9.1.0, Windows 7, Acrobat Pro XI , InDesign CS6, Avanti eAccess, EFI Digital Storefront
Reply With Quote
  #5  
Old May 15th, 2014, 11:13 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,381
Default Re: Change size of "@" character in email field

Quote:
Originally Posted by MeeshKB View Post
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.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #6  
Old May 15th, 2014, 11:15 AM
MeeshKB MeeshKB is offline
Regular Contributor
 
Join Date: Jun 2012
Location: Alberta, Canada
Posts: 64
Default Re: Change size of "@" character in email field

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?
__________________
Michelle
Digital Services Coordinator at Rileys (print and electronic services provider) in Alberta, Canada
FusionPro VDP 9.1.0, Windows 7, Acrobat Pro XI , InDesign CS6, Avanti eAccess, EFI Digital Storefront
Reply With Quote
  #7  
Old May 15th, 2014, 11:27 AM
dreimer dreimer is offline
Senior Contributor
 
Join Date: Oct 2010
Location: Shakopee, MN
Posts: 473
Default Re: Change size of "@" character in email field

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.
__________________
Don Reimer - JavaScript Novice

MAC OS 10.13.6 Acrobat DC FP Creator 10.1.11
Windows 7 Acrobat X 10.1.4 FP Creator 9.3.9
Reply With Quote
  #8  
Old May 15th, 2014, 11:34 AM
MeeshKB MeeshKB is offline
Regular Contributor
 
Join Date: Jun 2012
Location: Alberta, Canada
Posts: 64
Default Re: Change size of "@" character in email field

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!
__________________
Michelle
Digital Services Coordinator at Rileys (print and electronic services provider) in Alberta, Canada
FusionPro VDP 9.1.0, Windows 7, Acrobat Pro XI , InDesign CS6, Avanti eAccess, EFI Digital Storefront
Reply With Quote
  #9  
Old July 3rd, 2014, 10:00 AM
dreimer dreimer is offline
Senior Contributor
 
Join Date: Oct 2010
Location: Shakopee, MN
Posts: 473
Default Re: Change size of "@" character in email field

How can I adjust my existing rule:
Code:
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.
Code:
var s = Field("Email");
return s.replace(/\@/g,"<superscript>@</superscript>");
TIA
__________________
Don Reimer - JavaScript Novice

MAC OS 10.13.6 Acrobat DC FP Creator 10.1.11
Windows 7 Acrobat X 10.1.4 FP Creator 9.3.9

Last edited by dreimer; July 3rd, 2014 at 10:18 AM..
Reply With Quote
  #10  
Old July 3rd, 2014, 11:24 AM
David Miller David Miller is offline
Senior Contributor
 
Join Date: Oct 2008
Location: Wallingford, CT
Posts: 263
Default Re: Change size of "@" character in email field

Have you tried adding the superscript tags to your existing code:

Code:
return Field("Email").replace(/@/g,'<span pointSize="7"font="Monaco"><superscript>@</superscript></span>');
Edits are in red above.
__________________
David Miller
FusionPro VDP Creator 10.0.26
Adobe Acrobat Pro 2019.008.20074
Suitcase Fusion 20.0.0 (7653)
macOS High Sierra 10.13.6
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:39 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.