Jump to content

Highlighting Words of a Text Frame


S_Black

Recommended Posts

I am looking to highlight words within a text frame. But can't find a way that works. I have attempted a rule as such the following, but it doesn't produce what I would expect.

return '<span style="background-color: #FFFF00">highlighted words</span>';

 

I would add a highlight to the background, but the placement of the highlight moves based on variables in the paragraph.

 

Any help would be appreciated.

Link to comment
Share on other sites

There isn't a way to highlight text in FusionPro.

 

If you posted your template, some sample data, and an example of what you're trying to achieve, it might be possible to come up with a solution that gives you the results you're looking for by using other means (for example: a table with cell shading).

Link to comment
Share on other sites

Thanks Step.

 

For now, we are going to communicate with the client to change their paragraph to either omit the highlighted text, or place it before the variable(s) to ensure it does not move.

 

I would still like to know how to control the shading for future projects, and my own education. Attached is a zip file with everything you might need. In this example I am attempting to highlight "ABOVE MARKET TRADE VALUE", which you can see may wrap to a second line.

 

There is no urgency to this, so please don't take extensive time. If there is a resource/video/wiki or anything I can use to self-learn I would be fine with that as well.

10375 Xcel Capital Nissan of Wilmington SignOff.pdf.zip

Link to comment
Share on other sites

Step is correct. There's currently no feature to highlight an arbitrary range of inline text in FusionPro. This is on a list of enhancements we're considering, along with related features like partially transparent or blended text, flipped (mirror image) text, and other effects.

 

For now, I can think of a few possibilities to get something close to what you want.

 

1. I would do something like Step's solution in this thread:

http://forums.pti.com/showthread.php?t=2578

 

You need the text in question on a line by itself, so you need to rearrange the wording a bit, but something like the attached "Dan-1" template should work. Here's the rule:

var fieldVal = "ABOVE MARKET TRADE VALUE"; // This should be a variable field, or the result of another rule.
var text = TaggedTextFromRaw(fieldVal);

var tm = new FusionProTextMeasure;
tm.pointSize = "11 pt"; // set the type size
tm.font = "Helvetica Neue"; // set your typeface
tm.CalculateTextExtent(text);
var tmWidth = tm.textWidth;

var myTable = new FPTable;
myTable.AddColumns(tmWidth); 
var cell = myTable.AddRow().Cells[0];
cell.Margins = { Top:0, Bottom:0, Left:0, Right:0 };
cell.ShadeColor = "C=0 M=0 Y=100 K=0";
cell.ShadePct = 100;
cell.Content = text;
return myTable.MakeTags();

 

2. To keep the text inline, you can use stroked text, as in the attached "Dan-2" template, with a rule like so:

var fieldVal = "ABOVE MARKET TRADE VALUE"; // This should be a variable field, or the result of another rule.
var text = TaggedTextFromRaw(fieldVal);
return '<stroke color="C=0 M=0 Y=100 K=0" width=50>' + text + '</stroke>';

 

3. You can approximate highlighting with a bit of a cheat, as in the attached "Dan-3" template. You need to have a second frame, directly underneath the first, with stroked text, at a thickness so great that it has a "flooded" effect, then use a rule with the "Re-evaluate this rule for every text flow" box check, like this:

var fieldVal = "ABOVE MARKET TRADE VALUE"; // This should be a variable field, or the result of another rule.
var text = TaggedTextFromRaw(fieldVal);
if (FusionPro.Composition.CurrentFlow.name)
   return text;
//else
return '<stroke color="C=0 M=0 Y=100 K=0" width=500>' + text + '</stroke>';

You can play around with the width to tweak this effect. It's not perfect, but it's as close as I can get to a true highlight for inline text.

32172-A_CapitalNissanOfWilmington_Email-Dan-1.pdf

32172-A_CapitalNissanOfWilmington_Email-Dan-2.pdf

32172-A_CapitalNissanOfWilmington_Email-Dan-3.pdf

Link to comment
Share on other sites

  • 4 weeks later...

I was playing with your file and used Illustrator graphics that flow with the type to get a highlight. I also made the text a superscript and changed the global settings to 100/11 so that it would line up with the graphic text. Anyway, thought it might be another way you can try to use to get your highlight next time.

 

Files are attached.

32172 Archive.zip

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