Hi David,

What you describe is basically correct.  The CopyfitLine function uses
the FusionProTextMeasure object, which, when you call its
CalculateTextExtent method, actually performs a little mini-composition
of the text in a virtual text frame, and then tells you how much space
that text took up, based on the metrics, or "outlines," of the font(s)
used, and other aspects of setting that text in the frame.

So the FusionProTextMeasure object is where the real power is.  Think of
the CopyfitLine function as merely an example of one way to use that
object.  You can do a lot more with it.  You can use its properties to
specify all the attributes of the text instead of using tags.  So the
following are equivalent:

    var text = "Here is something to measure";
    var tm = new FusionProTextMeasure;
    tm.useTags = false;
    tm.font = "Arial";
    tm.bold = true;
    tm.pointSize = 1200; // 12 pt
    tm.CalculateTextExtent(text);
    return tm.TextWidth;

And:

    var text = "Here is something to measure";
    var tm = new FusionProTextMeasure;
    var tags = '<f name="Arial"><b><z newsize=12>'
    tm.CalculateTextExtent(tags + text);
    return tm.TextWidth;

And you're correct that bold and italic faces definitely affect the
amount of space that the text takes up.  Technically, when you switch
from a "normal" face of a font to a bold or italic face, you're using a
completely different font, with different glyphs and different metrics,
from a different font file (.pfm, .ttf, .otf, or other file depending on
the type of the font).  However, in both the Text Editor and in its tags
(and therefore in the FusionProTextMeasure object and functions that use
it), FusionPro deals with font families, and abstracts away the fact
that each "font" is actually a family made up of multiple fonts for
various face styles.  This is important because it allows you to write a
tags or a rule that, say, turns a particular range of text to bold,
regardless of what font it's in, just like you can do in HTML and other
similar markup languages.

So you could consider the CopyfitLine function to be deficient because
it doesn't allow you to control bold and italic faces directly with its
arguments in the same way that it lets to specify the font family.  (I
didn't write that particular function, and I probably wouldn't have
written it that way if I did.)  But as I said, you can use <b> and <i>
tags in the text to specify these faces, or you can roll your own
copyfit functionality using the FusionProTextMeasure object.  Again,
think of that function as an example, not as the be all, end all of text
measurement and copyfitting.

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