After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 332656 - Blurred underlines on menu accelerators
Blurred underlines on menu accelerators
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: win32
unspecified
Other Windows
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
pango-maint
Depends on:
Blocks: 125378
 
 
Reported: 2006-02-26 18:45 UTC by Hans Breuer
Modified: 2006-04-06 13:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A gtk+ menubar beside some win32 alike (14.37 KB, image/png)
2006-02-26 18:47 UTC, Hans Breuer
  Details
Suggested patch for HEAD (5.70 KB, patch)
2006-03-30 08:20 UTC, Tor Lillqvist
none Details | Review

Description Hans Breuer 2006-02-26 18:45:43 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?
Comment 1 Hans Breuer 2006-02-26 18:47:24 UTC
Created attachment 60167 [details]
A gtk+ menubar beside some win32 alike
Comment 2 Owen Taylor 2006-02-26 20:26:43 UTC
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).
Comment 3 Hans Breuer 2006-02-26 21:40:30 UTC
Still dont know how to fix it but gtkrc gives the work-around:

style "defaultfont"
{
  font_name = "Tahoma 9"
}

class "GtkWidget" style "defaultfont"
Comment 4 Behdad Esfahbod 2006-02-26 21:54:37 UTC
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
Comment 5 Tor Lillqvist 2006-03-30 07:45:49 UTC
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...

Comment 6 Tor Lillqvist 2006-03-30 08:20:29 UTC
Created attachment 62363 [details] [review]
Suggested patch for HEAD
Comment 7 Behdad Esfahbod 2006-03-30 09:42:50 UTC
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.
Comment 8 Tor Lillqvist 2006-03-30 09:58:36 UTC
So should the new function declaration be inside #ifdef PANGO_ENABLE_BACKEND ?
Comment 9 Behdad Esfahbod 2006-03-30 10:06:13 UTC
No, not really.

My main concern is about cluttering the ABI and documentation, that PANGO_ENABLE_BACKEND doesn't help at all.
Comment 10 Tor Lillqvist 2006-03-30 13:38:51 UTC
So would you prefer to just copy/paste the quantize_position() function like in 2.10?
Comment 11 Matthias Clasen 2006-03-30 14:47:40 UTC
I think the documentation should mention the purpose of this function.
"avoid blurry lines..."
Comment 12 Behdad Esfahbod 2006-03-30 22:25:20 UTC
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.  
Comment 13 Tor Lillqvist 2006-03-31 00:22:46 UTC
OK, committed to HEAD. Removed the "horizontal" from the function name...
Comment 14 Hans Breuer 2006-04-01 15:46:54 UTC
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.]
Comment 15 Tor Lillqvist 2006-04-01 17:59:42 UTC
Ah yes, of course ;) A mistake. Will correct.
Comment 16 Behdad Esfahbod 2006-04-01 19:54:34 UTC
I retired the 1-10 branch... But wait, bug #332538 doesn't affect 1-10 AFAIR.