Clipping realtime text

How does one clip realtime text which winds up going out of bounds because it is too long? Can it be stopped by a brick wall, for example?

Thanks for any suggestions!

use a python script to cut the string