Written basic textWidth function and test