In InDesign Scripting, is it possible to straightly find spaces whose width is greater than particular value (e.g. 4 pts) to speedup a task.
Currently we are finding most of the spaces and calculating their width as like below (i.e subtracting horizontal Offset value from end Horizontal Offset value) that is consuming more time.
Trying Script Code:
myWidth=mySpace.endHorizontalOffset - mySpace.horizontalOffset;
You can use a approach like this:
1) grab myText.characters.everyItem().horizontalOffset. This will give you an array of every horizontal offset in your text.
2) Grab myText.contents which will give you a string of all your text.
3) Search your string for spaces and check the first array for the horizontalOffsets surrounding the space.
This will allow you to do the check with only two DOM interactions and it should be very fast iterating over the string and array.