David Miller Posted March 15, 2009 Share Posted March 15, 2009 I need to Copyfit a single field named Email by horizontal scale only. The Email field is in a text frame containing other variables, but the only variable that needs copyfit is Email. The point size is 8 and the leading is 10. I don't want the point size or leading to change. I don't want to use tracking, just horizontal scale. I don't want it to expand, only contract, if needed. I'm having a difficult time finding a rule to accommodate this. Any help would be appreciated. Thanks! Link to comment Share on other sites More sharing options...
azatko Posted March 15, 2009 Share Posted March 15, 2009 Dave, the CopyfitQS.pdf guide contains a chapter named "Scenario – Copyfitting a line, or part of a line, of text". It seems, that might be what you are looking for. A. Link to comment Share on other sites More sharing options...
David Miller Posted March 16, 2009 Author Share Posted March 16, 2009 Thanks A. According to the document, it looks as if CopyfitLine will allow the field to stretch or stay as is, but not make the font narrower. I'm also confused about implementing it. Should I use it in a Text based rule or a Callback? (I suppose I could try and find out.) I modified the built in OnCopyfit to use textwidth, but it applies it to the entire frame. if (!Copyfit(new MagnifyAttributes("textwidth", 75, 100, 7, 8))) ReportWarning("Could not copyfit text in flow " + FusionPro.Composition.CurrentFlow.name); -Dave Link to comment Share on other sites More sharing options...
azatko Posted March 16, 2009 Share Posted March 16, 2009 Using the link below you can download (not sure how long will the free service keep the file but I expect at least a month) a sample template that shows the CopyfitLine function in action. http://www.ziddu.com/download/3883242/copyfit.zip.html Please note 2 things: 1) the archive does not include the font used in the template - Palatino Linotype. You might want to change the font name in the rule to match the font you want to use. 2) the rule is defined to scale the font size, but you can set the last attribute of the function to "true" and the width of the text string will be adjusted instead of the size. Link to comment Share on other sites More sharing options...
DSweet Posted March 16, 2009 Share Posted March 16, 2009 David, Here's a function that has worked for me in the past. I haven't used is very often though. function CopyfitLineWtextwidth(staticpart, dynpart, font, staticsize, size, minimumwidth, justwidth) { var tm = new FusionProTextMeasure; tm.maxWidth = -1; var newsize, retcode; basetags = "<f name=\"" + font + "\"><setwidth newsize=" + size + ">" + staticpart; newsize = staticsize; do { tags = basetags; tags += (justwidth) ? "<setwidth " : "<z "; tags += "newsize=" + newsize + ">" + dynpart; retcode = tm.CalculateTextExtent(tags); if (tm.textWidth > size * 100) newsize -= 0.1; } while (newsize > minimumwidth && tm.textWidth > minimumwidth*100 && retcode == 0); return tags; // + " " + tm.textWidth + " " + width*100; } CopyfitLine.builtin = true; Good Luck. Link to comment Share on other sites More sharing options...
Dan Korn Posted March 16, 2009 Share Posted March 16, 2009 You call the CopyfitLine function from a regular text rule, not from a Callback rule. You need to supply the effective width of the text frame; if you're using FP 6.0 you can use the new FindTextFrame and FusionProTextFrame.GetSettableTextWidth functions to get the width automatically, otherwise, you'll have to hard-code it. You can also try this: http://forums.printable.com/showthread.php?t=84 Link to comment Share on other sites More sharing options...
David Miller Posted March 18, 2009 Author Share Posted March 18, 2009 Thanks to everyone for the info. Got it working and learned a lot about copyfit in the process. Link to comment Share on other sites More sharing options...
Allegra Posted June 29, 2009 Share Posted June 29, 2009 Hello David, I am not very experienced with Javascript, and I am trying to do pretty much exactly what you needed. I need to contract a whole line of versioned address information, but only if it is to long to fit in one line. It is the only text in the frame, and so far i only know how to expand it. Would you be able to show/send me the final rule you used to contract your feild? Thanks, Meir Galimidi Link to comment Share on other sites More sharing options...
David Miller Posted July 1, 2009 Author Share Posted July 1, 2009 Hi Meir, azatco, DSweet, and Dan Korn are better qualified to answer your question here. My client opted to copyfit the entire text frame the same way, not just the email address, so it was fairly easy. We were able to modify the built-in copyfit rule to work for our template. if (!Copyfit(new MagnifyAttributes("textwidth", 75, 100, 7, 8))) ReportWarning("Could not copyfit text in flow " + FusionPro.Composition.CurrentFlow.name); Whereas, "text" was changed to "textwidth", minimum width was set to 75%, maximum width was set to 100%, minimum point size was set to 7 pt, and maximum point size was set to 8 pt. (The client opted for the original rule posted above because, "everything looked better".) You can set a particular field to do the same. For example, email. I suggest reading "Copfitting in FusionPro" (CopyfitQS.pdf). Start around page 24 for email options. Download azatco's example mentioned above. (It is still available.) You should also take a look at DSweet's and Dan Korn's post above. Thanks, David Miller Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.