MarcomCentral (PTI) and FusionPro User Communities

MarcomCentral (PTI) and FusionPro User Communities (http://forums.pti.com/index.php)
-   Formatting Text (http://forums.pti.com/forumdisplay.php?f=32)
-   -   Right Justified text, and left line alignment (http://forums.pti.com/showthread.php?t=3724)

EvanF March 13th, 2014 10:52 AM

Right Justified text, and left line alignment
 
1 Attachment(s)
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.

Code:

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,
Evan

step March 13th, 2014 11:31 AM

Re: Right Justified text, and left line alignment
 
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:
Code:

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.

EvanF March 13th, 2014 12:01 PM

Re: Right Justified text, and left line alignment
 
Thank you! Appreciate the quick reply.

Dan Korn March 13th, 2014 01:05 PM

Re: Right Justified text, and left line alignment
 
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.

Dan Korn March 13th, 2014 01:10 PM

Re: Right Justified text, and left line alignment
 
Also, just a comment on this:
Quote:

Originally Posted by EvanF (Post 14571)
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.

EvanF March 20th, 2014 10:02 AM

Re: Right Justified text, and left line alignment
 
Quote:

Originally Posted by Dan Korn (Post 14574)
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.

Dan Korn March 20th, 2014 04:10 PM

Re: Right Justified text, and left line alignment
 
1 Attachment(s)
Quote:

Originally Posted by EvanF (Post 14610)
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.

PabloTI March 12th, 2015 06:53 PM

Re: Right Justified text, and left line alignment
 
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.


All times are GMT -7. The time now is 09:10 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.