#1
|
|||
|
|||
![]()
I am working on a business card that has very specific design specifications. One of the specifications is if the email cannot fit on one line, to drop the @... to the next line.
short@client.com would fit on one line but reallyreallyreallyreallylong@client.com would display as reallyreallyreallyreallylong @client.com Is there a way to set where the line breaks? In this case, set it to break before the @ symbol. Thank you.
__________________
Meir Galimidi Allegra FP 7.2P1k, MAC OSX 10.5.8, Acrobat 9.4.0 |
#2
|
||||
|
||||
![]()
You can give this a shot:
Code:
// Use TextMeasure to get the length of each company name var tm = new FusionProTextMeasure; var frameWidth = 2; // set width of the text box (in inches) tm.pointSize = "10 pt"; // set the type size tm.font = "Helvetica"; // set your typeface var str = Field("Email"); // set the field to use tm.CalculateTextExtent(str); tm.useTags = false; var tmWidth = tm.textWidth; return (tmWidth < frameWidth*7200) ? str : str.replace("@", "<br>@");
__________________
Ste Pennell FusionPro VDP Creator 9.3.15 Adobe Acrobat X 10.1.1 Mac OS X 10.12 |
#3
|
|||
|
|||
![]()
Thank you very much. That worked great!
__________________
Meir Galimidi Allegra FP 7.2P1k, MAC OSX 10.5.8, Acrobat 9.4.0 |
#4
|
|||
|
|||
![]()
I ran into an error trying to make a more complicated version of that. When I did it with the email field, it worked fine.
Now I am trying to adapt it to work with multiple fields. I need it to determine if a line made up of first last credential1, credential2, credential3, credential 4 is wider than the text box. If so, I need it to break the line after the first name, so the last name starts a new line. I tried this: Code:
var frameWidth = 1.62; // set width of the text box (in inches) // Use TextMeasure to get the length of each company name var names = new FusionProTextMeasure; names.pointSize = "9 pt"; // set the type size names.font = "Bosis Bold"; // set your typeface var strnames = Field("First")+" "+Field("Last"); // set the field to use names.CalculateTextExtent(strnames); names.useTags = false; var namesWidth = names.textWidth; // Use TextMeasure to get the length of each company name var credential = new FusionProTextMeasure; credential.pointSize = "9 pt"; // set the type size credential.font = "Bosis Light"; // set your typeface var strcredential = " "+Rule("Credential Rule"); // set the field to use credential.CalculateTextExtent(strcredential); credential.useTags = false; var credentialWidth = credential.textWidth; return (namesWidth+credentialWidth < frameWidth*7200) ? strnames : strnames.splice(" ", "<br>");
__________________
Meir Galimidi Allegra FP 7.2P1k, MAC OSX 10.5.8, Acrobat 9.4.0 |
#5
|
||||
|
||||
![]()
You should see the error when you validate the rule in the Rule Editor, and also in the .msg file when you do a regular composition (not a Preview).
__________________
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
|
|||
|
|||
![]()
when I validate in the rule editor, it gives me the result I want.
When I compose, I get this error Quote:
Thank you.
__________________
Meir Galimidi Allegra FP 7.2P1k, MAC OSX 10.5.8, Acrobat 9.4.0 |
![]() |
Tags |
copyfit, copyfitline, fusion pro, line break |
Thread Tools | Search this Thread |
Display Modes | |
|
|