+ wxCharBuffer buf(n + 6);
+ // copy the leading U+200C ZERO WIDTH NON-JOINER encoded in UTF8 format
+ memcpy(buf.data(), "\342\200\214", 3);
+ // copy the user string
+ memcpy(buf.data() + 3, text, n);
+ // copy the trailing U+200C ZERO WIDTH NON-JOINER encoded in UTF8 format
+ memcpy(buf.data() + 3 + n, "\342\200\214", 3);
+
+ pango_layout_set_text(layout, buf, n + 6);
+
+ // Add dummy attributes (use colour as it's invisible anyhow for 0
+ // width spaces) to ensure that the spaces in the beginning/end of the
+ // string are underlined too.
+ a = pango_attr_foreground_new(0x0057, 0x52A9, 0xD614);
+ a->start_index = 0;
+ a->end_index = 3;
+ pango_attr_list_insert(attrs, a);
+
+ a = pango_attr_foreground_new(0x0057, 0x52A9, 0xD614);
+ a->start_index = n + 3;
+ a->end_index = n + 6;
+ pango_attr_list_insert(attrs, a);