kkeiz Posted October 25, 2013 Share Posted October 25, 2013 Hello, I have several variables in the same text frame and I don't want the text to wrap to another line if it doesn't fit. I also don't want to use copyfitting as I don't want the point size to change. The text needs to be truncated if too long. Variables in text frame: <FirstName><MiddleName><Last Name> <Title> Data File Values: FirstName: Samantha MiddleName: M. LastName: Smithwicks-Jefferson Title: Administrator; Broker; Realtor; Office; Manager; Owner; President I have tried the text measurement code from another posted thread and it did work when I wrote the rule for the <Title> line field - but does not work correctly for the NAME line fields which are nested in the same rule - see blue in code below: __________________________________________________ function TruncateText(text, font, pointSize, width) // width and pointSize in hundredths of points { var TM = new FusionProTextMeasure; TM.useTags = false; TM.maxWidth = width; TM.font = font; TM.pointSize = pointSize; for (var partial = text; partial; partial = partial.substr(0, partial.length - 1)) { TM.CalculateTextExtent(partial); if (TM.textLines <= 1) return partial; } throw "Nothing fits"; } return TruncateText('<uppercase>' + (NormalizeEntities(Field("FirstName")) + " " + (Field("MiddleName")) + " " + (Field("LastName")) + '</uppercase>'), "Aller Bold", 1000, FindTextFrame("Untitled1").GetSettableTextWidth()); __________________________________________________ Here is the result when I compose: SAMANTHA M. SMITH Administrator; Broker; Realtor; Offi The name line is breaking too short - it should be truncating the same width (approx.) as the title line above. It does seem to break correctly when I remove <uppercase>, but I need the name in all caps. Also, depending on where I placed <uppercase> I was getting different results in where the names broke. Any assistance would be appreciated. My apologies for the length of this message! Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted October 25, 2013 Share Posted October 25, 2013 It does seem to break correctly when I remove <uppercase>, but I need the name in all caps. Also, depending on where I placed <uppercase> I was getting different results in where the names broke. You have tags in the text you're measuring, so you need to change the second line of your function to: TM.useTags = true;The other option is to leave that set to false and remove all the tagging from the text. You do this by removing the call to NormalizeEntities, and, instead of using tags, using a JavaScript function to turn the text to uppercase, like so: return TruncateText(ToUpper(Field("FirstName") + " " + Field("MiddleName") + " " + Field("LastName")), "Aller Bold", 1000, FindTextFrame("Untitled1").GetSettableTextWidth()); Quote Link to comment Share on other sites More sharing options...
kkeiz Posted October 25, 2013 Author Share Posted October 25, 2013 Thank you Dan - that worked! Quote Link to comment Share on other sites More sharing options...
Imposition_Novice Posted October 29, 2013 Share Posted October 29, 2013 I have a pdf file made in Corel Draw which was supplied by the customer. It's a simple numbering job wherein the text box I created from Fusion Pro is not transparent and seem to be mirroring. I have to flatten the file in photoshop in order get the numbering sequence properly. Is there something I can do within the pdf to avoid this mirroring issue or the file created from Corel should be buried with Windows Vista. Tried preflighting and didn't work. I'm on Fusion Pro Ver. 9.1.0 Windows 7Guest Meal Ticket-template-preflight.pdf Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted October 30, 2013 Share Posted October 30, 2013 I have a pdf file made in Corel Draw which was supplied by the customer. It's a simple numbering job wherein the text box I created from Fusion Pro is not transparent and seem to be mirroring. I have to flatten the file in photoshop in order get the numbering sequence properly. Is there something I can do within the pdf to avoid this mirroring issue or the file created from Corel should be buried with Windows Vista. Tried preflighting and didn't work. I'm on Fusion Pro Ver. 9.1.0 Windows 7 Please start a new thread with a new question, instead of replying to an existing thread. 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.