I'll try it. But it looks like it could add some overhead if I have many rectangles in my picture.

strange calculation... the pixel size (of the font) is the size of one character (or so), certainly not of the whole text or so.
Yes, sorry about being unclear. I meant the text height, primarily. My string would be very short, max 3-4 characters.