Copy link to clipboard
Copied
Hi,
This is likely a tricky one involving scripting which I'm now familiar with thanks to many of your here! 😄
Here we go...
I have a script that formats and position text based on the number of characters.
I have a whole-page background made up of a repeating pattern of small objects. A mosaic I think is the word?
I want to swap all small objects that are covered or partly covered by the text above it to another type of small objects.
This would enable me to have a wonderful photoshop-type text effect directly in indesign.
Where, oh where, should I start to look presuming this is even possible?
THANK YOU! I'll share what I get in the end if there is interest 🙂
Antoine in Vancouver
Copy link to clipboard
Copied
Seems like you would need to start by getting the bounds of the text’s words or characters. This function gets the bounds of the text provided as the parameter as an y1,x1,y2,x2 array, which you could then use to position an object below:
var sel = app.selection[0];
$.writeln("Selected Text Bounds: " + getTextBounds(sel));
function getTextBounds(t){
var y1, x1, y2, x2
y1 = t.baseline - sel.ascent;
x1 = t.horizontalOffset
y2 = t.baseline + sel.descent;
x2 = t.endHorizontalOffset
return [y1,x1,y2,x2]
}
Copy link to clipboard
Copied
Hi BetterColour,
sorry, I have no idea what you are after.
I'd suggest you post some screenshots. Before and after a possible script run.
To read out positions of single characters you could outline duplicates of characters and compare the geometric bounds with other objects' geometric bounds.
Thanks,
Uwe Laubender
( ACP )