Jump to content

Horizontal Copyfit two line equally


mddarfus

Recommended Posts

I'm creating 24 x 30" yard signs for a real estate company. I am trying to copyfit two variables (a "First Name" field and a "Last Name" field), onto two separate lines, inside one text box (the box being 1374 points in width). The trick being that both the font for the "First Name" line and the "Last Name" line needs to end up being scaled by the same amount, so that the individual letters making up either the first or last name is not larger than the other.

 

example: CHRISTOPHER

SMITH

 

If I use the rule below, I end up with the letters in SMITH being much wider than the letters in CHRISTOPHER.

 

I need a rule that can take the horizontal fit measurement from the longer of the two variables, and then apply it to both.

 

//set as a global function

function CopyfitLineHorizontal(str, font, size, width, minimum, justwidth)

{

var tm = new FusionProTextMeasure;

tm.maxWidth = -1;

var newsize, retcode, i;

var trackInt = new Array(0, -1, -2, -3, -4, -5);

 

basetags = "<f name=\"" + font + "\">";

newsize = size;

i = 0;

 

do

{

tags = basetags;

tags += (justwidth) ? "<setwidth " : "<z ";

tags += "newsize=" + newsize + "><tracking newsize=" + trackInt + ">" + str;

retcode = tm.CalculateTextExtent(tags);

(i < 5) ? i++ : i=5;

if (tm.textWidth > width * 100)

newsize -= 0.1;

} while (newsize > minimum && tm.textWidth > width*100 && retcode == 0);

 

return tags; // + " " + tm.textWidth + " " + width*100;

}

 

//used to return "First Name" variable

return CopyfitLineHorizontal(Rule("ALL CAPS First name"), "Pluto Bold", 245, 1374, 72, false);

 

//used to return "Last Name" variable

return CopyfitLineHorizontal(Rule("ALL CAPS Last name"), "Pluto Bold", 245, 1374, 72, false);

Link to comment
Share on other sites

I would think the simplest solution would be to just enable full-flow copyfitting on the text frame. (From the Text Frame palette, click Overflow, then click "Adjust text to fit.") This will adjust all the text in the frame by the same factor. If you have other content in the frame, just move that into a separate frame.
Link to comment
Share on other sites

Dan,

 

The trouble is the full-flow copyfitting with Overflow turned on causes the text to scale way too small. Actually it almost looks like it scales everything down to 72 pt... perhaps that's a maximum in the default copyfit rule? Or perhaps it applies the scale to both the horizontal and vertical axis by default? But what I need it to do is scale only horizontally, and have that horizontal scale factor be applied equally to both lines.

 

This is a pretty big text block on a House For Sale sign that gets hung on a pole in the yard. Unfortunately 72 pt type just won't be big enough to see from the street ;')

Link to comment
Share on other sites

I was able to work it out by editing the default OnCopyFit rule to the following:

 

if (!Copyfit(new MagnifyAttributes("textwidth", 25, 400, 6, 245)))

ReportWarning("Could not copyfit text in flow " +

FusionPro.Composition.CurrentFlow.name);

 

Just had to change the MagnifyAttributes("text"... to MagnifyAttributes("textwidth"...

 

and the maximum point size from 72 to 245

Link to comment
Share on other sites

The trouble is the full-flow copyfitting with Overflow turned on causes the text to scale way too small. Actually it almost looks like it scales everything down to 72 pt... perhaps that's a maximum in the default copyfit rule? Or perhaps it applies the scale to both the horizontal and vertical axis by default? But what I need it to do is scale only horizontally, and have that horizontal scale factor be applied equally to both lines.

 

This is a pretty big text block on a House For Sale sign that gets hung on a pole in the yard. Unfortunately 72 pt type just won't be big enough to see from the street ;')

Yes, you're using all the default copyfitting settings. In the OnCopyfit rule, you can change both the type of adjustment made (point size, setwidth, leading, etc.), and the minimum and maximum point sizes and magnification factors. This is documented in the User Guide; search for "MagnifyAttributes". Or search here in the forum; I've detailed all the MagnifyAttributes parameters here:

http://forums.pti.com/showpost.php?p=72&postcount=5

 

So, to scale only horizontally, change the first parameter of MagnifyAttributes to "textwidth". And you need to set the default maximum point size (the last parameter) to something larger than the default of 72. I would just set it to the size you're starting with, 245 points. And you probably want the minimum to be something larger than the default 6 points, like 100.

 

So your OnCopyfitRule should look like this:

if (!Copyfit(new MagnifyAttributes("textwidth", 25, 400, 100, 245)))
   ReportWarning("Could not copyfit text in flow " + 
                 FusionPro.Composition.CurrentFlow.name);

Or, to be a bit more verbose:

var copyfitSettings = new MagnifyAttributes();
copyfitSettings.type = "textwidth"; // adjust width only
copyfitSettings.factormin = 25; // minimum 25% of starting size
copyfitSettings.factormax = 400; // maximum 400% of starting size
copyfitSettings.min = 100; // minimum 100 points
copyfitSettings.max = 245; // maximum 245 points

if (!Copyfit(copyfitSettings))
   ReportWarning("Could not copyfit text in flow " + 
                 FusionPro.Composition.CurrentFlow.name);

The other thing you'll need to do to make the "textwidth" magnification work without breaking the lines up is to edit the text for the frame, and in the Variable Text Editor, select all the text, click Paragraph, then click "Do not break on Copyfit."

 

Also, please take note of my comment in the post linked above regarding large format jobs. You don't necessarily need to output a PDF that's 24 inches tall; the press should be able to scale it up from a smaller size.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...