View Single Post
  #1  
Old March 13th, 2014, 11:52 AM
EvanF EvanF is offline
Forum n00b
 
Join Date: Dec 2013
Posts: 7
Default Right Justified text, and left line alignment

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
Attached Files
File Type: zip Archive.zip (6.5 KB, 7 views)
Reply With Quote