Jump to content

Break the Line of Text if it is Too Long


Admin1676454018

Recommended Posts

// This rule checks the length of the text line and, if it is too long to fit on the line, breaks the text to the next line.

 

var wholeLine = Field("addr1")+" "+Field("addr2")+" "+Field("city")+" "+Field("state")+" "+Field("zip");

 

TextBlock1 = new Array(wholeLine);

fontSize1 = 6.5;

maxWidth1 = 198

TM1 = new FusionProTextMeasure;

TM1.font = "Gotham-Book";

TM1.pointSize = fontSize1*100;

longestLine1 = 0

// TM1.CalculateTextExtent(TextBlock1[0]);

// return TM1.textWidth/100

for (i=0;i<TextBlock1.length;i++)

{

TM1.CalculateTextExtent(TextBlock1);

currentWidth1 = TM1.textWidth/100

if (currentWidth1 > longestLine1)

{

longestLine1 = currentWidth1;

}

}

//return currentWidth1

if (longestLine1 > maxWidth1)

{

return Resource("2lineaddrresource");

}

else

{

return Resource("1lineaddrresource");

}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...