Jump to content

How to handle overflow with text on a curve


KayEll

Recommended Posts

I'm having to do variable text on a curve, which I figured out. However how do you handle long names? There is no "Overflow" option like in a regular text box, so the long names are wrapping around the curve. I don't want this.

 

Is there a way to say "if the number of characters exceeds 10, decrease the font size to X"? If so, it may be above my level as I usually only write switch rules.

 

Any help would be greatly appreciated! I've searched the forums and haven't found exactly what I'm looking for yet.

 

Thanks

KayEll

Link to comment
Share on other sites

I'm having to do variable text on a curve, which I figured out. However how do you handle long names? There is no "Overflow" option like in a regular text box, so the long names are wrapping around the curve. I don't want this.

I don't have much experience with working with curved text frames, but it seems like you could potentially remove some points/limit the curve that your text is allowed to use by clicking "Edit Curve" and using the "Add Point" and "Delete Point" buttons to get text area the width you desire. Then you could click "Properties" and select "Shrink" as your copyfit option.

 

If you want to handle this in a rule, you can use the "CopyfitLine" function:

var yourText = Field('text');
var font = 'Helvetica';
var fontSize = 12;
var width = 72; // Width of the text before shrinking (in points)
var shrinkSize = 10;
return CopyfitLine('', yourText, font, fontSize, width, shrinkSize);

 

Is there a way to say "if the number of characters exceeds 10, decrease the font size to X"? If so, it may be above my level as I usually only write switch rules.

I think you'd be better off determining when to change the font by the width of the text (above) rather than the number of characters in the string because most fonts are not fixed-width. Basically, the number of characters in a string is not entirely indicative of the width of the string. Notice both strings below have 5 characters:

IIIII

HHHHH

But, since you asked, here's how you could do that:

var yourText = Field('text');
 if (yourText.length > 9) 
   yourText = '<z newsize="[color="Red"]10[/color]">' + yourText;
 return yourText;

And you'd change the 10 to be whatever size you'd want the size to be reduced to if the field has more than 9 characters.

Link to comment
Share on other sites

Thanks Step! I will try it both ways. I did have the same idea about deleting points on the curve. What I am imprinting is very short (a first name) so that's the only reason I thought I could find out which names aren't fitting and come up with a fairly accurate character count based on that.

 

Thanks for the quick response. I'll let you know which way works best.

 

KayEll

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...