add swidth package and use it to get text length