Sounds like a combination of using the RICHTEXT2, TEXTBLOCK and the REQUEST commands to find out the size of the text to then draw a polyline rectangle around the text would be what you would need.
I was making some progress with RichText2 but I lost a days work when my hard disk died on me as I had just managed to do a similar thing but just to make the text stretchy so I could display the text the way I wanted it by just grabbing a node like you do with the Text or Text Label tools.
Sadly I've not had time to go over it and recreate what I had made as I've actually forgotten how I did it. I do know I used the
GDL Cookbook 4 as it has an example in there on how to do it.
edit
The actual chapter is
here
AC versions 3.41 to 25 (UKI Full 5005).
Using AC25 5005 UKI FULL
Mac OSX 10.15.7 (19G2021) Mac Pro-2013 32gbRam AMD FirePro D500 3072 MB graphics