Jump to content

Changing font with CopyFit


Jason

Recommended Posts

Instead of changing the size of a font when text doesn't fit a box I am looking to change the font. Is this possible using the CopyFit or some other function?

 

Currently I'm working on a business card and instead of making the already small type smaller our client wants to change the font from Helvetica Neue to Helvetica Neue Condensed.

Link to comment
Share on other sites

Are you trying to do full-flow copyfitting, where you click the "Adjust text to fit" box in the Overflow Options dialog? Or are you trying to do single-line copyfitting, with the CopyfitLine function?

 

If you're doing full-flow copyfitting, you can do something like this in the OnCopyfit rule:

if (!Copyfit(new MagnifyAttributes("text", 25, 400, 6, 72)))
{
        FusionPro.Composition.CurrentFlow.content = '<span font="Helvetica Neue Condensed">' + FusionPro.Composition.CurrentFlow.content + '</span>';
        ReportWarning("Could not copyfit text in flow " + 
                          FusionPro.Composition.CurrentFlow.name);
}

If you're doing single-line copyfitting, you can use an alternative function to CopyfitLine, like a variant on my better CopyfitLine function, something like this:

function CopyfitLine_Condense(line, widthInPoints)
{
   var tm = new FusionProTextMeasure;
   tm.CalculateTextExtent(line);
   if (tm.messages)
     ReportError("CopyfitMagnifyLine: " + tm.messages);

   if (tm.textWidth < widthInPoints*100 &&)
     return line;
   //else
   return '<span font="Helvetica Neue Condensed">' + line + '</span>';
}

Where, as with the CopyfitLineWithMagnifyTag function, you'll need to specify the original font and point size with tags.

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