EvanF Posted March 13, 2014 Share Posted March 13, 2014 I have a right justified Email, and I need to align the Cellphone line to the left most extents of the Email line. I have a formatting issue I've been trying to tackle, however the FusionProTextMeasure seems to be limited by a defined point size, so when copyfit takes over the measurement is no longer accurate. I'm not sure if this is even the best way to approach this as I'm quite new to FusionPro. This approach calculates the size of both lines, subtracts them to get the difference and tosses that into a rindent tag format for the cellphone line. var rightIndentSize = function () { // Default Pt Size var ptSize = "6 pt"; // Email Size var emailString = "email: " + Rule("Email_Format"); var emailTM = new FusionProTextMeasure; emailTM.pointSize = ptSize; emailTM.font = "Helvetica"; emailTM.useTags = false; emailTM.CalculateTextExtent(emailString); // Cellphone Size var cellString = "cell: " + Rule("Cellphone_Format"); var cellTM = new FusionProTextMeasure; cellTM.pointSize = ptSize; cellTM.font = "Helvetica"; cellTM.useTags = false; cellTM.CalculateTextExtent(cellString); // Calculate difference in size var tmWidth = (emailTM.textWidth - cellTM.textWidth); return tmWidth; } return "<p rindent=" + rightIndentSize() + ">" + "cell: " + Rule("Cellphone_Format") + "</p>"; I'd like to have this work with copyfit as some of the emails are bound to get quite long. Also it would be nice if the rules weren't hard coded for font sizes, might make the rules a little more versatile. Any help is much appreciated. Thanks, EvanArchive.zip Quote Link to comment Share on other sites More sharing options...
step Posted March 13, 2014 Share Posted March 13, 2014 I think it has to do with using the right indent. If you left justify your text box, remove the email rule from it, you can simplify things a bit by modifying your "Test_testbox" rule to look like this: var frameWidth = 1.89 * 7200; // 1.89 inches var email = "email: " + ToLower(Field("Email")); var cell = "cell: " + Rule("Cellphone_Format"); // Email Size var emailTM = new FusionProTextMeasure; emailTM.pointSize = "6 pt"; emailTM.font = "Helvetica"; emailTM.useTags = false; emailTM.italic = true; emailTM.CalculateTextExtent(email); var indent = frameWidth-emailTM.textWidth; return "<p findent=" + indent + ">" + cell + "</p><br><p findent=" + indent + ">" + email + "</p>"; It's essentially indenting the email address to be right aligned and indents the cellphone number the same amount (from the left). Copyfit works with those modifications. Quote Link to comment Share on other sites More sharing options...
EvanF Posted March 13, 2014 Author Share Posted March 13, 2014 Thank you! Appreciate the quick reply. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted March 13, 2014 Share Posted March 13, 2014 (edited) You can do this without writing a rule at all. One way is to just type whatever you need into the Text Editor, and put a tab in between the two parts. Then click the Tabs button, and in the Edit Tab Stops dialog, add a right-aligned tab stop, with the position just a bit less than the width of the frame. Edited March 13, 2014 by Dan Korn typo Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted March 13, 2014 Share Posted March 13, 2014 Also, just a comment on this: however the FusionProTextMeasure seems to be limited by a defined point size That's true only if you have the useTags property of the FusionProTextMeasure object set to false. If you set it to true, then you can use multiple <z newsize=***> and other formatting tags in the text, which can have as many "runs" of text with different point sizes and other attributes as you want, and it will measure the entire thing. Quote Link to comment Share on other sites More sharing options...
EvanF Posted March 20, 2014 Author Share Posted March 20, 2014 You can do this without writing a rule at all. One way is to just type whatever you need into the Text Editor, and put a tab in between the two parts. Then click the Tabs button, and in the Edit Tab Stops dialog, add a right-aligned tab stop, with the position just a bit less than the width of the frame. Can you provide a sample of this as it doesn't seem to work as you describe. As the solution Step provided isn't quite working as intended. Quote Link to comment Share on other sites More sharing options...
Dan Korn Posted March 20, 2014 Share Posted March 20, 2014 Can you provide a sample of this as it doesn't seem to work as you describe. As the solution Step provided isn't quite working as intended. Okay, here you go.FusionProTabExample.pdf Quote Link to comment Share on other sites More sharing options...
PabloTI Posted March 13, 2015 Share Posted March 13, 2015 Thanks for giving the example using tabs and right align. Solved a problem I was having with a variable menu board. When ever a price was over 9.99 it was pushing the numbers out of alignment. Using tab and right align made it all line up nicely. 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.