Index: hexchat-2.12.4/src/fe-gtk/xtext.c =================================================================== --- hexchat-2.12.4.orig/src/fe-gtk/xtext.c +++ hexchat-2.12.4/src/fe-gtk/xtext.c @@ -321,20 +321,10 @@ backend_get_text_width_emph (GtkXText *x width = 0; pango_layout_set_attributes (xtext->layout, attr_lists[emphasis]); - while (len > 0) - { - mbl = charlen(str); - if (*str < 128) - deltaw = fontwidths[emphasis][*str]; - else - { - pango_layout_set_text (xtext->layout, str, mbl); - pango_layout_get_pixel_size (xtext->layout, &deltaw, NULL); - } - width += deltaw; - str += mbl; - len -= mbl; - } + + /* This code is slow, but it will get the correct width from pango. */ + pango_layout_set_text (xtext->layout, str, len); + pango_layout_get_pixel_size (xtext->layout, &width, NULL); return width; }