Word coordinates in a multiline text rendered

how to know coordinates of each word in a multiline text?
I need an xy position to substitute a word by other word, by same word with different features,
to define a normal string in a render console you need coordinates.
for example if you`re using string as an objecto of a class x y ( positions)should be fields
with getters and setters you can handle positions of each words.
but I dont mind any other methods
I only need to find a word in a rendered text ( EX9)and replace it
Thanks!