Jump to content

Variable character limit + sync text frames for same text size


Recommended Posts

Hello everybody,


First, what I need is rule to limit the amount of characters in a variable + add three dots, this should be easy. I can adjust the limit as needed.


Second, I need 4 variable text frames to use the same type size, so if one variable is reduced, I need all 4 of them reduced to the same size. The variables can range from 15 characters to 100+ characters.


All this needs to be put into 1 rule.


Hope the screen shot helps in understanding what I need.




Link to comment
Share on other sites

The first part you could accomplish with something like this:

var limit = 10;
return (Field("Your Field").length <= limit) ? Field("Your Field") : Left(Field("Your Field"),limit) + "...";


For the second part, I would think you'd just replace the 4 text frames with one. Is there any reason you aren't doing that? If you're doing it just to keep it in line with the images, you could just pull those in as inline graphics and apply font changes globally.

Link to comment
Share on other sites

The vertical space between the lines of text must stay the same, if the font get's reduced, then this would change that.

That's not really true. If you have inline graphics which are larger than the text, then the leading (line spacing) will be controlled by the graphics, so making the text smaller should have no effect. But if you really want to make sure that the leading is fixed, then in the Text Editor, click the Paragraph button, and then click "Absolute Leading" and specify a size; then you don't need to use inline graphics at all. (You could alternatively create a table, where you can use the Row.minHeight property.)


As for the character limit, you can certainly hard-code a specific number of characters. However, that's not really the best way to determine whether text fits in a specific area, or how to truncate it, because (depending on the font), different letters have different widths. (A row full of 10 capital "W"s will take up a lot more space than a row of lower-case "i"s.) So your best bet is to use Text Measurement, with the FusionProTextMeasure object. If you search for FusionProTextMeasure here on the forum, you'll find lots of examples, such as this recent one:


Finally, if you really do want to copyfit multiple frames using the same point size, searching this forum for "copyfit multiple frames" turns up several thread, such as this one:


But, I will reiterate that, instead of doing that, I think you're better off just using a single frame with absolute leading between lines.

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.

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