Jump to content

Copyfit adjust font size then tracking


Recommended Posts

Is it possible to alter the Copyfit rule to first reduce the font size to a particular point (8 pt), and then if the text still doesn't fit, adjust the tracking? I'm not very familiar with javascript, so any help is appreciated. Thanks!
Link to comment
Share on other sites

I think you want something like this:

var minPointSize = 8;
if (!Copyfit(new MagnifyAttributes("text", 25, 400, minPointSize, 72)))
   // If it doesn't fit at the minimum point size,
   // fix to that size, then try to copyfit by reducing tracking.
   FusionPro.Composition.CurrentFlow.content = '<span pointsize=' + minPointSize + '>' +
                           FusionPro.Composition.CurrentFlow.content + '</span>';
   if (!Copyfit(new MagnifyAttributes("tracking", 25, 400, 50, 100)))
       ReportWarning("Could not copyfit text in flow " + 

A couple of caveats here:


One, this will set all of your text in the flow (frame) to the same size. Normally, you can copyfit a flow where the text size varies, and everything will be shrunk by the same factor, but it probably won't all end up the same size. In this case, though, if the first copyfit doesn't work, we use the span tag to fix it all to that point size, then apply tracking.


Two, the parameters of the MagnifyAttributes object for the "tracking" mode are tricky, because they're all percentages. A detailed explanation of how this works is too much for me to type up right now, but basically the second two numbers (50 and 100 in my example above) are the important ones, and the other numbers don't really matter, as long as they are less limiting. Effectively, the code above will reduce the tracking to as little as 50 percent of the nominal (100 percent) tracking.

Link to comment
Share on other sites

  • 1 month later...

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