I have a program that writes Postscript code to draw various diagrams using a Postscript graphics library. I would like to know in the main program what the actual size (height and length) of the text strings will be so that I can calculate overlaps and attempt to do something about them. I use Ghostscript to view the files and to convert them to other formats so in principle could execute that as a system command but I'm not sure if this would help. I am only a novice Postscript user.
I have looked at stringwidth but haven't worked out how to use it to get the data back to the main program.