Jump to content

Copyfit and overflowing text


Recommended Posts

I have a couple of Clients who don't proof read their work. So I would like to create a warning message in a frame that tells them that their text is overflowing and they need to delete some text.

 

The OnCopyfit rule uses the function ReportWarning() to display an error message in the composition box and log file. Is it possibe to use this function in a textframe and give a warning that they need to adjust the amount of text before they can continue?

Link to comment
Share on other sites

You shouldn't need to do anything. You'll get a message like this in the log file already if the text doesn't fit:

The amount of text inserted into a flow exceeds the depth
of all frames in the flow <Title>.  Text is truncated.

Link to comment
Share on other sites

I understand that I get the message in FusionPro in the log file but I don't get a message when I upload the file to MarcomCentral and proof the product.

 

I've created error messages using textframes before, but not sure how an alert or error message is created in MarcomCentral. Actually is this even possible?

Link to comment
Share on other sites

I understand that I get the message in FusionPro in the log file but I don't get a message when I upload the file to MarcomCentral and proof the product.

 

I've created error messages using textframes before, but not sure how an alert or error message is created in MarcomCentral. Actually is this even possible?

I see. Sorry, I didn't catch that you wanted the warning message to show up in the output file instead of in the log file.

 

Normally, if your question is specific to MarcomCentral, I would direct you to ask it in the MarcomCentral forum rather than in this FP Desktop forum. If you want a message to be raised somehow in the context of the MarcomCentral workflow, and not just shown in the output, then that is definitely a question for that other forum. However, the question of how to show errors in the output is more of a general one, since it can be useful in FP Desktop as well, even in Preview.

 

Anyway, the ReportWarning function doesn't help with changing the output, since all that does is write to the log file. What you want to do is actually replace the text that's getting typeset in the output file. You can do that by turning on Copyfit for the frame, and then, in the OnCopyfitRule, adding a line to change the text contents, like so:

if (!Copyfit(new MagnifyAttributes("text", 25, 400, 6, 72)))
{
   ReportWarning("Could not copyfit text in flow " + 
                 FusionPro.Composition.CurrentFlow.name);
   FusionPro.Composition.CurrentFlow.content = '<para>TEXT DOES NOT FIT IN THIS FRAME!</para>';
}

If you want this message to show without actually doing any copyfitting, you can change the parameters to MagnifyAttributes as well, like so:

if (!Copyfit(new MagnifyAttributes("text", 100, 100, 6, 72)))
{
   ReportWarning("Text does not fit in flow " + 
                 FusionPro.Composition.CurrentFlow.name);
   FusionPro.Composition.CurrentFlow.content = '<para>TEXT DOES NOT FIT IN THIS FRAME!</para>';
}

You could even show the text in red to make it stand out more:

if (!Copyfit(new MagnifyAttributes("text", 100, 100, 6, 72)))
{
   ReportWarning("Text does not fit in flow " + 
                 FusionPro.Composition.CurrentFlow.name);
   FusionPro.Composition.CurrentFlow.content = '<para><color name="Red">TEXT DOES NOT FIT IN THIS FRAME!</para>';
}

You could also get extra tricky and make the warning text fill the entire frame:

if (!Copyfit(new MagnifyAttributes("text", 100, 100, 6, 72)))
{
   ReportWarning("Text does not fit in flow " + 
                 FusionPro.Composition.CurrentFlow.name);
   FusionPro.Composition.CurrentFlow.content = '<para><color name="Red">TEXT DOES NOT FIT IN THIS FRAME!</para>';
   FusionPro.Composition.CurrentFlow.expandToFill = true;
   Copyfit(new MagnifyAttributes("text", 25, 400, 6, 72));
}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...