Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

advance Kerning

Contributor ,
Aug 02, 2024 Aug 02, 2024

hi everyone see in this pic i have set kerning 80 (kerning in thousand of an em) , these are 100 pages of book , where many many places words are like this with different names kerning set, how we can change these kerning value to 100 through find and replace or grep or any other way fastly ,  i try alot but fail . any help please. thanks in advance. 

 

22.JPG

TOPICS
Bug , EPUB , Experiment , Feature request , How to , Import and export , InCopy workflow , Performance , Print , Publish online , Scripting , SDK , Sync and storage , Type , UXP Scripting
2.5K
Translate
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 Expert ,
Aug 02, 2024 Aug 02, 2024

Hi @rehana36276218, you could try this script by @Peter Kahrel. It applies custom kerning pairs.

- Mark

Translate
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 Expert ,
Aug 02, 2024 Aug 02, 2024

If you set an override or global value for kerning, it will be applied regardless of what the font data specifies for each character. More importantly, it will override the many kerning pairs defined in most fonts, including, most likely, one for the two letters above.

 

Start by resetting this style, or all styles, to "Metrics" kerning (the default) and removing all overrides you may have applied. That should eliminate all these gaps, which your global setting has created. Also check the other two settings noted, for each affected style, as they can have similar effects:

 

JamesGiffordNitroPress_0-1722637952929.png

Translate
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
Contributor ,
Aug 02, 2024 Aug 02, 2024

i want to increase kerning gap between characters , how we can do it in paragraph style . didn't solve my issue. i dont wana eliminate all these gaps ...

Translate
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 Expert ,
Aug 03, 2024 Aug 03, 2024

Do you want to increase the overall spacing of the letters but retain the connections between them? I don't think that can be done with any fixed-glyph font. I don't know if any kind of variable font is available for Arabic, as it would be needed for English italic or handwriting characters.

 

Fixed fonts are usually created to remain within a kerning limit so that the connections are made and script flow continuous.

Translate
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
Contributor ,
Aug 03, 2024 Aug 03, 2024

not resolve my issue please someone look on this challenging job

Translate
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 Expert ,
Aug 03, 2024 Aug 03, 2024

Okay, @rehana36276218  so it sounds like you need something a bit customised. I thought this was an interesting tool to have, so I have written a script that may help you. See if you can follow what it does and how, and let me know if it works in your situation. It is quite configurable via the `kerns` array.

- Mark

 

 

/**
 * @file Kern Words.js
 *
 * Finds particular words and sets the kerning of those words explicitly.
 *
 * Tips:
 *   -  Edit the `kerns` array to suit your words and kerning.
 *   -  The `properties` object can contain any valid `findGrepPreferences`
 *      properties and values.
 *
 * Important:
 *   -  The `kerning` values correspond to the words' insertionPoints
 *      so the first kern value is BEFORE the first letter of the word.
 *      for example the word 'cat' will have 4 insertionPoints, and the
 *      kern object might look like this: {word: 'cat', kerning [-5, 6, -30, 8] }
 *
 * @author m1b
 * @version 2024-08-03
 * @discussion https://community.adobe.com/t5/indesign-discussions/advance-kerning/m-p/14777177
 */
function main() {

    var kerns = [
        {
            word: 'tight',
            kerning: [0, -50, -10, -30, -50, 0],
            properties: { appliedCharacterStyle: 'RED' },
        },
        {
            word: 'loose',
            kerning: [5, 10, 20, 30, 40, 5],
            properties: { appliedParagraphStyle: 'Body' },
        },
        {
            word: 'spaced',
            kerning: [100, 100, 100, 100, 100, 100, 100],
            properties: { appliedFont: 'Minion Pro	Bold Cond' },
        },
    ];

    var settings = {
        wholeWords: true,
        showResults: true,
    };

    if (0 === app.documents.length)
        return alert('Please open a document and try again.');

    var doc = app.activeDocument;

    for (var i = 0, kern, words, bracket; i < kerns.length; i++) {

        kern = kerns[i];
        kern.counter = 0;
        bracket = settings.wholeWords ? '\\b' : '';

        app.findGrepPreferences = NothingEnum.NOTHING;
        app.findGrepPreferences.findWhat = bracket + kern.word + bracket;

        if (kern.properties)
            app.findGrepPreferences.properties = kern.properties;

        words = doc.findGrep();

        for (var j = 0, word, len; j < words.length; j++) {

            word = words[j];
            len = Math.min(word.insertionPoints.length, kern.kerning.length);
            word.kerningMethod = 'None';

            for (var k = 0; k < len; k++)
                word.insertionPoints[k].kerningValue = kern.kerning[k];

            kern.counter++;

        }

    }

    if (settings.showResults) {

        var results = ['Kern Words'];

        for (var i = 0, kern; i < kerns.length; i++)
            results.push(kerns[i].word + ' x ' + kerns[i].counter);

        alert(results.join('\n'));
    }

};
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Kern Words');

 

 

Translate
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
Contributor ,
Aug 03, 2024 Aug 03, 2024

 

Thanks m1b , i am having this error while execute your given script

 

error.JPG

Translate
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 Expert ,
Aug 03, 2024 Aug 03, 2024

Hi @rehana36276218, can you please share a small demo .indd document that shows the error? Also share your "kerns" array. When I've got that, I'll be able to fix. - Mark

 

Edit: Alternatively, you could comment out the line 

// app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Kern Words');

and add, on the very next line:

main();

 and run it again. It will show a more useful error now. If you do this, please post the error.

Translate
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
Contributor ,
Aug 03, 2024 Aug 03, 2024

thanks for your feedback , the file i attached below, these are some pages where text i want more kern space see in this pic i insert cursor between characters and alt right arrow key to make kern , i want in whole document through script or grep.

kern.JPG

Translate
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 Expert ,
Aug 03, 2024 Aug 03, 2024

Thanks for the sample document @rehana36276218. I tried my script and it worked as expected. Here's my test kerning object:

{
    word: 'فَلَقِ',
    kerning: [0, -50, 0, 30, 0, 0, 0],
    properties: { appliedCharacterStyle: 'font 24 after before table' }
},

This found and kerned x2 words in your sample document. The kerning values were correctly applied to the words, but the kerning actually didn't seem to do anything, but perhaps this is because I do not have the ME version of indesign.

I did not get any errors though, so maybe the problem is one of your kerning objects? Post a copy of that if you can't get it to work. Also try my suggestion in my previous post about disabling the `doScript` call so I can see the actual error you are getting.

- Mark

Translate
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
Contributor ,
Aug 06, 2024 Aug 06, 2024

hi, how are you m1b , i was  on leave , actually i dont know how to edit the code ...disabling the `doScript` as you mention , how i will run script i dont know about disabling line in the script . please 

Translate
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 Expert ,
Aug 06, 2024 Aug 06, 2024

That's okay, there's no hurry for me, and I hope you had a nice leave. You can disable the line by adding two forward-slashes // to the start of the line. See my post earlier about adding "main();" to the very next line.

- Mark

Translate
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
Contributor ,
Aug 06, 2024 Aug 06, 2024

Screenshot 2024-08-06 at 4.28.56 PM.pngScreenshot 2024-08-06 at 4.39.34 PM.png

 

Thanks for your reply m1b still am getting an error in the script i attached file where i add lines as per your given instructions , but i am fail to achieve desired results. 

Translate
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 Expert ,
Aug 06, 2024 Aug 06, 2024

I am sorry @rehana36276218, I will explain better. You must add "//" to the start of line that begins with "app.doScript ... " (it will be about line 90 to 100).

 

Then add a new line on the very next line to that line that just says "main();" without the quotes.

- Mark

Translate
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
Contributor ,
Aug 06, 2024 Aug 06, 2024
i did this step but didn't solve the issue
Translate
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 Expert ,
Aug 06, 2024 Aug 06, 2024

Okay because I didn't remember that you don't know any scripting, so I will give you some more information about configuring the script for your usage.

 

This is the section you need to change:

 

var kerns = [
    {
        word: 'فَلَقِ',
        kerning: [0, -50, 0, 30, 0, 0],
        properties: { appliedCharacterStyle: 'font 24 after before table' }
    },
    {
        word: 'loose',
        kerning: [5, 10, 20, 30, 40, 5],
    },
    {
        word: 'spaced',
        kerning: [200, 200, 200, 200, 200, 200],
    },
];

 

 

This is configured so that there are 3 words that the script knows how to kern: فَلَقِ, loose, and spaced. Each kern object looks like this as a minimum:

 

    {
        word: 'word',
        kerning: [0, -50, 0, 30, 0],
    },

 

You must have the start and close brace { and }, with the ending comma!

 

You can add as many words as you like by duplicating these "kerns".

- Mark

Translate
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
Contributor ,
Aug 06, 2024 Aug 06, 2024

mb1 is it possible to share with me the correct script file , click2link787@gmail.com....? i am still didn't understand more about coding. thanks please

Translate
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
Contributor ,
Aug 06, 2024 Aug 06, 2024

i did these @m1b  steps but still getting script error .  what i do .. ..? please help me to get out this issue 

Translate
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 Expert ,
Aug 06, 2024 Aug 06, 2024

Yes, it won't fix the error, but will now reveal the correct error message. Please let me know what error you get, include what line throws the error.

Translate
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
Contributor ,
Aug 06, 2024 Aug 06, 2024

hi @m1b this is an error when executing code.. also i insert // as you mention above 

You must add "//" to the start of line that begins with "app.doScript ... " (it will be about line 90 to 100).

 

Screenshot 2024-08-07 at 9.53.52 AM.pngScreenshot 2024-08-07 at 9.52.09 AM.png

Translate
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 Expert ,
Aug 06, 2024 Aug 06, 2024

That error means that you saved the script as rich text. Please save it as plain text (with .js extension). If you paste the script into TextEdit, choose 

Screenshot 2024-08-07 at 15.00.43.png

and then save with a ".js" extension.

 

And then try script again, and tell me what error you see.

- Mark

Translate
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
Contributor ,
Aug 06, 2024 Aug 06, 2024

thanks for in touch, i did as you told me , but script is not executing  with no error. just double click the script nothing happened 

Translate
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 Expert ,
Aug 06, 2024 Aug 06, 2024

Okay that probably just means that it isn't finding any of the configured kerning words. Can you post your `kerns` object. for example:

var kerns = [
    {
        word: 'فَلَقِ',
        kerning: [0, -50, 0, 30, 0, 0],
        properties: { appliedCharacterStyle: 'font 24 after before table' }
    },
    {
        word: 'loose',
        kerning: [5, 10, 20, 30, 40, 5],
    },
    {
        word: 'spaced',
        kerning: [200, 200, 200, 200, 200, 200],
    },
];

What does your one look like? Remember, you have to set it up with your own words. If you post it here, I will test on your sample document.

- Mark

Translate
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
Contributor ,
Aug 06, 2024 Aug 06, 2024

ok, this is the sample file, you mean if i want to run script , i have to change kerning values in script all time , if values change...? ,

Translate
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