u8g - scrolling text within bounds

Not really a u8g question (although there may be provision in the library for what I need to do), but more of a "can anyone think of a better way" question.

The best way to scroll text that is too long to fit on the screen (i.e. right-to-left scrolling) is to just decrement the x position periodically.

But I'd like to do this with some text that can only be written within a horizontal portion of the display.

I'll explain further - I have drawn an icon to the left of the text, and if I were to simply decrement the x position of the text, it would draw text over this icon which I want to avoid.

Of course, I could draw a box with colour index 0 to blank the pixels after drawing the text, but I'd like to do this in a more efficient way.

Perhaps there is a way to instead truncate the beginning x pixels of the text?

Any suggestions?

assume a display e.g. 0, 0 -- 300, 300; (lower left, upper right)

typically this is solved by

  1. define a bounding box e.g. 0, 0 -- 200, 300 (keep some space free)

  2. check if a char/digit is drawn if it is within the bounding box

  3. if so, draw it on screen

If you had enough memory you could render the text on a bitmap.
Take a selection (bounding box) and send that to the display.
unfortunately an Arduino has too limited memory for that.