[Mono-winforms-list] Combining characters in libgdiplus strings

Dick Porter dporter at codicesoftware.com
Fri Sep 9 10:39:11 EDT 2011


Hi all

I've been tracking down a display bug with winforms.  Basically, any
string drawn that has combining chars (eg accents) doesn't come out
right.  I've attached a screenshot and a sample test.

In the screenshot the two buttons should look identical.  The only
difference is that the one on the left has text using a combining
accent, and the one on the right has the same text but using
pre-combined chars.  They're both valid utf-16; that is, it's not an
encoding issue.

It's caused by libgdiplus using the cairo 'toy' text api to render
strings.  This API takes each character in turn, draws the glyph from
the font, and advances the drawing point by the width of the character
in the font.  The combining accent has a zero width, but by the time it
has come to be drawn the drawing point has already been moved so it
misses the character it's supposed to be combining with.

I've tried enabling the "experimental and unsupported" pango text
rendering support (see attached patch to get around the failed
assertion: (process:27402): Pango-CRITICAL **: pango_fc_font_lock_face:
assertion `PANGO_IS_FC_FONT (font)' failed) but am having font loading
issues when using the 'system' cairo (with or without pango), which the
pango support depends on.

Is there any reason why the pango support can't be enabled by default?

- Dick
-------------- next part --------------
A non-text attachment was scrubbed...
Name: screen-capture.png
Type: image/png
Size: 9596 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20110909/c2652d69/attachment-0001.png 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: filedialog.cs
Url: http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20110909/c2652d69/attachment-0002.pl 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libgdiplus-pango-diff
Url: http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20110909/c2652d69/attachment-0003.pl 


More information about the Mono-winforms-list mailing list