added text bounding rectangle calculation