making the text hight calculation more robust