[vte/wip/attr: 5/5] widget: Translate more pango attributes in the IM string
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/attr: 5/5] widget: Translate more pango attributes in the IM string
- Date: Fri, 12 Jan 2018 17:50:44 +0000 (UTC)
commit 8b34b2e8d3b4b4af9853b3bcb90f00997714af37
Author: Christian Persch <chpe src gnome org>
Date: Fri Jan 12 18:49:04 2018 +0100
widget: Translate more pango attributes in the IM string
Take underline colour, underline style and font style from the
PangoAttribute list.
src/vte.cc | 41 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 40 insertions(+), 1 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index aa6a810..19f2b7b 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]