The key is
window_coord = gcoord(x, y),
which will return the relative coordinates for input to
gaddtext(text, window_coord, text_coord, direction)
.
Online references:
http://www.omatrix.com/manual/gaddtext.htm
http://www.omatrix.com/manual/gcoord2.htm
.