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

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".

Chris
Index: src/ChangeLog
===================================================================
--- src/ChangeLog	(revision 70243)
+++ src/ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2006-12-29  Chris Toshok  <[EMAIL PROTECTED]>
+
+	* general.c (gdip_get_display_dpi): we don't want to get what the
+	rest of X assumes is the dpi.  we want the actual dpi of the
+	screen, so that we can correctly map to the actual size of fonts
+	when the user asks for a particular size.  This removes the need
+	for the hack of setting the SWF DefaultFont to be 8pt instead of
+	8.25pt to get things to line up.
+
 2006-12-21  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
 	* imageattributes.c: Fix bug #80323 for ColorMatrix containing alpha
Index: src/general.c
===================================================================
--- src/general.c	(revision 70243)
+++ src/general.c	(working copy)
@@ -220,13 +220,8 @@
 		display = XOpenDisplay (0);
 		/* If the display is openable lets try to read dpi from it; otherwise use a default of 96.0f */
 		if (display) {
-			/* the val pointer is owned by X (do not free) */
-			val = XGetDefault (display, "Xft", "dpi");
-			if (val) {
-				dpis = atof (val);
-			} else {
-				dpis = 96.0f;
-			}
+			dpis = (((float) DisplayHeight (display, 0) * 25.4f) / 
+				(float) DisplayHeightMM (display, 0));
 			XCloseDisplay (display);
 		} else {
 			dpis = 96.0f;
_______________________________________________
Mono-winforms-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-winforms-list

Reply via email to