#1
|
|||
|
|||
![]()
I currently have 3 rules to change the numbers in the specific field to a different font. These rules work.
RuleAddressFont Code:
return Field("Address").replace(/(\d+)/g,'<f name="Gotham Medium">$1</f>'); Code:
return Rule("RuleFaxFormat").replace(/(\d+)/g,'<f name="Gotham Medium">$1</f>'); Code:
return Rule("RulePhoneFormat").replace(/(\d+)/g,'<f name="Gotham Medium">$1</f>'); 1. Including change in font size & leading for the numbers: Font size with Gotham Medium should be 7pt with 8.4pt leading 2. Including ( ) and - characters in the phone & fax rules If someone can use the phone or fax rule above to show me how to do this, I can then apply it to the others. All help will be much appreciated. Last edited by traba5058; April 6th, 2016 at 04:55 AM.. Reason: To clarify & simplify and hopefully get a response |
#2
|
||||
|
||||
![]()
Right now, you're capturing all numbers and assigning them to the '$1' variable which you then wrap in your font tag. If you want to expand that regexp to include parentheses and hyphens, I think this would work for you:
Code:
return Field("Address").replace(/([\(\)\-\d]+)/g, '<span font="Gotham Medium">$1</span>'); Code:
var find = new RegExp( '(' + // Parenthesis CAPTURE matched patterns and assign them to $1 '[' + // Square brackets denote a character set that the RegExp should match '\\(' + // First character to match: ( <-- Open parenthesis // Note that we escape so we don't start another capture group '\\)' + // Second character to match: ) <-- Close parenthesis '\\-' + // Third character to match: - <-- hyphen '\\d' + // All digits 0-9 ']' + // Close the square brackets because we only want to match what's inside '+' + // Plus sign means we want to match 1 or more of the characters in the [] ')' // Close parenthesis to end capturing ,'g'); // g means "Match globally" // Each captured match is assigned to $1 so we can wrap it in font tags var replace = '<span font="Gotham Medium">$1</span>'; return Field("Address").replace(find,replace);
__________________
Ste Pennell FusionPro VDP Creator 9.3.15 Adobe Acrobat X 10.1.1 Mac OS X 10.12 |
#3
|
||||
|
||||
![]()
Step's solution seems fine, other than not addressing the point size change, although I think this will work as well:
Code:
return Field("Address").replace(/([\d\W]+)/g, '<span font="Gotham Medium" pointsize=7>$1</span>'); https://developer.mozilla.org/en-US/...ar_Expressions As I noted in the other thread, you shouldn't really need to do anything special in the rule for leading. By default, you're automatically going to get 8.4 point leading for a line where the largest text is 7 point. If you need to adjust this, you can change the auto-leading factor in the Paragraph Formatting dialog. Also, if you want, you can put this logic into a function in the JavaScript Globals like so: Code:
function FormatAddressOrPhone(text) { return String(text).replace(/([\d\W]+)/g, '<span font="Gotham Medium" pointsize=7>$1</f>'); } Code:
return FormatAddressOrPhone(Field("Address")); Code:
return FormatAddressOrPhone(Rule("RuleFaxFormat"));
__________________
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:58 PM.. Reason: corrected ending span tag |
![]() |
Tags |
change, family, font, size |
Thread Tools | Search this Thread |
Display Modes | |
|
|