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

That was my experience as well. My theory is that without adding the existing content back, the warning text does not overflow the frame and therefore copyfit is ignored. It's some kind of weird FP wormhole or something. ;)
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

Archived

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

×
×
  • Create New...