[vte/wip/egmont/bidi: 20/79] mirror parens and such
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte/wip/egmont/bidi: 20/79] mirror parens and such
- Date: Fri, 28 Sep 2018 08:13:42 +0000 (UTC)
commit ee1e62852b6a261909fb49e1e620f3b6f8160a66
Author: Egmont Koblinger <egmont gmail com>
Date: Sun Aug 19 23:49:29 2018 +0200
mirror parens and such
src/vte.cc | 3 ++-
src/vtedraw.cc | 17 ++++++++++++-----
src/vtedraw.hh | 1 +
3 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/vte.cc b/src/vte.cc
index e4b10838..81f60333 100644
--- a/src/vte.cc
+++ b/src/vte.cc
@@ -8951,7 +8951,8 @@ Terminal::draw_rows(VteScreen *screen_,
items[item_count].columns = cell->attr.columns();
items[item_count].x = col * column_width;
items[item_count].y = y;
- items[item_count].mirror = ((row_data->attr.bidi_flags & (VTE_BIDI_RTL |
VTE_BIDI_BOX_MIRROR)) == (VTE_BIDI_RTL | VTE_BIDI_BOX_MIRROR)); // FIXME
+ items[item_count].mirror = !!(row_data->attr.bidi_flags & VTE_BIDI_RTL); // FIXME
+ items[item_count].box_mirror = !!(row_data->attr.bidi_flags & VTE_BIDI_BOX_MIRROR);
item_count++;
}
diff --git a/src/vtedraw.cc b/src/vtedraw.cc
index a279cbe4..7e52cfe2 100644
--- a/src/vtedraw.cc
+++ b/src/vtedraw.cc
@@ -1161,15 +1161,16 @@ _vte_draw_terminal_draw_graphic(struct _vte_draw *draw, vteunistr c, gboolean mi
upper_half - light_line_width / 2 + light_line_width,
upper_half - heavy_line_width / 2 + heavy_line_width,
height};
- int xi, yi;
+ int xi, xi_bidi, yi;
cairo_set_line_width(cr, 0);
for (yi = 4; yi >= 0; yi--) {
- for (xi = mirror ? 0 : 4; xi >= 0 && xi <= 4; mirror ? xi++ : xi--) {
+ for (xi = 4; xi >= 0; xi--) {
if (bitmap & 1) {
+ xi_bidi = mirror ? 4 - xi : xi;
cairo_rectangle(cr,
- x + xboundaries[xi],
+ x + xboundaries[xi_bidi],
y + yboundaries[yi],
- xboundaries[xi + 1] - xboundaries[xi],
+ xboundaries[xi_bidi + 1] - xboundaries[xi_bidi],
yboundaries[yi + 1] - yboundaries[yi]);
cairo_fill(cr);
}
@@ -1471,6 +1472,12 @@ _vte_draw_text_internal (struct _vte_draw *draw,
for (i = 0; i < n_requests; i++) {
vteunistr c = requests[i].c;
+
+ if (G_UNLIKELY (requests[i].mirror)) {
+ // FIXME what if 'c' is actually a real vteunistr?
+ g_unichar_get_mirror_char (c, &c);
+ }
+
struct unistr_info *uinfo = font_info_get_unistr_info (font, c);
union unistr_font_info *ufi = &uinfo->ufi;
int x, y;
@@ -1480,7 +1487,7 @@ _vte_draw_text_internal (struct _vte_draw *draw,
y = requests[i].y + draw->char_spacing.top + font->ascent;
if (_vte_draw_unichar_is_local_graphic(c)) {
- _vte_draw_terminal_draw_graphic(draw, c, requests[i].mirror, color,
+ _vte_draw_terminal_draw_graphic(draw, c, requests[i].mirror &&
requests[i].box_mirror, color,
requests[i].x, requests[i].y,
font->width, requests[i].columns, font->height);
continue;
diff --git a/src/vtedraw.hh b/src/vtedraw.hh
index eb292bcc..b759ec65 100644
--- a/src/vtedraw.hh
+++ b/src/vtedraw.hh
@@ -45,6 +45,7 @@ struct _vte_draw_text_request {
vteunistr c;
gshort x, y, columns;
guint8 mirror : 1;
+ guint8 box_mirror : 1;
};
guint _vte_draw_get_style(gboolean bold, gboolean italic);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]