Series of Bugs
Black and blue
And who knows which is which and who is who
Up and down
And in the end it's only round and round
The deadline for submitting Google Summer of Code
proposals is about 24 hours from now. We still have not got enough strong proposals for GNOME. If you are student, if you love GNOME, go ahead and submit
. There's a looong list of ideas, and you are more than welcome to submit your own ideas.]
Since Gtk+ 2.8 moved to PangoCairo, there have been a few highly dupped irritating bugs all with the same theme of hinting and off-by-one issues. Past few weeks I managed to debug and bash them all. In the chronological order here they come, with their patches:
- Incorrect text rendering when in x86 64-bit precision mode. Filed as a cairo bug. The patch was something like this:
-#define PANGO_UNITS(x) ((int)((x) * PANGO_SCALE))(This probably would have been fixed by fixing the third bug in the list too.)
+#define PANGO_UNITS(x) ((int)((x) * PANGO_SCALE + 0.49999))
- Text is shifted off-by-one in Add to panel. Assigned to Pango, but libgnomecanvas highly suspected. Turned out it's a gdkpango bug. The patch was:
- cairo_move_to (cr, x / PANGO_SCALE, y / PANGO_SCALE);After finding the bug, it became apparent that it only can happen if the next bug hits.
+ cairo_move_to (cr, (double)x / PANGO_SCALE, (double)y / PANGO_SCALE);
- Unhinted fonts are measured incorrectly and drawing problems occur as a result.
+ /* fcfont's is_hinted controls metric hinting */Ironically I suggested this patch in December, but Owen said it wouldn't work AND the reporter said it didn't. It turned out this is the correct fix indeed.
+ PANGO_FC_FONT(cffont)->is_hinted =
+ (cairo_font_options_get_hint_metrics(font_options) !=
- pango_layout_get_pixel_extents and pango_layout_get_pixel_size cause off-by-one metrics. This one was not reported and I opened myself, but was also raised in an email thread by Morten. I suspect the fix for this may have had some of the above bugs fixed, or maybe not. Anyway, it looks more correct now. The question to answer is how to round logical and ink rectangle metrics. The current code was simply rounding x, y, width, and height. Say your rounding function is f(.). There are two problems with this:
Apparently I managed to not blog for two weeks. Hopefully this rather long post broke the thin ice.
Out of the way, it's a busy day
I've got things on my mind
For want of the price of tea and a slice
The old man died