Jump to content

setting properties through FindTextFrame


bhm8hwcm

Recommended Posts

I was wondering if it is possible to set the following attributes for text in a frame:

- size of text

- color of text

- set copyfitting on or off for a frame

 

if so can you give examples of how to set these things. i have not been able to figure out from user guide and rules guide.

Link to comment
Share on other sites

bhm8hwcm,

Can you elaborate on your "FindTextFrame" part in the title? Not sure how or if you are using this. You can set these text properties using Tags. For detailed info on all FPML tags refer to the "Tags Reference Guide." Copyfitting is set on or off per frame, so I'm not sure what you need specifically.

 

- size of text

- color of text

 

When using these be sure to check the box for "Treat return strings as tagged text" and close the tag. Guide Pg. 46

Font Size = <z newsize="size">

 

Color can be done in several ways, but as long as your document has the color name listed, you can just reference it by name. Guide Pg. 47

Font Color = <color name="red">

 

Hope this helps

Link to comment
Share on other sites

I was wondering if it is possible to set the following attributes for text in a frame:

- size of text

- color of text

- set copyfitting on or off for a frame

 

if so can you give examples of how to set these things. i have not been able to figure out from user guide and rules guide.

Well, the size and color of text are not generally properties of the entire frame, since obviously text traits can vary within a frame (flow), even character-by-character. So normally you would just use a text rule to modify the text and then place that rule into the frame as a variable.

 

But if you really want to override the size and color of all the text in a frame, you can do this either in the OnRecordStart rule or in the OnCopyfit rule with the span tag.

 

In OnRecordStart, you can do something like this:

// OnRecordStart
var myTextFrame = FindTextFrame("Title");
myTextFrame.content = '<span color="Red" pointsize="10">' + 
       myTextFrame.content + '</span>';

Although, like I said, you can also return a span tag from a regular rule and place that rule's variable at the start of the frame.

 

Turning copyfitting on and off has to be done in the OnCopyfit rule. First, you need to actually turn on copyfitting for the frame. (Note that this doesn't necessarily mean that the text will be copyfitted, just that the OnCopyfit rule will be called for the frame/flow.) Then it's just a matter of conditionally calling the Copyfit function in the OnCopyfit rule, like so:

// OnCopyfit
if (FusionPro.Composition.CurrentFlow.name == "Title")
   return; // turn off copyfitting by returning

// Default OnCopyfit rule below:
if (!Copyfit(new MagnifyAttributes("text", 25, 400, 6, 72)))
   ReportWarning("Could not copyfit text in flow " + 
                 FusionPro.Composition.CurrentFlow.name);

Of course, if you are already doing this, then you can modify the text here as well, instead of in OnRecordStart, like so:

// OnCopyfit
if (FusionPro.Composition.CurrentFlow.name == "Title")
{
   FusionPro.Composition.CurrentFlow.content =
       '<span color="Red" pointsize="10">' + 
       FusionPro.Composition.CurrentFlow.content + '</span>';

   return; // turn off copyfitting by returning
}

// Default OnCopyfit rule below:
if (!Copyfit(new MagnifyAttributes("text", 25, 400, 6, 72)))
   ReportWarning("Could not copyfit text in flow " + 
                 FusionPro.Composition.CurrentFlow.name);

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...