Jump to content

Do Not Break On Copy Fit


ksulliv1

Recommended Posts

Hi, I am a little confused about this setting. I have set up a template that had six variables along one line in a text frame. And I don't want the text to wrap to a second line if there is too much information provided by the user. So in the text frame settings window for that frame, using the button for "Overflow" I have selected "discard text that does not fit". And in the variable text editor window for that frame I have set the paragraph formatting for each of the variables to be "Do not break on copy fit". But for some reason when I load the template to our server and enter more information in the fields than will fit, it still just creates a second line of type to accomidate, why, what am I missing?

 

Thanks,

Link to comment
Share on other sites

Hi, I am a little confused about this setting. I have set up a template that had six variables along one line in a text frame. And I don't want the text to wrap to a second line if there is too much information provided by the user. So in the text frame settings window for that frame, using the button for "Overflow" I have selected "discard text that does not fit". And in the variable text editor window for that frame I have set the paragraph formatting for each of the variables to be "Do not break on copy fit". But for some reason when I load the template to our server and enter more information in the fields than will fit, it still just creates a second line of type to accomidate, why, what am I missing?

The "Do not break on copyfit" setting has no effect unless you're actually using Copyfitting. In the Overflow Options dialog, click "Adjust text to fit" to turn it on.

 

Although, if you really only want to copyfit a single line instead of all the text in the flow, you want to be using the CopyfitLine function.

Link to comment
Share on other sites

Thanks Dan, how do I apply the CopyfitLine funtion, where is it within FusionPro and is it covered in any of the user manuals? And just to be sure I made it clear, I don't want the text adjusted in size either bigger or samller. I just want each line (variable) in the text frame not to wrap to another line when the user puts more content in the field than will fit in the width of the text frame. And have any content that is to be discarded.

 

Thanks,

Link to comment
Share on other sites

Dan, will the copyfitline funtion work for what I am trying to do? If I have a 1.5" wide text frame (108 points) that has three variables stacked vertical like this:

 

Name

Title

 

Email

 

and I want any information provided by the user for each of these fields, that ends up being wider than the frame, to be discarded not just wrapped to another line below, is this what I need? I don't want the type to reduced or enlarged at all, just discard anything wider than the frame.

 

If it is and the font is Arial 7 point, what would an example of the call look like? If this isn't going to work for this, is there any other way to do it?

 

Thanks,

Link to comment
Share on other sites

Thanks Dan, how do I apply the CopyfitLine funtion, where is it within FusionPro and is it covered in any of the user manuals? And just to be sure I made it clear, I don't want the text adjusted in size either bigger or samller. I just want each line (variable) in the text frame not to wrap to another line when the user puts more content in the field than will fit in the width of the text frame. And have any content that is to be discarded.

Oh, I see. When you said, "I don't want the text to wrap to a second line," I thought you meant you wanted to shrink it down to fit. That's what the CopyfitLine function does.

 

There's no built-in functionality to simply truncate a line of text. That's not a very commonly requested typesetting feature; usually people want all the text to show up one way or another. "Dropping" text is generally considered about the worst thing you can do. (In fact, I can't remember anyone ever asking to do what you're trying to do in the whole time I've been working on FusionPro. That's why it didn't occur to me.)

 

Anyway, depending how your job is set up, the easiest thing to do might be to simply make the text box wider (even going past the edge of the page), and then cover up the right side of it with another box. In other words, instead of suppressing that extra text, just cover it up.

Dan, will the copyfitline funtion work for what I am trying to do? If I have a 1.5" wide text frame (108 points) that has three variables stacked vertical like this:

 

Name

Title

 

Email

 

and I want any information provided by the user for each of these fields, that ends up being wider than the frame, to be discarded not just wrapped to another line below, is this what I need? I don't want the type to reduced or enlarged at all, just discard anything wider than the frame.

No; again, that's not what CopyfitLine does. The word "copyfit" denotes adjusting something to make it fit, not simply truncating it.

If it is and the font is Arial 7 point, what would an example of the call look like? If this isn't going to work for this, is there any other way to do it?

Well, like I said, it's probably easiest just to cover it up. If you can't do that, though, then I suppose you could do something like this with Text Measurement:

function TruncateText(text, font, pointSize, width) // width and pointSize in hundredths of points
{
   var TM = new FusionProTextMeasure;
   TM.useTags = false;
   TM.maxWidth = width;
   TM.font = font;
   TM.pointSize = pointSize;

   for (var partial = text; partial; partial = partial.substr(0, partial.length - 1))
   {
     TM.CalculateTextExtent(partial);
     if (TM.textLines <= 1)
       return partial;
   }

   throw "Nothing fits";
}

return TruncateText(Field("Name"), "Arial", 700, FindTextFrame("YourFrameName").GetSettableTextWidth());

Put the name of your frame in the call to FindTextFrame in the last line. It's already set for 7-point Arial and the "Name" field. You can put the function into the JavaScript Globals and make a similar rule for each line of text (each field value). Or you can concatenate several calls to the function with <br> tags.

Link to comment
Share on other sites

Wow, thanks a lot for the time you spent considering my issue, I appreciate it a lot.

 

I will try using the call you suggested if I can manage to use it properly, otherwise just use the second text frame to cover the first. Since text frames are set up in inch/decimals, is there a simple formula for converting that to hundredths of points? And how do I put the function in the JS globals, do I just copy all of the code you supplied and paste it at the bottom of the Builtins.js file via notepad after adding an emply blank line after the last line of copy that is already there?

Link to comment
Share on other sites

Since text frames are set up in inch/decimals, is there a simple formula for converting that to hundredths of points?

Sure, you can multiply by 7200 to convert inches to hundredths of points.

 

But you can also simply type values in points, or in any other units, into the Frame Properties palette. Try typing "72.00 pt" and it will turn into "1 in."

 

You can also change your Units preference in Acrobat's Preferences dialog (under "Units and Guides" in Acrobat 9), and the palettes in FusionPro will use the selected units. So if you select Points as your preferred units, the values in the Frame Properties palette will be in points, and you can simply use decimal numbers for hundredths if you need that fine-grain of control.

And how do I put the function in the JS globals, do I just copy all of the code you supplied and paste it at the bottom of the Builtins.js file via notepad after adding an emply blank line after the last line of copy that is already there?

No. Do not edit Builtins.js.

 

From the FusionPro menu in Acrobat, select "Edit Rules," or click the "Edit Rules" button on the toolbar, and in the Rules dialog, click the "JavaScript Globals" button. Copy the body of the function (everything except the last line from the code block in my previous post) into the dialog, and click OK. Then, in a regular rule, you can call the function, as in the last line from my previous post:

return TruncateText(Field("Name"), "Arial", 700, FindTextFrame("YourFrameName").GetSettableTextWidth());

You could also add the function to a custom .js file in your Plug-ins folder and use it in any job on your machine, but it won't get collected up with your job if you go to another machine like it will from the job-specific JavaScript Globals.

Link to comment
Share on other sites

Ok thanks, I have copied and pasted the code (everything but the last line) into the JS Globals and clicked Ok. Then created a new empty text rule and pasted the last line of your code, and changed the frame name to "Frame1" since that is what I have it named in my template.

 

return TruncateText(Field("Name"), "Arial", 700, FindTextFrame("Frame1").GetSettableTextWidth());

 

But when I click validate it says "FindTextFrame not defined"

Link to comment
Share on other sites

But when I click validate it says "FindTextFrame not defined"

Sorry, I didn't notice you were using an older version. Frame properties access via JavaScript was a feature added in FusionPro 6.0. In earlier versions, you'll have to hard-code the frame width, in hundredths of points.

Link to comment
Share on other sites

So instead of using the getsettabletextwidth, I would change it to the width of my text frame in hundredths of points?

 

return TruncateText(Field("Name"), "Arial", 700, FindTextFrame("YourFrameName").8496());

 

It looks like the code is starting with a field set in my document, so I can change this to be the name of any field I want to truncate? And then the name of the font, so again I can change this to be whatever font I am using? And then the font size in hundredths so, also editable to whatever I am using? Then the name of the text frame that the fields are in, and then a reference to the width of the frame?

 

Thanks,

Link to comment
Share on other sites

Oh crap! I just tried the idea of putting another text frame in place to mask additional copy, and realized that is going to work. If my frame looks like this:

 

Name

Title/Position

Email

 

and someone enters a title that is to long to fit the frame width (1.18") it ends up looking like this:

 

Bruce Wayne

Manager, Global Alliances and

Partnerships

bwayne@interphase.com

notice how the email address is now pushed down another line, and in my case, out of position according to the specs. If at all possible I would like to continue pursuing the other option.

Thanks,

Link to comment
Share on other sites

In addition to simply making sure that the frame containing the text is wide enough not to wrap, you also need to turn off Text Wrap on the masking (frontmost) text frame. Select that frontmost frame, and in the Text Frame Properties palette, click on the "Text Wrap Off" icon, which is to the right of the rotation angle box. (You may need to hover the mouse over the icon to see the tool tip.)
Link to comment
Share on other sites

So instead of using the getsettabletextwidth, I would change it to the width of my text frame in hundredths of points?

 

return TruncateText(Field("Name"), "Arial", 700, FindTextFrame("YourFrameName").8496());

No, like this:

return TruncateText(Field("Name"), "Arial", 700, 8496);

It looks like the code is starting with a field set in my document, so I can change this to be the name of any field I want to truncate? And then the name of the font, so again I can change this to be whatever font I am using? And then the font size in hundredths so, also editable to whatever I am using? Then the name of the text frame that the fields are in, and then a reference to the width of the frame?

Yes, except that in versions of FusionPro previous to 6.0, you can't access the frame properties by the frame name.

Link to comment
Share on other sites

  • 2 months later...

Ok, I actually have a customer that is requesting a similar scenario. So Dan, you can make this twice you have seen this request. Ha ha.

 

The issue I have is that I AM using the CopyfitLine function. The client does not want the field to wrap to a second line nor hyphenate (ie. Really long name on a business card). They also do not want the text to drop below a certain point size. When a long name is entered that is beyond the width of the text box, the entire field is dropped and no warning is presented. Logical thought told me to just put character limits on the fields (this is for a marcom product), but character limits do not take into consideration the different widths of different letters. So, whereas 'Johnson' may fit with a 7 character limit 'Mimmson' will not fit because the m's are wider characters.

 

The client would like it if their end user could see what will fit on the proof with characters that will not fit being truncated. This will allow the end user to adjust their input precisely rather than not knowing how much will fit and having to adjust multiple times.

 

I may try using TextMeasure to see if I can truncate the input...hmm

 

Thanks!

IndexxPrep

Link to comment
Share on other sites

Ok, I actually have a customer that is requesting a similar scenario. So Dan, you can make this twice you have seen this request. Ha ha.

 

The issue I have is that I AM using the CopyfitLine function. The client does not want the field to wrap to a second line nor hyphenate (ie. Really long name on a business card). They also do not want the text to drop below a certain point size. When a long name is entered that is beyond the width of the text box, the entire field is dropped and no warning is presented. Logical thought told me to just put character limits on the fields (this is for a marcom product), but character limits do not take into consideration the different widths of different letters. So, whereas 'Johnson' may fit with a 7 character limit 'Mimmson' will not fit because the m's are wider characters.

 

The client would like it if their end user could see what will fit on the proof with characters that will not fit being truncated. This will allow the end user to adjust their input precisely rather than not knowing how much will fit and having to adjust multiple times.

 

I may try using TextMeasure to see if I can truncate the input...hmm

 

Thanks!

IndexxPrep

Combining my solution earlier in this thread with the existing CopyfitLine functionality, I think something like this will do what you want:

// width in hundredths of points
function CopyfitOrTruncateLine(staticpart, dynpart, font, size, width, minimum, justwidth)
{
 var tm = new FusionProTextMeasure;
 tm.maxWidth = -1;
 var basetags = "<f name=\"" + font + "\"><z newsize=" + size + ">" + staticpart;
 var newsize = size;
 var debug = "\n\nFitting to width: " + width + ":";

 var tags;
 do
 {
   tags = basetags;
   tags += (justwidth) ? "<setwidth " : "<z ";
   tags += "newsize=" + newsize + ">" + dynpart;
   var retcode = tm.CalculateTextExtent(tags);
   debug += "\nsize: " + newsize + ", width: " + tm.textWidth;
   if (tm.textWidth > width) 
      newsize = Round(newsize - 0.1, 1);

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

 if (tm.messages)
   FusionPro.inValidation ? ThrowError("CopyfitLine", tm.messages) : Print("CopyfitLine: " + tm.messages);

 if (newsize <= minimum)
 {
   debug += "\nTruncating...";
   Print("Truncating text to fit: " + staticpart + dynpart);

   while (true)
   {
     var retcode = tm.CalculateTextExtent(tags);
     if (tm.messages)
       FusionPro.inValidation ? ThrowError("CopyfitLine", tm.messages) : Print("CopyfitLine: " + tm.messages);

     debug += "\nlength: " + tags.length + ", width: " + tm.textWidth;
     if (tm.textWidth <= width)
       break;

     tags = tags.substr(0, tags.length - 1);
     if (!tags)
       throw "Nothing fits";
   }    
 }

 return FusionPro.inValidation ? tags + debug : tags;
} 

//return TruncateTaggedText("<f name=\"Arial\"><z newsize=20>" + "Name: " + Field("Name"), FindTextFrame("header").GetSettableTextWidth() - 10);

You can call it like so:

return CopyfitOrTruncateLine("Name: ", Field("Name"), "Arial", 20, FindTextFrame("header").GetSettableTextWidth(), 10, false);

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...