#1
|
|||
|
|||
![]()
I’m attempting to format the email address for a business card template and am stuck.
The database has an email address with First.Last. My current rule is Code:
if (Field("Individual Email") != "") return Field("Individual Email")+"@MyDomain.com" else return "" 1. Changing the . in the field & @MyDomain.com.com to Gotham Medium, 4.5pt with 5.4 pt leading 2. Change the @ symbol to Gotham Medium, 7pt with 8.4 pt leading Any help with this will be much appreciated. |
#2
|
||||
|
||||
![]()
I was working on an answer to your more complicated questions in this thread, but this is a lot simpler.
Code:
var s = TaggedDataField("Individual Email"); if (!s) return ""; //else return s + '<span font="Gotham Medium" pointsize=7>@</span>MyDomain<span font="Gotham Medium" pointsize=4.5>.</span>com'; Also, remember that everything on the same baseline has, by definition, the same leading between that baseline and the previous one, so you can't really have part of the email address with different leading than the rest. Finally, you can certainly set the dot/period character to a different font and point size than the rest of the text, but I am skeptical that any human will be able to notice either a difference in the font or a small difference in point size for that particular character, which is just a single dot, after all.
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral 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)}); ![]() Last edited by Dan Korn; April 6th, 2016 at 03:12 PM.. Reason: Changed to span tags to restore the previous point size as well as the font. |
#3
|
|||
|
|||
![]()
Dan,
Thank you so much for your help on this. I was able to modify it and it works perfectly for the copy. Code:
var s = TaggedDataField("Individual Email"); if (!s) return ""; //else return s + '<f name="Gotham Medium"><z newsize=7>@</f><f name="Telegrafico"><z newsize=9>MyDomain</f><f name="Gotham Medium"><z newsize=7>.</f><f name="Telegrafico"><z newsize=9>com</f>'; |
#4
|
|||
|
|||
![]()
Dan,
I don't know if I'm going about this right or not. I created a new rule for the . in the Email field. RuleEmail-1 Code:
return Field("Individual Email").replace(/\./gi, '<f name="Gotham Medium><new size="7">.</f>'); Can you tell me how to incorporate it into my other rule? RuleEmail-2 Code:
var s = TaggedDataField("Individual Email"); if (!s) return ""; //else return s + '<f name="Gotham Medium"><z newsize=7>@</f><f name="Telegrafico"><z newsize=9>SimpsonHousing</f><f name="Gotham Medium"><z newsize=7>.</f><f name="Telegrafico"><z newsize=9>com</f>'; |
#5
|
||||
|
||||
![]() Quote:
Quote:
Also, the tagging is wrong anyway. Instead of <new size="7"> you should be using the tag <z newsize=7>. If you compose and look at the log file, there will be an error message there saying that it doesn't recognize the tag named "new." So your rule is not actually changing the point size at all. But even if it were changing the point size of the dot to 7, that's not what your stated requirement was. So again, exactly why do you think that it's working? Quote:
Frankly, I still don't understand why you want to change either the font or the point size of the dot (period) characters. How could that possibly make a difference that a person looking at the output could perceive? How would you be look at the output and know whether your dot was 4.5 points or 7, let alone whoever you're sending this output to? That said, if you really think it will matter, I think this might do what you want: Code:
var s = TaggedDataField("Individual Email"); if (!s) return ""; //else var result = s.replace(/\./g, '<f name="Gotham Medium><z newsize=4.5>.</f>'); result += '<f name="Gotham Medium"><z newsize=7>@</f><f name="Telegrafico"><z newsize=9>SimpsonHousing</f><f name="Gotham Medium"><z newsize=7>.</f><f name="Telegrafico"><z newsize=9>com</f>'; return result;
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral 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)}); ![]() |
#6
|
||||
|
||||
![]()
I agree with Dan that setting the leading on individual characters that (I'd imagine) you'd want to stay on the same line, is kind of pointless – so I excluded it from my code. Aside from that, you certainly don't need two JavaScript rules to handle your scenario. In fact, you can do it all at once like this:
Code:
var email = Field("Individual Email"); // If email is empty, return nothing if (!email) return ''; // Else: add the domain email += '@MyDomain.com'; // Replace . and @ return email.replace(/[\.@]/g, function(s) { var size = s == '.' ? 4.5 : 7; return '<span font="Gotham Medium" pointsize="' + size + '">' + s + '</span>'; });
__________________
Ste Pennell FusionPro VDP Creator 9.3.15 Adobe Acrobat X 10.1.1 Mac OS X 10.12 Last edited by step; April 7th, 2016 at 10:11 AM.. |
#7
|
|||
|
|||
![]()
Dan & Stephen,
I'm sorry for my confusion. I've been using FusionPro for a while now but I haven't run into this situation before. This customer has about 60 different business card layouts and I'm finding out that they care changing font (family, size, etc.) for specific characters within a field for more and more of them. If I get the FusionPro templates working, pre-press will not have to manually typeset each card when ordered. The business card uses Telegrafico 9pt. This font is all caps and has no numbers or special characters. The customer uses Gotham Medium for numbers and special characters. Gotham Medium is a larger font, so the copy has to be reduced to 7pt. Forum-BC.pdf is the PDF file from In Design. I took your (Dan's) advice to use 7pt for all Gotham Medium including . rather than reducing it further. When I used your original rule, it changed the font size for Telegrafico text too. So, I updated it to include the font information for the Telegrafico text. I was having trouble just changing the font size for that text, so I added the font name & it worked. Code:
var s = TaggedDataField("Individual Email"); if (!s) return ""; //else return s + '<f name="Gotham Medium"><z newsize=7>@</f><f name="Telegrafico"><z newsize=9>MyDomain</f><f name="Gotham Medium"><z newsize=7>.</f><f name="Telegrafico"><z newsize=9>com</f>'; Code:
return Field("Address").replace(/(\d+)/g,'<f name="Gotham Medium"><z newsize="7">$1</f>'); Right now, I do not have a font formatting rule for the phone & fax. I simply put the format rule in the text frame, highlighted it and selected the font & size. I'm trying to format all of these fields: 1.) Phone & Fax Numbers with Tags 2.) . and @ for email 3.) Numbers in address I split the above formatting into two posts (you & Stephen have responded to both) and am trying to incorporate parts from both posts as well as posts from other people to get this to work. On another card, I have to change the email field to upper case, add @MyDomain.com in upper case and change the @ symbol to 7pt. I have 3 rules & they aren't working together. Rule 3 is the one I have in the template and it's not changing the font size for the @. Rule 1 Code:
var Var1 = "Individual Email"; var CaseSelection = "allcaps"; if(CaseSelection == "allcaps") return ToUpper(Field(Var1)); if(CaseSelection == "smallcaps") return "<smallcap>" + Field(Var1) + "</smallcap>"; if(CaseSelection == "propercase") return ToTitleCase(Field(Var1)); if(CaseSelection == "lowercase") return ToLower(Field(Var1)); Code:
if (Rule("RuleEmailCase") != "") return Rule("RuleEmailCase")+"@SIMPSONHOUSING.COM" else return "" Code:
return Rule("RuleEmail-1").replace(/(\@)/g, '<pointSize=7>@</pointSize>'); |
#8
|
|||||
|
|||||
![]() Quote:
Code:
var email = Field("Individual Email"); // If email is empty, return nothing if (!email) return ''; // Else: add the domain email += '@MyDomain.com'; // Replace . and @ return email.replace(/([\.@])/g,'<span font="Gotham Medium" pointsize="7">$1</span>'); Quote:
Quote:
Quote:
Code:
return '<f name="Telegrafico">' + Field("Address").replace(/(\d+)/g,'<f name="Gotham Medium"><z newsize="7">$1</f><z newsize="9">'); Code:
return Field("Address").replace(/(\d+)/g, '<span font="Gotham Medium" pointsize="7">$1</span>'); Quote:
Have you given the code I posted a try? It seems like it would have solved a lot of your problems. But just to clarify, I'm suggesting that you condense your 3 rules into one: Code:
var email = Field("Individual Email"); // If email is empty, return nothing if (!email) return ''; var CaseSelection = 'allcaps'; switch(CaseSelection){ case 'allcaps': email = ToUpper(email); break; case 'smallcaps': email = '<smallcaps>' + email + '</smallcaps>'; break; case 'lowercase': email = ToLower(email); break; default: email = email; } // Else: add the domain email += '@SIMPSONHOUSING.COM'; // Replace . and @ return email.replace(/([\.@])/g,'<span font="Gotham Medium" pointsize="7">$1</span>'); Code:
var email = Field("Individual Email"); // If email is empty, return nothing if (!email) return ''; email += '@SIMPSONHOUSING.COM'; var CaseSelection = 'allcaps'; switch(CaseSelection){ case 'allcaps': email = ToUpper(email); break; case 'smallcaps': email = '<smallcaps>' + email + '</smallcaps>'; break; case 'lowercase': email = ToLower(email); break; default: email = email; } // Replace . and @ return email.replace(/([\.@])/g,'<span font="Gotham Medium" pointsize="7">$1</span>'); JavaScript Globals Code:
function ReplaceSpecial(text, font, size) { var font = font || 'Gotham Medium'; var size = size || '7'; return text.replace(/([^a-z|<>|\s]+)(?!([^<]+)?>)/gi, '<span font="' + font + '" pointsize="' + size + '">$1</span>'); } Code:
return (Rule("RuleEmailCase")) ? ReplaceSpecial(Rule("RuleEmailCase")+"@SIMPSONHOUSING.COM") : ''; Code:
var twitter = '<span font="Telefico" pointsize="9">' + '@twitter'; return ReplaceSpecial(twitter, 'Arial Bold', 9); /* Returns: <span font="Telefico" pointsize="9"><span font="Arial Bold" pointsize="9">@</span>twitter Note that numbers and special characters within tags are not replaced. The @ sign (originally set to Telegrafico) is overridden by the function and changed to Arial Bold */
__________________
Ste Pennell FusionPro VDP Creator 9.3.15 Adobe Acrobat X 10.1.1 Mac OS X 10.12 Last edited by step; April 8th, 2016 at 10:20 AM.. |
#9
|
|||
|
|||
![]()
Thanks so much! I think I'm getting the hang of this now.
|
![]() |
Tags |
email, font, leading, size, special characters |
Thread Tools | Search this Thread |
Display Modes | |
|
|