Jenn Koder Posted March 24, 2022 Share Posted March 24, 2022 Hi, maybe I'm over thinking this but hopefully someone can help me. I have 4 lines that are set to fit to a 2.25" x 1.25" text frame. I have it set to fit to the frame with 4 similar rules as per the name of the field. If the "name" is only 10 characters long but the "title" is 25 - 30 every field shrinks to the longest field. What I would like is for each field to fit based on it's own attributes. Basically, if I have the text set in the frame to 20 pt I prefer that only the longer information scales down and the 20 pt remains on anything that would fit at that point size. Hope this makes sense. I've attached my file to give a better idea. Thank you!Black Marble Pen Holder 2.5 x 4.5.zip Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted March 30, 2022 Share Posted March 30, 2022 (edited) You were very close. Each rule can just call CopyfitLineWithMagnifyTag to fit itself independently. I tweaked the code just a bit, putting this into the JavaScript Globals: function CopyfitLineWithMagnifyTag(line, width, AllowToExpand) { var tm = new FusionProTextMeasure; tm.CalculateTextExtent(line); if (tm.messages) ReportError("CopyfitMagnifyLine: " + tm.messages); if (tm.textWidth < width && !AllowToExpand) return line; var factor = Round(width / tm.textWidth * 100, 0) - 10; return "<magnify type=text factor=" + factor + ">" + line + "</magnify>"; } function FitInfoLine(fieldName) { var lineText = TaggedDataField(fieldName); var font = Field("Font"); switch (font) { case "Gotham": font = "Gotham Medium"; break; case "Goudy": font = "GoudyOldStyExtBol"; break; } //font = "Arial"; // I used this since I don't have your fonts. var pointSize = 14; var content = '<f name="' + font + '"><z newsize="' + pointSize + '">' + lineText; var frameWidth = FindTextFrame(FusionPro.Composition.CurrentFlow.name || "info").GetSettableTextWidth(); return CopyfitLineWithMagnifyTag(content, frameWidth); } Then each of the four rules become one-liners, like so: return FitInfoLine("Name"); return FitInfoLine("Title"); return FitInfoLine("Department"); return FitInfoLine("SC"); Finally, and this is very important, you need to turn OFF copyfitting for the frame, in the Overflow Options dialog. Edited March 30, 2022 by Dan Korn Quote Link to comment Share on other sites More sharing options...
Jenn Koder Posted April 5, 2022 Author Share Posted April 5, 2022 Thank you very much Dan. I haven't had a chance to try it but this definitely makes sense. As always, I appreciate your help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.