http://bugzilla.novell.com/show_bug.cgi?id=473758
User [email protected] added comment http://bugzilla.novell.com/show_bug.cgi?id=473758#c1 stephen robinson <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from stephen robinson <[email protected]> 2009-09-16 07:18:51 MDT --- I've been doing some more work on the program of mine that originally found this bug (or more specifically #468987) and have had a chance to trace the problem a bit further. I should warn you, I know almost nothing about unicode so some of the following might not be quite right. The problem appears to be that the byte sequence 0xD8 0xD9 doesn't represent a valid character in UTF-16, the range 0xD800 to 0xDFFF is reserved for surrogate pairs. Specifically the range 0xD800 to 0xDBFF is reserved for the high bytes of the pairs and the range 0xDC00 to 0xDFFF is reserved for the low byte of the pairs. So we can see that the sequence 0xD8 0xD9 is two high bytes and is invalid. This doesn't cause a problem on microsoft's implementation of MeasureString(), I haven't checked the exact behaviour but it silently handles the bad sequence and everything just works. In the mono implementation we get the GDI+ generic error. This error is produced because MeasureString() calls CalculateStringWidths() in text-cairo.c in libgdiplus. CalculateStringWidths() calls utf8_encode_ucs2char() which blindly converts the invalid UTF-16 to UTF-8. CalculateStringWidths() then calls cairo_text_extents() with the bad string. This results in the cairo status variable in graphics->ct containing an error code. When cairo_status() is next called we get the GDI+ generic error. In the example code this is when FillRectangle() calls fill_graphics_with_brush() which calls cairo_status() at the end. I don't know how this should be fixed, whether the bad codes should be stripped from the string before measuring or if the status code should be reset. I've run out of time again to look any further so I thought I'd provide the above in the hope that it helps someone else work out a fix. -- Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
