generalize precomputing widths to any char value in a cache-style