Kasheeda Justification on selected character / text only
- September 12, 2024
- 2 replies
- 1888 views
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.
