Sorry, I should have taken a look at this thread earlier. I think there is already a ROM routine to do this: DrawClipStr. There are also plenty of other text-drawing routines, such as DrawStrWidth, which returns the width of string in pixels. Once I have a working PC again, I will add these routines (and more) to the tios pseudolibrary.