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

How to automatically highlight Justification Alternate words

Enthusiast ,
Aug 18, 2023 Aug 18, 2023

Copy link to clipboard

Copied

Hi
Is there a way to highlight a word with color through character styles when justification alternate words are substituted by Indesign, automatically ?

In the image I have attached two lines. The one which is black in color is normal justificaiton or justification has been disabled in paragraph style.

The second line, red in color is the same text but Justification Alternate (Naskh) has been enabled in Justification section in paragraph style. Indesign automatically substitute the words if it requires.
My question is when Indesign substitutes a word, is there a way to highlight them ? I know that it can be done manually through character styles, but that is a lot of work. GREP, Script or any other method in Indesign ?
Thanks

TOPICS
How to

Views

2.2K

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

Community Expert , Aug 20, 2023 Aug 20, 2023

An additional clarification: you can find all words that have just alt applied, and you can find the width of those words (using horizontal offset, as you did in your script), but that doesn't tell you whether an alternate was in fact used. 

Votes

Translate

Translate
Community Expert ,
Aug 18, 2023 Aug 18, 2023

Copy link to clipboard

Copied

Script could compare HorizontalOffset of the InsertionPoints before and after the substituted Character - but script would need access to the "original" text.

 

Votes

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
Guide ,
Aug 18, 2023 Aug 18, 2023

Copy link to clipboard

Copied

Hello,

Where do you set 'Justification Alternate (Naskh) '

Would you have a sample document that I could look at.

P.

 

Edited to say:

This looks like it is an attribute added to the text. It would be possible to detect the attribute and highlight from an PlugIn. Or, even better, if the attribute is a style override you could switch on style override highlighter.

Votes

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
Enthusiast ,
Aug 18, 2023 Aug 18, 2023

Copy link to clipboard

Copied

Hi
Thanks for the reply.

I am attaching an image where you can find the option of Justification
Alternate.

The document is in Arabic and it requires an Arabic font with Justification
Alternate capabilities.

Justification Alternates do not work on all the fonts. If a Font developer
programs JALT table with extra glyphs, then only it works.

Votes

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
Enthusiast ,
Aug 18, 2023 Aug 18, 2023

Copy link to clipboard

Copied

@Pickory Sorry forgot to attach image

Votes

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
Guide ,
Aug 18, 2023 Aug 18, 2023

Copy link to clipboard

Copied

Thank you.

 

I suspect I am not going to see those extra options in my UK version of InDesign.

 

Did you try the style override highlighter?

Votes

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 Expert ,
Aug 18, 2023 Aug 18, 2023

Copy link to clipboard

Copied

Search Google for the trick to enable Far East and Middle East features - on windows it requires small change in the registry. 

 

Votes

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
Enthusiast ,
Aug 18, 2023 Aug 18, 2023

Copy link to clipboard

Copied

Ok I will try this. Thanks

Votes

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
Guide ,
Aug 18, 2023 Aug 18, 2023

Copy link to clipboard

Copied

Would it be possible to package a document for testing purposes?

P.

Votes

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
Enthusiast ,
Aug 18, 2023 Aug 18, 2023

Copy link to clipboard

Copied

@Pickory I am attaching the idml and the font file. You can test on it.

Votes

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
Enthusiast ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

Also, I found this article.
https://research.reading.ac.uk/typoarabic/on-arabic-justification-part-2-software-implementations/

But is not helping me...maybe it will help you understand better.

Thanks

Votes

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 Expert ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

There is nothing in the scripting DOM to determine if character has been substituted, so, like I've said the first reply - it would be doable only by comparing HorizontalOffset of the InsertionPoints. 

 

Or via plugin but I'm pretty sure it would require a lot more work... 

 

Votes

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
Enthusiast ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

@Robert at ID-Tasker @Pickory has found almost most of the words. There are some words wrongly selected in this method but I guess it can be fine tuned.  Lets hope for the best.

Thanks

Votes

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
Guide ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

Hi,

 

This is probably not quite what you are looking for.

 

P.Screen Shot 2023-08-19 at 11.43.46.png

Votes

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
Enthusiast ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

@Pickory  Thanks for the effort.

Some of the images in green are ok and some are not. I have marked with Red, the ones which are wrongly selected. Image attached with Red marks.

 

A little bit of fine tuning and your are finally there ? Have you used a script for some other method ?

 

I found this :
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#ParagraphJustificationOptions.html

 

But as I am not into scripting, I have no idea how to start and where to start.

 

Thanks

Votes

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
Guide ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

Hello,

 

Currently I am using a script. 

app.findTextPreferences.otfJustificationAlternate

 

The bad news is that I now suspect the composer is creating these pairings on the fly. If I am right, this will not be detectable by a script. A plugin should be able to detect this behaviour, but it is not a trivial task.

 

I list the script here, it expects a swatch called green.

//=============

app.findTextPreferences = null;

app.findTextPreferences.otfJustificationAlternate = true;

 

var found = app.activeDocument.findText ();

//for ( var j = 0; j < found.length; j++ )

found[1].fillColor = "green";

//=======

 

You might fnd the wrongs are less than the rights, which might make it easier to highlight the text you want to see.

 

P.

Votes

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 Expert ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

Yes, it's "on the fly". 

 

But just searching for this setting - returns texts that are affected? 

 

Votes

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
Guide ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

Unfortunatley I do not understand the text / language, so I can not tell if the founds are correct.

 

The search does return a list of affected texts. This list is probably a hint to the composer that it is allowed to draw the alternatives. So, not all of the founds are relevent, because they have not been drawn in the 'special way'.

 

P.

Votes

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 Expert ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

If something has been returned - then it has been substituted - even if it looks the same as before... 

 

Votes

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 Expert ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

Wait a minute - your code is wrong - it should be:

 

found[j].fillColor

 

"j" not "1".

 

Is it a typo when you were copy&pasting it here - or it's how you run it? 

 

Because in this state - it can't work... 

 

Votes

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
Guide ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

The pasted code is wrong, in that instant I wanted to see the 2nd found.

Votes

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 Expert ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied


@Pickory wrote:

The pasted code is wrong, in that instant I wanted to see the 2nd found.


 

??? 

 

Votes

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 Expert ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

After you change "1"to" j" - it should be pretty straightforward - you need to save info about HorizontalOffset before and after each found text, temporarily turn off this substituting option, compare new HorizontalOffset values, set  substituting option back on. 

 

Or you could save info for all of them to an array, turn off the option for the whole text and then compare and then turn it back on. 

 

Votes

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
Enthusiast ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

I ran this script but nothing happened.

 

app.findTextPreferences = null;

app.findTextPreferences.otfJustificationAlternate = true;

 

var found = app.activeDocument.findText ();

for ( var j = 0; j < found.length; j++ )

found[j].fillColor = "green";

 

I even selected the text and ran the script again but no change.

Votes

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
Enthusiast ,
Aug 19, 2023 Aug 19, 2023

Copy link to clipboard

Copied

@Robert at ID-Tasker @Pickory  I have written some code to get the offsets but how do I know which word has been applied with jalt

var doc = app.activeDocument;
var myParas = doc.stories.everyItem().paragraphs.everyItem().getElements();
myWords= myParas[0].words;

//alert(myWords[0].otfJustificationAlternate);
alert(myWords[0].horizontalOffset);
alert(myWords[0].endHorizontalOffset);
//alert(myWords[0].paragraphJustification);
//alert(myWords.length);

//alert(myWords[0].hyphenationZone);
//myWords[0].fillColor = "green";

Votes

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