script to auto kern after typing

Community Beginner ,
Feb 13, 2015 Feb 13, 2015

Copy link to clipboard

Copied

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!

TOPICS
Scripting

Views

1.1K

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Feb 15, 2015 Feb 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 p...

Likes

Translate

Translate
Adobe Community Professional ,
Feb 15, 2015 Feb 15, 2015

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 15, 2015 Feb 15, 2015

Copy link to clipboard

Copied

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

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 15, 2015 Feb 15, 2015

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Feb 15, 2015 Feb 15, 2015

Copy link to clipboard

Copied

@Peter – of course it was something like a hack back then. The trick was to select the right character (it was the left one of the pair kerned, I think, to define the character style).


Using tracking is definitly a solution. A good one.

I only wanted to mention the hack, because sometimes features get lost when InDesign is advancing in version numbers. And that's a pity…

Fwiw: Adobe fixed the IDML bug not transferring the kerning values of manual kerning in character styles with CC v9.2.0 I think. Or was it CC 2014.1? Still have to test that…

Uwe

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 17, 2015 Feb 17, 2015

Copy link to clipboard

Copied

peterark‌ wow i wasn't aware of this feature in indesign thanks for the tip! it works exactly how i would like

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

Hello Peter

I am using your kern.jsx script

I must say its a wonderful script and I am currently using it in Indesign document which is in Urdu Language which is RTL.

The issue is when I dbl click on the script, it applies it to all the stories, in fact the whole document. I wanted to apply the script to only the active story or the selected lines. Is it possible?
Thanks so much

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

Hello @shahidr100 -- That's indeed possible, and if I hadn't forgotten to point that out in the script's web page, that would have been helpful. I updated the page and it now explains how to show the interface.

The script hasn't changed, no need to download it again. To display the interface, open the script in a plain-text editor and change this line (it's at the top of the script):

main (false);

to this:

main (true);

That's all. Save the script, and now when you run it and you have selected some text, you can choose to run the script against the selected text, the selection's story, the active document, or all open documents if you have more than one document open.

 

Peter

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

Thank you so much Peter. It worked.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

Hi Peter,

I have run into a problem in kern.jsx script.

I have two users on my Windows 10 computer. For user 1 the script is
working fine but when I am using the same script in User 2, the script is
not able to find the kern database text file which I copied from user 1.

The font I am using is Jameel Noori Nastaleeq. This is the name show in
Fonts dropdown in InDesign. I created a kern_Jameel Noori Nastaleeq.txt
file and started as follows:

===Regular Regular
\x{0631}\x{0642} -140

This same script is working in User 1 but not in User 2.
I recreated the file with kern_report script also but no change.

What am I doing wrong?
Thanks.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

LATEST

I think I know what's going on, but because this is specific to the script, not to this thread, let's go private. Please write to me at pkahrel@gmail.com

P.

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

Hi Willi,

I agree. Plus a certain amount of tracking.

 

Best,

Uwe Laubender
( Adobe Community Professional )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 17, 2022 May 17, 2022

Copy link to clipboard

Copied

Yes, but I’m still a bit upset, that Adobe doesn’t integrate real user defined kerning pairs, as Quark (and some other applications) has done ever since.

Its a pitty that this topic has not very much supporters:

https://indesign.uservoice.com/forums/601021-adobe-indesign-feature-requests/suggestions/31111675-ke...

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

I don't like optical kerning particularly. It's a great feature in itself (especially engineering-wise) and it often makes things a bit better, but that's not good enough: you want it very good, all the time.

A kerning editor is badly needed in InDesign. More votes needed for the request that Tobias linked to!

P.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

I’m completely with you, Peter!

 

I placed this feature request in Uservoice in mid 2017. Before uservoice, I requested this since InDesign CS1 (2002!) every single year with the web form, which was available at that time for transmitting feature requests.

Nothing ever happened.

 

I suspect, that InDesign “marketing” says: “Hey, you can use Optical Kerning, it’s a cool feature!!”

But, as you said: It’s nice, but not perfect. We need all of them: metricial kerning, optical kerning, AND user defined kerning tables!

 

Thanks, Tobias

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

Hi Tobias,

voted today to support your feature request at InDesign UserVoice.

 

Thanks,
Uwe Laubender
( Adobe Community Professional )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

Me too voted today.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 18, 2022 May 18, 2022

Copy link to clipboard

Copied

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 )

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines