Skip to main content
Participating Frequently
February 13, 2015
Answered

script to auto kern after typing

  • February 13, 2015
  • 3 replies
  • 2914 views

Hello all !  I am curious is it feasible to create a script that will automatically kern specific letter pairings after typing them?
I've been scouring the forum and found something like it here Scripted custom kerning tables | Peter Kahrel.  


What I would like is to be able to type and whenever one of the 29 letter combinations that need to be kerned occurs the script will auto kern it

Any thoughts or help to point me in the right direction would be greatly appreciated !
Thanks all in advance!

This topic has been closed for replies.
Correct answer Peter Kahrel

If you really want to do that, the only way is to use tracked pairs in GREP styles -- you can't set specific kern values in character styles.

1. Determine which track values you need. Say you find that in order to fix the pair Vx you need to track -100. Remember that kern values are applied to insertion points, track values to characters, so type Vx, select the V, and track until the pair looks right.

2. Create a character style track -100 and set its tracking to -100.

3. Add a GREP style to your paragraph style(s) that applies the character style track -100 to V(?=x)

4. Do the same for all other 28 pairs. You need a new character style for every track value.

This solution is usable only in short documents. Long documents with many GREP styles tend to become very sluggish. Another disadvantage of this method is that you can define kern/track pairs only for characters in the same font. GREP style can't distinguish different font styles.

Peter

3 replies

Community Expert
May 18, 2022

I think, there is one thing to add in this thread.

The links to Peter Kahrel's scripts and script descriptions:

 

Landing page for all scripts by Peter Kahrel:

https://creativepro.com/files/kahrel/indesignscripts.html

 

Adjust kerning
https://creativepro.com/files/kahrel/indesign/kern.html

( last update today, May 18th, 2022 )

 

Create kerning report

https://creativepro.com/files/kahrel/indesign/kern_report.html

 

The link to the script in the initial post here is from 2015 and does not work anymore.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Willi Adelberger
Community Expert
Community Expert
May 17, 2022

Sometimes it might be easier and faster to use optical instead of metric kerning. Often bad designed fonts can be improofed.

Community Expert
May 17, 2022

Hi Willi,

I agree. Plus a certain amount of tracking.

 

Best,

Uwe Laubender
( Adobe Community Professional )

Peter Kahrel
Community Expert
Peter KahrelCommunity ExpertCorrect answer
Community Expert
February 15, 2015

If you really want to do that, the only way is to use tracked pairs in GREP styles -- you can't set specific kern values in character styles.

1. Determine which track values you need. Say you find that in order to fix the pair Vx you need to track -100. Remember that kern values are applied to insertion points, track values to characters, so type Vx, select the V, and track until the pair looks right.

2. Create a character style track -100 and set its tracking to -100.

3. Add a GREP style to your paragraph style(s) that applies the character style track -100 to V(?=x)

4. Do the same for all other 28 pairs. You need a new character style for every track value.

This solution is usable only in short documents. Long documents with many GREP styles tend to become very sluggish. Another disadvantage of this method is that you can define kern/track pairs only for characters in the same font. GREP style can't distinguish different font styles.

Peter

Community Expert
February 15, 2015

you can't set specific kern values in character styles

@Peter – there were times you could save specific kern values in character styles.
If I remember it right, it could be done in InDesign CS3 and CS4 (maybe also in CS2).

However in CS5 and above that wouldn't be possible.

Also: Exported IDML files from CS4 and opened with CS5 and CS5.5 lost that value.

See the following German discussion about kerning and character styles here in the InDesign Scripting Forum of hilfdirselbst.ch:

Zeichenformat mit benutzerdefiniertem Kerningwert per Skript anlegen - Adobe InDesign Skriptwerkstatt - HilfDirSelbst.c…

My conclusion:
One can still work around that problem, but it will require scripting of IDMS snippet files (to change some properties of character styles there!) and place that edited snippets in InDesign.

Uwe

Peter Kahrel
Community Expert
Community Expert
February 15, 2015

Uwe,

It's true that there was a way in CS3 and CS4 to get kern values in a character style, but at the time Dave Saunders commented that it was a hack which might not survive into later InDesign versions. And it turns out that he was right to warn us all. Anyway, since there is a perfectly workable method using tracking, I don't think that scripting IDMS snippets is a perticularly good solution.

Peter