diff options
author | Christian Persch <chpe@src.gnome.org> | 2018-01-12 18:49:04 +0100 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2018-01-12 18:49:04 +0100 |
commit | 8b34b2e8d3b4b4af9853b3bcb90f00997714af37 (patch) | |
tree | e72d315e0a4654d5a38f44f1ab658a897335424e | |
parent | e7663808a4dfbbf6e3dd42683b721fb005719fca (diff) | |
download | vte-wip/attr.tar.gz |
widget: Translate more pango attributes in the IM stringwip/attr
Take underline colour, underline style and font style from the
PangoAttribute list.
-rw-r--r-- | src/vte.cc | 41 |
1 files changed, 40 insertions, 1 deletions
@@ -9259,6 +9259,20 @@ VteTerminalPrivate::apply_pango_attr(PangoAttribute *attr, } } break; + case PANGO_ATTR_UNDERLINE_COLOR: + attrcolor = (PangoAttrColor*) attr; + ival = VTE_RGB_COLOR(4, 5, 4, + ((attrcolor->color.red & 0xFF00) >> 8), + ((attrcolor->color.green & 0xFF00) >> 8), + ((attrcolor->color.blue & 0xFF00) >> 8)); + for (i = attr->start_index; + i < attr->end_index && i < n_cells; + i++) { + if (attr->klass->type == PANGO_ATTR_UNDERLINE) { + cells[i].attr.set_deco(ival); + } + } + break; case PANGO_ATTR_STRIKETHROUGH: attrint = (PangoAttrInt*) attr; ival = attrint->value; @@ -9274,7 +9288,23 @@ VteTerminalPrivate::apply_pango_attr(PangoAttribute *attr, for (i = attr->start_index; (i < attr->end_index) && (i < n_cells); i++) { - cells[i].attr.set_underline(ival == PANGO_UNDERLINE_SINGLE ? 1 : 0); + unsigned int underline = 0; + switch (ival) { + case PANGO_UNDERLINE_SINGLE: + underline = 1; + break; + case PANGO_UNDERLINE_DOUBLE: + underline = 2; + break; + case PANGO_UNDERLINE_ERROR: + underline = 3; /* wavy */ + break; + case PANGO_UNDERLINE_NONE: + case PANGO_UNDERLINE_LOW: /* FIXME */ + underline = 0; + break; + } + cells[i].attr.set_underline(underline); } break; case PANGO_ATTR_WEIGHT: @@ -9286,6 +9316,15 @@ VteTerminalPrivate::apply_pango_attr(PangoAttribute *attr, cells[i].attr.set_bold(ival >= PANGO_WEIGHT_BOLD); } break; + case PANGO_ATTR_STYLE: + attrint = (PangoAttrInt*) attr; + ival = attrint->value; + for (i = attr->start_index; + (i < attr->end_index) && (i < n_cells); + i++) { + cells[i].attr.set_italic(ival != PANGO_STYLE_NORMAL); + } + break; default: break; } |