[Mono-winforms-list] Mono-Winforms fails to render bitmap fonts under X11

Henri Beauchamp sldev at hotmail.com
Tue Dec 13 11:29:57 EST 2011


I recently updated from Mono v1.9 (yes, I know, old horse...) to
v2.6.10 and found out that all the Mono-Winforms based programs
suddenly broke at the UI level (while Mono-GTK ones keep working like
a charm).

Here are two screenshots for one of the Mono-Winforms program I use
(Radegast: http://radegast.org/wp/)
This one shows the correct UI:
This one shows the broken UI, with collapsed input and combo boxes:

When running the program, I receive many such errors:
X11 Error encountered:
Error: BadGC (invalid GC parameter)
Request: 60 (0)
Resource ID: 0x3C0004E
Serial: 3247
Hwnd: Hwnd, Mapped:True ClientWindow:0x3C0004E, WholeWindow:0x3C0004D, Zombie=False, Parent:[Hwnd, Mapped:True ClientWindow:0x3C0004C, WholeWindow:0x3C0004B, Zombie=False, Parent:[Hwnd, Mapped:True ClientWindow:0x3C0003D, WholeWindow:0x3C0003C, Zombie=False, Parent:[Hwnd, Mapped:True ClientWindow:0x3C00039, WholeWindow:0x3C00038, Zombie=False, Parent:[Hwnd, Mapped:True ClientWindow:0x3C00035, WholeWindow:0x3C00034, Zombie=False, Parent:[Hwnd, Mapped:True ClientWindow:0x3C0001D, WholeWindow:0x3C0001C, Zombie=False, Parent:[Hwnd, Mapped:True ClientWindow:0x3C0001B, WholeWindow:0x3C0001A, Zombie=False, Parent:[Hwnd, Mapped:True ClientWindow:0x3C00019, WholeWindow:0x3C00018, Zombie=False, Parent:[Hwnd, Mapped:True ClientWindow:0x3C00017, WholeWindow:0x3C00016, Zombie=False, Parent:[Hwnd, Mapped:True ClientWindow:0x3C00015, WholeWindow:0x3C00014, Zombie=False, Parent:[Hwnd, Mapped:True ClientWindow:0x3C00013, WholeWindow:0x3C00012, Zombie=False, Parent:[<null>]]]]]]]]]]]
Control: System.Windows.Forms.ComboBox+ComboTextBox, Text: Rune Mills at System.Environment.get_StackTrace()
at System.Windows.Forms.XplatUIX11.HandleError(IntPtr display, XErrorEvent ByRef error_event)
at System.Drawing.GDIPlus.GdipCreateFromXDrawable_linux(IntPtr , IntPtr , IntPtr ByRef )
at System.Drawing.Graphics.FromXDrawable(IntPtr drawable, IntPtr display)
at System.Drawing.Graphics.FromHwnd(IntPtr hwnd)
at System.Windows.Forms.XplatUIX11.PaintEventStart(Message ByRef msg, IntPtr handle, Boolean client)
at System.Windows.Forms.XplatUI.PaintEventStart(Message ByRef msg, IntPtr handle, Boolean client)
at System.Windows.Forms.Control.WmPaint(Message ByRef m)
at System.Windows.Forms.Control.WndProc(Message ByRef m)
at System.Windows.Forms.ButtonBase.WndProc(Message ByRef m)
at System.Windows.Forms.Button.WndProc(Message ByRef m)
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage(Message ByRef m)
at System.Windows.Forms.Control+ControlNativeWindow.WndProc(Message ByRef m)
at System.Windows.Forms.NativeWindow.WndProc(IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.XplatUIX11.DispatchMessage(MSG ByRef msg)
at System.Windows.Forms.XplatUI.DispatchMessage(MSG ByRef msg)
at System.Windows.Forms.Application.RunLoop(Boolean Modal, System.Windows.Forms.ApplicationContext context)
at System.Windows.Forms.Application.Run(System.Windows.Forms.ApplicationContext context)
at System.Windows.Forms.Application.Run(System.Windows.Forms.Form mainForm)
at Radegast.MainProgram.RunRadegast(System.String[] args)
at Radegast.MainProgram.Main(System.String[] args)

Note that this problem occurs with all the Mono v2 versions I tested
(v2.2, v2.4 and v2.6) but never with any v1 version...

I managed to pinpoint the problem and found out it was related to the
font that was configured as the preferred/default font in my system:
when this font is a bitmap (non-proportional) font such as the lovely
Adobe Helvetica (Xorg 75dpi font), Winforms fails lamentably to render
it, while it got no problem with proportional fonts (all the ugly
Utopia, Liberation, URW, etc)...

Could you please fix this issue and make it so Winforms programs
work again as they always did in Mono v1 ?

Many thanks in Advance !

More information about the Mono-winforms-list mailing list