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

Kasheeda Justification on selected character / text only

Enthusiast ,
Sep 12, 2024 Sep 12, 2024

Copy link to clipboard

Copied

I am trying to achieve to put Kasheeda on selected character only. In fact, I ahve kasheeda enabled in paragraph style. Some characters are not looking good in kasheeda so I thought of removing kasheeda from that characters or use some other kasheeda. Indesign gives an option. If I change kasheeda from drop down, it changes in the whole paragraph and not the selected characters.

 

Is there a way to achieve that using script or Character styles ?

 

Here is the text

اسمہ اسلام اباد، یایہا الناس اجتنبوا الكذب

 

Here is the code I have written to apply character style BUT I do not know how to control that drop down.

I have attached a screenshot and IDML file also.

 

Here is the code written to apply character style:

var characterStyleName = "Kasheeda";
var mySelection = app.selection[0];
    if (mySelection.length == 0) {
		 alert("Please select some text first.");
	}
	else {
        // Check if the character style exists in the document
        var charStyle = doc.characterStyles.itemByName(characterStyleName);
        if (charStyle.isValid) {
		
			//Modify Character Style here to add or remove kasheeda
			
            // Apply the character style to the selected text
            mySelection.applyCharacterStyle(charStyle);
            alert("Character style applied successfully!");
        } 
		else { 
			alert("Character style '" + characterStyleName + "' not found."); 
		}
    }

I have used "body" paragraph style.

In the attached image, say I want to remove kasheeda (marked with red square) of 2 and 3rd box in the text. I want to either make it "none" or "short" or "medium" or "long". It is driving me crazy.

 

Thanks.

TOPICS
How to , Scripting

Views

470

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

Enthusiast , Sep 13, 2024 Sep 13, 2024

@Robert at ID-Tasker @Peter Spier 

Seems like there is no solution to it. Will have to do it manually as kasheeda width option is not there in character style.

 

There are 4 types of kasheeda width and it needs to be applied as per the space available. It would have been much easier with character style so that it can be controlled later if any modification is required.

 

Kasheeda can be selected using ~W in grep but only if it is applied manually. Shift + 6 is the keyboard shortcut to apply kasheeda

...

Votes

Translate

Translate
Community Expert ,
Sep 12, 2024 Sep 12, 2024

Copy link to clipboard

Copied

RobertatIDTasker_1-1726160029742.png

 

RobertatIDTasker_2-1726160078835.png

 

Valid for:

 

RobertatIDTasker_3-1726160120281.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 ,
Sep 13, 2024 Sep 13, 2024

Copy link to clipboard

Copied

@Robert at ID-Tasker Thanks for the reply.

That modification will be paragraph based. I am looking for a solution in Character Styles. Meaning, in a paragraph ("body" paragraph style applied in that paragraph), if I want kashidawidth to be 0 for few selected characters and 1 or 2 for some selected characters. How do I do that using character styles ? Or script ?

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 ,
Sep 13, 2024 Sep 13, 2024

Copy link to clipboard

Copied

@shahidr100

 

As per my last screenshot - for some reason - looks like a bug?? - you can't set "width" in CharStyle - but you can set for Character, Word, etc. - Text overall.

 

So you just need to select some Text and set your value. 

 

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 ,
Sep 13, 2024 Sep 13, 2024

Copy link to clipboard

Copied

@Robert at ID-Tasker Thanks for the reply.

 

I added this line:

mySelection.paragraphKashidaWidth = 3;

It is working but at the same time it is overriding the paragraph style. 

Here is the updated code:

 

var mySelection = app.selection[0];

    // Check if there is any text selected
    if (mySelection.length == 0) {
		 alert("Please select some text first.");
	}
	else {
			mySelection.paragraphKashidaWidth = 3;
    }

 

How do I save myself from overriding paragraph style ? Also it is not working for the second time on the same paragraph.

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 ,
Sep 13, 2024 Sep 13, 2024

Copy link to clipboard

Copied

@shahidr100

 

If you set anything different than what is in the ParaStyle definition - you'll have override - that's normal.

 

You need to create a new ParaStyle - or modify definition of the applied ParaStyle. 

 

But if you modify definition of the applied ParaStyle - it will affect all paragraphs that with that ParaStyle applied. 

 

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 ,
Sep 13, 2024 Sep 13, 2024

Copy link to clipboard

Copied

seems like adding a grep style to paragraph style might be a good way to deal with this?

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 ,
Sep 13, 2024 Sep 13, 2024

Copy link to clipboard

Copied

quote

seems like adding a grep style to paragraph style might be a good way to deal with this?


By @Peter Spier

 

Can it be set in the UI - for the CharStyle? Because it can't be set from script for CharStyle. 

 

Unless something changed after 19.3? 

 

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 ,
Sep 13, 2024 Sep 13, 2024

Copy link to clipboard

Copied

Why not? I don't read or write Arabic, but I presume the same rules for GREP pattern recognition would apply as for Latin scripts, so if what you want to do can be defined as a character style it should be applicable as a GREP style, no?

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 ,
Sep 13, 2024 Sep 13, 2024

Copy link to clipboard

Copied

@Peter Spier

 

I meant that in order to use GREP Styles - you need to select CharStyle on the list, right?

 

But as you can't set width in the CharStyle... 

 

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 ,
Sep 13, 2024 Sep 13, 2024

Copy link to clipboard

Copied

are kasheeda selectable as a character or they part of the characters they join? Does changing horizontal scale 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
Community Expert ,
Sep 13, 2024 Sep 13, 2024

Copy link to clipboard

Copied

@Peter Spier

 

No idea - haven't tried it in the InDesign's UI - just posted what scripting offers.

 

Unless, width can be set in ParaStyle - but not "activated" - then CharStyle will just activate 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
Community Expert ,
Sep 13, 2024 Sep 13, 2024

Copy link to clipboard

Copied

Downloaded the .idml and it looks like neither traking or kerning are going to work. Horizontal scale can be applied but it is not acceptable as it scles the stroke as well. Kasheeda seem to be a combining form of some sort in the character.

So unless someone else who works in arabic has a bright idea, I think the GREP Style idea is a non-starter.

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 ,
Sep 13, 2024 Sep 13, 2024

Copy link to clipboard

Copied

@Robert at ID-Tasker @Peter Spier 

Seems like there is no solution to it. Will have to do it manually as kasheeda width option is not there in character style.

 

There are 4 types of kasheeda width and it needs to be applied as per the space available. It would have been much easier with character style so that it can be controlled later if any modification is required.

 

Kasheeda can be selected using ~W in grep but only if it is applied manually. Shift + 6 is the keyboard shortcut to apply kasheeda (Tatweel Unicode u0640) using urdu keyboard.

 

I thought scripting might help but looks like it is not possible with scripting as well.

 

Anyway, thanks to all of you.

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 ,
Sep 14, 2024 Sep 14, 2024

Copy link to clipboard

Copied

Unfortunately, It looks like you can't control Kashida ON/OFF status from CharStyle - in the UI.

 

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 ,
Sep 14, 2024 Sep 14, 2024

Copy link to clipboard

Copied

LATEST

Variable Fonts to the rescue?

 

Trying to understand kashida, I came along this ongoing discussion.

https://github.com/googlefonts/axisregistry/issues/77

 

It will be interesting how the related fonts evolve. The Estedad font as of the inital upload from July 2022 already shows with a Kashida axis and changing the value stretches the text.

https://github.com/aminabedi68/Estedad/tree/master/fonts/Variable

 

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