Hi David,

The CopyfitLine function (which you can look at in Builtins.js) has this
signature:

  function CopyfitLine(staticpart, dynpart, font, size, width, minimum,
justwidth)

The function generates an <f name="XXX"> tag based on the "font"
parameter.  The font name in this context must be the family name of the
font, which is the same name that appears in the drop-down list in the
Text Editor.  This is different than the PostScript name, which
generally has no spaces in it.  And the family name generally doesn't
have any bold or italic designations; those call out different faces of
the font in the same family.

If you use the "View Source" button for a Formatted Text Resource, you
will see the proper <f> tag for the font.  You won't see any markup like
"<b>Helvetica 55 Roman".  Instead, you'll see something like:

    ... <f name="Helvetica 55 Roman"><z newsize="10.0"><color
name="Black"><b>This is some text ...

As you can see, the <b> and <i> tags denoting bold and italics are not
part of the <f> tag at all, and therefore do not belong in the font name
passed to the CopyfitLine function.  Whatever is in that "name"
parameter of the <f> tag in the View Source dialog is what you need to
use in CopyfitLine.  If the font is loaded properly, it should work both
in composition and in the CopyfitLine function.

As I said in our off-list exchange, the CopyfitLine function does
generate an <f> tag based on the family name provided as a parameter to
the function, but you can override that with your own <f> tag in the
content you're passing it.  You can also put <b> and <i> tags in the
content (the second "dynpart" parameter) to change the face.  You just
can't put the <b> and <i> tags in the "font" parameter.  I suppose that
the function could have more parameters to specify these styles, but
again, it was something we were trying to keep somewhat simple.  You can
always copy the source code for CopyfitLine from Builtins.js and make
your own customized version of the function to do whatever you want
using the FusionProTextMeasure object, which allows you to control all
typographical elements which may affect the measurement, either with
markup tags or with properties on the object itself.

Here's an example of a modified version of CopyfitLine that has
parameters to specify bold and italic face, as well as the font name:

    function MyCopyfitLine(text, font, bold, italic, size, width,
minimum, justwidth)
    {
      var tm = new FusionProTextMeasure;
      tm.maxWidth = -1;
      var newsize, retcode;

      basetags = "<f name=\"" + font + "\"><z newsize=" + size + ">";
      if (bold)
        basetags += "<b>";
      if (italic)
        basetags += "<i>";

      newsize = size;

      do
      {
        tags = basetags;
        tags += (justwidth) ? "<setwidth " : "<z ";
        tags += "newsize=" + newsize + ">" + text;
        retcode = tm.CalculateTextExtent(tags);
        if (tm.textWidth > width * 100) 
           newsize -= 0.1;
      } while (newsize > minimum && tm.textWidth > width*100 && retcode
== 0);

      if (tm.messages != "")
      {
        if (FusionPro.inValidation)
          ThrowError("CopyfitLine", tm.messages);
        else
          Print("CopyfitLine: " + tm.messages);
      }

      return tags; // + " " + tm.textWidth + " " + width*100;
    } 

You can put this function, or your own version, directly in the rule in
which you are using it.  Or you can add it to your JavaScript Globals,
or even to a plug-in script.  Please do not edit Builtins.js, though.

Dan


+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
Calling all FP Web Users!

Do you have a question or lots of knowledge to share about FusionPro Web?

If so, join our Printable Web to Print Users' Forum today!

Send email to [EMAIL PROTECTED] to find out how!
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-


--
Users of FusionPro Desktop have unlimited free email support. Contact Printable 
Support at [EMAIL PROTECTED]
--
View FusionPro Knowledge Base, FusionPro Samples at
www.printable.com/vdp/desktop.htm

--
You are currently subscribed to fusionpro as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
--


--
Note:  All e-mail sent to or from this address will be received or otherwise 
recorded by the e-mail recipients of this forum. It is subject to archival, 
monitoring or review by, and/or disclosure to someone other than the recipient. 
Our privacy policy is posted on www.printplanet.com
--

Reply via email to