I'm designing an application with a data table. The data is backed by a C-style string (that is to say, a char
array) so I know the maximum theoretical width using my proportionally-spaced typeface.
For example, assume that a string's length can't be greater than 32 characters. Naively, I can say that since "W" is the widest character, the maximum theoretical column width is 32 times the width of "W". But this will pretty much never happen, and if I make my column as wide as 32 "W"'s there'll be a lot of wasted space on average. On the other hand, it's not the end of the world if a string runs long and is truncated; I just want the vast majority of strings to be represented in their entirety.
Is there a back-of-the-envelope calculation for estimating the ideal default column width?