cutting off a drawn string?

hi, take a look at the attached file. im getting filenames from a directory and drawing them to screen using ofTrueTypeFont::drawstring. sometimes a filename will be bigger than the background box in grey. is there a way to tell drawstring to stop drawing if the string length exceeds a certain length? or can i cover up the part of the string that runs over my specified length?

not only for text but anything GL, if you want to define a box outside of which you don’t want things to be drawn you can use glScissor

that works, cheers mate.