Refactor and add debug to the char width scale computation