Jump to content

Need help with replacing spacing


tbender

Recommended Posts

I am having an issue with one of my fonts. The spacing between characters is to tight with certain combos, specifically, "L." The period almost merges into the L. First I spaced out the font but that looked bad. I was able to use the ReplaceSubstring command to replace with "L space ." This is to much space. What I would like to figure out is if I am using say a 8 point font to add a narrow space such as a 2pt space. Is there any way I can specify the amount of space on this? Let me know if this is not clear, I am pretty new at using advanced rules.
Link to comment
Share on other sites

First, do you have kerning enabled? In the Text Editor, select the paragraph in question, then click the Paragraph button. If the Kerning box is checked, try unchecking it, or vice-versa.

 

Second, you could try a different font, at least for the period/dot character.

 

Third, you could try using an entity such as   or   for a smaller space.

Link to comment
Share on other sites

Forth, you might try adding the Tracking Tag to your Replace Substring command and remove the space between the "L" and "Period".

 

<tracking newsize=[color="Red"]150[/color]>L.</tracking>

 

Adjust the value in red accordingly. The tracking value is written as a percentage of the typeface's default value.

Link to comment
Share on other sites

The kerning off and on does not fix my issue. I have not done rules to replace fonts or use special characters, do you have an example of how the rule would be written? Basically I need to replace L. and E. with either a narrow space between the letter and period or change the font for the period. I think the narrow space would probably be better. Thanks for the help, I appreciate it.
Link to comment
Share on other sites

I have not done rules to replace fonts or use special characters, do you have an example of how the rule would be written? Basically I need to replace L. and E. with either a narrow space between the letter and period or change the font for the period. I think the narrow space would probably be better.

Something like this:

var text = TaggedTextFromRaw(Field("Your Field Name"));
text = ReplaceSubstring(text, "L.", "L .");
text = ReplaceSubstring(text, "E.", "E .");
return text;

Or, using Regular Expressions:

return TaggedTextFromRaw(Field("Your Field Name")).replace(/([LE])(\.)/g, "$1 $2");

Make sure to check the "Treat returned strings as tagged text" box.

Link to comment
Share on other sites

The thinspace is not working, I tired to put the tracking into the replacesubstring command, but I am not doing this right, can you let me know how I would combine these? I appreciate all the help.

Exactly how is it not working? You may need to send the template, along with the font, to Support for analysis. Please do not post the font on this public forum, though.

Link to comment
Share on other sites

Sorry for being vague, it does work but the space is still to big. I was going to try to use the tracking tag as David suggested but could not figure out how to combine that with the replacesubstring command. Let me know if this is possible, thanks again!
Link to comment
Share on other sites

Sorry for being vague, it does work but the space is still to big. I was going to try to use the tracking tag as David suggested but could not figure out how to combine that with the replacesubstring command. Let me know if this is possible, thanks again!

var text = TaggedTextFromRaw(Field("Your Field Name"));
text = ReplaceSubstring(text, "L.", <tracking newsize=150>L.</tracking>");
text = ReplaceSubstring(text, "E.", "<tracking newsize=150>E.</tracking>");
return text;

Link to comment
Share on other sites

var text = TaggedTextFromRaw(Field("Your Field Name"));
text = ReplaceSubstring(text, "L.", [color="Red"]"[/color]<tracking newsize=[color="red"]20[/color]>L.</tracking>");
text = ReplaceSubstring(text, "E.", "<tracking newsize=[color="red"]20[/color]>E.</tracking>");
return text;

 

You'll need to add the quote in red above and adjust the tracking values also in red. ;)

Link to comment
Share on other sites

Ok, this is doing what I need 99%. The tracking tag is adding space between the L and period, but also after the period as well. Is there a way around this?

 

If tracking is affected after the period, try closing the tracking tag before the period.

 

var text = TaggedTextFromRaw(Field("Your Field Name"));
text = ReplaceSubstring(text, "L.", "<tracking newsize=[color="Red"]20[/color]>L</tracking>.");
text = ReplaceSubstring(text, "E.", "<tracking newsize=[color="red"]20[/color]>E</tracking>.");
return text;

Edited by David Miller
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...