Jump to content

Copyfit warning if type does not fit after reduced size


Recommended Posts

When the user inputs copy, copyfit reduces typesize to accomodate the space available in the frame, but the final typesize cannot be less than 12 point. When the user inputs more copy than space available, and the type has already reduced to a minimum 12 pt size, I need to display a warning. I cannot get the warning to display when the text exceeds the space available in the frame.

 

if (!Copyfit(new MagnifyAttributes("text", 25, 400, 12, 72)))

{

if (FusionPro.Composition.CurrentFlow.name == "contentcopyfit")

{

FusionPro.Composition.CurrentFlow.content =

'<para style="(no style)"><f name="Arial Bold"><z newsize="14.0"><color name="Pantone 202 C">' +

"YOU HAVE ENTERED TOO MUCH INFORMATION."

}

}

else if (Copyfit(new MagnifyAttributes("text", 25, 400, 12, 72)))

{

if (FusionPro.Composition.CurrentFlow.name == "contentcopyfit")

{

FusionPro.Composition.CurrentFlow.content = ""

}

}

Link to comment
Share on other sites

I had a similar problem when I first tried to implement this scenario. The code I am now using successfully is

if (!Copyfit(new MagnifyAttributes("text", 50, 400, 8, 72))) {
   ReportWarning("Could not copyfit text in flow " + FusionPro.Composition.CurrentFlow.name);
   FusionPro.Composition.CurrentFlow.content = '<span color="Red">' + 
       "PLEASE ADJUST YOUR TEXT TO FIT IN THE SPACE PROVIDED!" + '</span>' +
       FusionPro.Composition.CurrentFlow.content;
}

Link to comment
Share on other sites

Try this:

if (!Copyfit(new MagnifyAttributes("text", 25, 400, 12, 72)))
{
   if (FusionPro.Composition.CurrentFlow.name == "contentcopyfit")
   {
       FusionPro.Composition.CurrentFlow.content =
       '<para style="(no style)"><f name="Arial Bold"><z newsize="14.0"><color name="Pantone 202 C">' +
       "YOU HAVE ENTERED TOO MUCH INFORMATION." + '</para>';
   }
}

The key is the ending </para> tag. Also, note that you don't need the "else" clause at all; either the copyfit succeeds, or you show the warning message.

Link to comment
Share on other sites

The rule I posted above works fine and shows the message in the frame for me, without adding any other content. You might need to make sure that the warning message itself fits in the frame, though. Or there might be something else different about your job that I'm missing; it's hard to know without looking at it.
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...