5 Replies Latest reply on Feb 17, 2015 7:13 AM by mgraphix99

    script to auto kern after typing

    mgraphix99

      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!

        • 1. Re: script to auto kern after typing
          Peter Kahrel Adobe Community Professional & MVP

          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

          • 2. Re: script to auto kern after typing
            Laubender Adobe Community Professional & MVP

            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

            • 3. Re: script to auto kern after typing
              Peter Kahrel Adobe Community Professional & MVP

              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

              • 4. Re: script to auto kern after typing
                Laubender Adobe Community Professional & MVP

                @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

                • 5. Re: script to auto kern after typing
                  mgraphix99 Level 1

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