GNOME Bugzilla – Bug 332656
Blurred underlines on menu accelerators
Last modified: 2006-04-06 13:42:31 UTC
Since cairo is used the underlineing of menus looks quite wrong. The underline is two pixels wide where the second row is slightly lighter than the first. I remember something about pixel aligning cairo drawing. But not good enough to start patching. Where should I look?
Created attachment 60167 [details] A gtk+ menubar beside some win32 alike
For the handlin of this in the Fontconfig path, see pangofc-font.c:get_face_metrics() and the call to quantize_position(). On the other hand, in pangocairo-win32font.c():create_metrics_for_context() unhinted values are used for the underline position (font size / 14).
Still dont know how to fix it but gtkrc gives the work-around: style "defaultfont" { font_name = "Tahoma 9" } class "GtkWidget" style "defaultfont"
Just copy the quantize_metrics and adopt the functionality... I will accept a patch to make that function a public one in pango-utils.c
Fixed in pango-1-10: 2006-03-30 Tor Lillqvist <tml@novell.com> Fix blurred underlines on Win32 (#332656): * pango/pangocairo-win32font.c (quantize_position): New function, copy from pangofc-font.c. (create_metrics_for_context): Call quantize_position() for underline and strikethrough position and thickness. As for HEAD, attaching a suggested patch that creates a new public function. I had a hard time coming up with a descriptive but reasonably short name for the function...
Created attachment 62363 [details] [review] Suggested patch for HEAD
Looks good. I don't like the idea of exposing things like this in the API, but seems like this is the way we've been going. It's not quite a problem as long as the functions are vaguely reusable say in a new backend, so, fine here too.
So should the new function declaration be inside #ifdef PANGO_ENABLE_BACKEND ?
No, not really. My main concern is about cluttering the ABI and documentation, that PANGO_ENABLE_BACKEND doesn't help at all.
So would you prefer to just copy/paste the quantize_position() function like in 2.10?
I think the documentation should mention the purpose of this function. "avoid blurry lines..."
No, let it be. It comes useful in other situations too. Feel free to improve the docs and commit, or I can do too. Also, it's not necessarily used for horizontal metrics. Works perfectly with hinted metrics and vertical lines too.
OK, committed to HEAD. Removed the "horizontal" from the function name...
Shouldn't the fix have been gone to the pango-1-12 branch instead of 1-10? [I there is really need for maintenance on 1-10 the fix for bug #332538 should be backported too, cause it prevents text cairo/win32 text rendering completely.]
Ah yes, of course ;) A mistake. Will correct.
I retired the 1-10 branch... But wait, bug #332538 doesn't affect 1-10 AFAIR.