Jump to content

Character Spacing


ksulliv1

Recommended Posts

Hi, is it possible to add character spacing to a text variable using JS? I have a situation where I have serveral text variables in a row, on a single line, and they don't have the same character spacing for each one, so I can't get away with just using the tracking feature, because it requires all variables on a line to be the same, which is a pain. I would like to be able to use different tracking for each variable, but can't. So I am wondering if I can do it via a rule applied to each variable, and make the spacing different for each rule?

 

Thanks

Link to comment
Share on other sites

Ok so if I want to use the tracking tag <tracking newsize=nn...</tracking> to resize the characters in a variable. Do I just enter the tag synatx in the variable text editor window on either side of the variable once I have inserted it, or do I have to create a rule?

 

Thanks

Link to comment
Share on other sites

I have a form field set up as "PhoneType1" and I have it set up as a drop down list that returns either "office" "Cell" or "Fax". But I want the returned selection's characters to be stretched a little (tracking). So I insert the variable "PhoneType1" into the window of the variable text editor, and add the syntax before and after it so it reads:

 

<tracking newsize=150>PhoneType1</tracking>

 

and when I click ok and get back to the preview it shows up exactly like that except it does honor the drop down list selection in the flat file for Office. So now on the template itself it reads:

 

<tracking newsize=150>Office</tracking>

 

instead of just the work "Office" stretched to 150%

 

How do I do this correctly?

Link to comment
Share on other sites

You were right in your OP in that you need to create a rule to return tagged output, and check the box in the rule editor window to treat returned text as tagged. Potentially, your rule can be as simple as:

return "<tracking newsize=150>" + PhoneType1 + "</tracking>";

Link to comment
Share on other sites

I just copied your code from your 2nd post. I assumed it was a pre-defined variable. If not, you'll need to replace "PhoneType1" with the actual field, variable, or raw text that contains your data. :rolleyes:
Link to comment
Share on other sites

Great thanks, I thought I tried that and it didn't work right. But I think I may have just forgot to check the box for showing as tagged text in the rule editor the first time. But it works fine now.

 

Thanks again

Link to comment
Share on other sites

Here is another question to make this even more difficult. Now that the tracking is set correctly, is there also a way to add some custom horizontal spacing to this same variable? It is smaller type than the variable next to it, but it is not aligned to be even with the bottom of the type, it is rasied to be centered in respect to the larger type next to it. And I will have two or three of these all on one line, so is it possible with JS or should I just try to make each of the fields on the line to be seperate text boxes, instead of all one line of a single text box? I have attached an example of what it looks like.

raised.pdf

Link to comment
Share on other sites

  • 2 weeks later...
My suggestion would be to make graphics for the static "OFFICE", "CELL" and "MAIL" text with the height of the file equal to the height of the variable text and the text centered top to bottom in the graphic. Then add the graphics as inline graphics to the text frame using rules to return the proper graphics based on content of their related fields. Don't forget to add consistent spacing to the sides of the static text in your graphics since the variable text will bump up against the edge of the inline graphics.
Link to comment
Share on other sites

So then there is no way that anyone knows of to write a rule for a specific field that sets both custom tracking and custom leading at the same time, like is shown in the example PDF above?

All you need to do is put the labels (OFFICE, CELL, MAIL) in superscript in the Variable Text Editor. You can tweak the superscript ratio and offset in the Global Paragraph Settings dialog without writing any additional rules.

 

Or, you can set the ratio and offset on a per-paragraph basis with the attributes of the <p> tag. Something like this:

return '<p br=false quad=C superratio=60 superoffset=20>' +
       '<color name="Blue"><superscript>OFFICE</superscript></color>&[size=3]#[/size][size=2]3[/size]2;<tracking newsize=50>' + NormalizeEntities(Field("PhoneType1")) + '</tracking>&[size=3]#[/size][size=2]3[/size]2;' +
       '<color name="Blue"><superscript>CELL</superscript></color>&[size=3]#[/size][size=2]3[/size]2;<tracking newsize=50>' + NormalizeEntities(Field("PhoneType2")) + '</tracking>&[size=3]#[/size][size=2]3[/size]2;' +
       '<color name="Blue"><superscript>MAIL</superscript></color>&[size=3]#[/size][size=2]3[/size]2;<tracking newsize=50>' + NormalizeEntities(Field("Address1")) + '</tracking>';

Link to comment
Share on other sites

Yeah I tried the super/sub script deal in the text editor and it does work for what I was trying to do, however once I do, it seems to completely negate the tracking rule I had set up for those variables. So the position is correct horizontal but for the labels but the extra tracking is gone.

 

I will have to see if I can manage an understanding of your second option, and try that.

 

Thanks,

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...