End refactor fixTextToWidth