[Mono-winforms-list] dpi patch for libgdiplus

Chris Toshok toshok at ximian.com
Fri Dec 29 17:28:13 EST 2006

the reason for this change is to make gert's recent font patch work

As jackson mentioned, we switched from 8.25 to 8.0 fonts for MWF to
maintain the correct sizing on X11.  The trouble with this is that the
measurements used to generate the value "8.0" were specific to the DPI
of the monitor Peter used for the work.  And the change only works for
the default font, not for any that the user specifically requests.

Xft defaults to 96dpi, the same as windows, which gives us a problem,
since our displays are (in general) higher dpi than that.  We're not
looking to be consistent across other linux applications for the same
font size.  We're looking for the winforms UI's to be consistent across
platforms.  Since designers can (and do) include hardcoded pixel sizes,
we need to scale the font sizes on X, and the default dpi of 96 was
resulting in no scaling.

This change results in the following output when measuring the string
"hi there" on both linux and windows, using the DefaultFont of 8.25pt:

linux: {Width=41, Height=14}
windows: {Width=41.37711, Height=13.8252}

which is "close enough".

-------------- next part --------------
A non-text attachment was scrubbed...
Name: libgdiplus-dpi.diff
Type: text/x-patch
Size: 1387 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20061229/fdafaaa4/attachment.bin 

More information about the Mono-winforms-list mailing list