At one time (and maybe still), Font understood #widthOfString: .  
An idea (that I've used elsewhere) is to iterate over the values you actually have in the list for the font you are using to determine the size.  This makes sure it works - but will change (and maybe need to be re-done with each change to the inspector list).

Alternatively, you could run this for a reasonable sampling of characters and take the average of the widths, and use that result as the 'standard' pixel width?

Just some ideas,
cbc

On Thu, May 10, 2018 at 6:18 AM, Luke Gorrie <luke@snabb.co> wrote:
I would like to make my GTInspector views work well with different font sizes. In particular, some people find the default Pharo font too small and want to switch to a larger one.

The main problem is that my tables have their column width specified in pixels. The values are chosen to make good use of screen space with the default font size, but it becomes unreadable with a larger font that doesn't fit.

How should I solve this?

The first idea that comes to mind is to invent my own units that are scaled according to system font size when converted to pixels. I wonder if there is a better known solution already though.

Cheers!
-Luke



_______________________________________________
Moose-dev mailing list
Moose-dev@list.inf.unibe.ch
https://www.list.inf.unibe.ch/listinfo/moose-dev