refactor putFont code