measures text and ensures no overlaps