|
|
@ -1,35 +1,37 @@ |
|
|
|
From 1630b7016d26c266d004f38ecfef2c4b708aa9a6 Mon Sep 17 00:00:00 2001 |
|
|
|
From 318ae7fe1bd614cb937c8f43d855a1c2e8e93fd4 Mon Sep 17 00:00:00 2001 |
|
|
|
From: "Avi Halachmi (:avih)" <avihpit@yahoo.com> |
|
|
|
Date: Fri, 26 Oct 2018 13:11:20 +0300 |
|
|
|
Subject: [PATCH] boxdraw: custom-draw U+25XX lines/blocks to align seamlessly |
|
|
|
Date: Wed, 26 Dec 2018 14:51:45 +0200 |
|
|
|
Subject: [PATCH] boxdraw_v2: custom render lines/blocks/braille for perfect |
|
|
|
alignment |
|
|
|
|
|
|
|
It seems impossible to ensure that blocks and line drawing glyphs |
|
|
|
align without visible gaps for all combinations of arbitrary font, |
|
|
|
size and width/height scale factor. |
|
|
|
|
|
|
|
This commit adds an option to custom-draw (without using the font) |
|
|
|
most of the lines/blocks codepoints such that they're rendered |
|
|
|
identically (per size) and align perfectly regardless of font, size |
|
|
|
or chscale/cwscale configuration values. |
|
|
|
This commit adds options to render most of the lines/blocks and |
|
|
|
braille codepoints without using the font such that they align |
|
|
|
perfectly regardless of font, size or other configuration values. |
|
|
|
|
|
|
|
138 shapes are supported (U+2500 - U+259F except dashes, diagonals |
|
|
|
and shades), composited as 16-bit values at boxdraw_data.h . |
|
|
|
Supported codepoints are U+2500 - U+259F except dashes/diagonals, |
|
|
|
and U28XX. |
|
|
|
|
|
|
|
See links and references at boxdraw_data.h |
|
|
|
The lines/blocks data is stored as 16-bit values at boxdraw_data.h |
|
|
|
|
|
|
|
boxdraw/braille are independent, disabled by default at config[.def].h |
|
|
|
---
|
|
|
|
Makefile | 3 +- |
|
|
|
boxdraw.c | 141 ++++++++++++++++++++++++++++++++++ |
|
|
|
boxdraw_data.h | 202 +++++++++++++++++++++++++++++++++++++++++++++++++ |
|
|
|
config.def.h | 8 ++ |
|
|
|
boxdraw.c | 194 ++++++++++++++++++++++++++++++++++++++++++++ |
|
|
|
boxdraw_data.h | 214 +++++++++++++++++++++++++++++++++++++++++++++++++ |
|
|
|
config.def.h | 12 +++ |
|
|
|
st.c | 3 + |
|
|
|
st.h | 9 +++ |
|
|
|
x.c | 19 +++-- |
|
|
|
7 files changed, 379 insertions(+), 6 deletions(-) |
|
|
|
st.h | 10 +++ |
|
|
|
x.c | 21 +++-- |
|
|
|
7 files changed, 451 insertions(+), 6 deletions(-) |
|
|
|
create mode 100644 boxdraw.c |
|
|
|
create mode 100644 boxdraw_data.h |
|
|
|
|
|
|
|
diff --git a/Makefile b/Makefile
|
|
|
|
index 0b3cecd..8d3af33 100644
|
|
|
|
index 470ac86..6dfa212 100644
|
|
|
|
--- a/Makefile
|
|
|
|
+++ b/Makefile
|
|
|
|
@@ -4,7 +4,7 @@
|
|
|
@ -51,72 +53,96 @@ index 0b3cecd..8d3af33 100644 |
|
|
|
|
|
|
|
diff --git a/boxdraw.c b/boxdraw.c
|
|
|
|
new file mode 100644 |
|
|
|
index 0000000..357250f
|
|
|
|
index 0000000..28a92d0
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/boxdraw.c
|
|
|
|
@@ -0,0 +1,141 @@
|
|
|
|
@@ -0,0 +1,194 @@
|
|
|
|
+/*
|
|
|
|
+ * Copyright 2018 Avi Halachmi (:avih) avihpit@yahoo.com https://github.com/avih
|
|
|
|
+ * MIT/X Consortium License
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+#include <X11/Xft/Xft.h>
|
|
|
|
+#include "st.h"
|
|
|
|
+#include "boxdraw_data.h"
|
|
|
|
+
|
|
|
|
+static void drawbox(XftDraw *, int, int, int, int, XftColor *, ushort);
|
|
|
|
+static void drawboxlines(XftDraw *, int, int, int, int, XftColor *, ushort);
|
|
|
|
+/* Rounded non-negative integers division of n / d */
|
|
|
|
+#define DIV(n, d) (((n) + (d) / 2) / (d))
|
|
|
|
+
|
|
|
|
+static Display *xdpy;
|
|
|
|
+static Colormap xcmap;
|
|
|
|
+static XftDraw *xd;
|
|
|
|
+static Visual *xvis;
|
|
|
|
+
|
|
|
|
+static void drawbox(int, int, int, int, XftColor *, XftColor *, ushort);
|
|
|
|
+static void drawboxlines(int, int, int, int, XftColor *, ushort);
|
|
|
|
+
|
|
|
|
+/* public API */
|
|
|
|
+
|
|
|
|
+void
|
|
|
|
+boxdraw_xinit(Display *dpy, Colormap cmap, XftDraw *draw, Visual *vis)
|
|
|
|
+{
|
|
|
|
+ xdpy = dpy; xcmap = cmap; xd = draw, xvis = vis;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int
|
|
|
|
+isboxdraw(const Glyph *g)
|
|
|
|
+isboxdraw(Rune u)
|
|
|
|
+{
|
|
|
|
+ return (g->u & ~0xff) == 0x2500 &&
|
|
|
|
+ boxdata[(uint8_t)g->u] != 0 &&
|
|
|
|
+ (g->mode & ATTR_ITALIC) == 0;
|
|
|
|
+ Rune block = u & ~0xff;
|
|
|
|
+ return (boxdraw && block == 0x2500 && boxdata[(uint8_t)u]) ||
|
|
|
|
+ (boxdraw_braille && block == 0x2800);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/* the "index" is actually the entire shape data encoded as ushort */
|
|
|
|
+ushort
|
|
|
|
+boxdrawindex(const Glyph *g)
|
|
|
|
+{
|
|
|
|
+ return boxdata[(uint8_t)g->u] | ((g->mode & ATTR_BOLD) ? BDB : 0);
|
|
|
|
+ if (boxdraw_braille && (g->u & ~0xff) == 0x2800)
|
|
|
|
+ return BRL | (uint8_t)g->u;
|
|
|
|
+ if (boxdraw_bold && (g->mode & ATTR_BOLD))
|
|
|
|
+ return BDB | boxdata[(uint8_t)g->u];
|
|
|
|
+ return boxdata[(uint8_t)g->u];
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void
|
|
|
|
+drawboxes(XftDraw *xd, int x, int y, int cw, int ch, XftColor *fg,
|
|
|
|
+drawboxes(int x, int y, int cw, int ch, XftColor *fg, XftColor *bg,
|
|
|
|
+ const XftGlyphFontSpec *specs, int len)
|
|
|
|
+{
|
|
|
|
+ for ( ; len-- > 0; x += cw, specs++)
|
|
|
|
+ drawbox(xd, x, y, cw, ch, fg, (ushort)specs->glyph);
|
|
|
|
+ drawbox(x, y, cw, ch, fg, bg, (ushort)specs->glyph);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/* implementation */
|
|
|
|
+
|
|
|
|
+void
|
|
|
|
+drawbox(XftDraw *xd, int x, int y, int w, int h, XftColor *fg, ushort bd)
|
|
|
|
+drawbox(int x, int y, int w, int h, XftColor *fg, XftColor *bg, ushort bd)
|
|
|
|
+{
|
|
|
|
+ ushort cat = bd & ~(BDB | 0xff); /* mask out bold and data */
|
|
|
|
+ if (bd & (BDL | BDA)) {
|
|
|
|
+ /* lines (light/double/heavy/arcs) */
|
|
|
|
+ drawboxlines(xd, x, y, w, h, fg, bd);
|
|
|
|
+ drawboxlines(x, y, w, h, fg, bd);
|
|
|
|
+
|
|
|
|
+ } else if (bd & BBD) {
|
|
|
|
+ } else if (cat == BBD) {
|
|
|
|
+ /* lower (8-X)/8 block */
|
|
|
|
+ int d = ((uint8_t)bd * h + 4) / 8;
|
|
|
|
+ int d = DIV((uint8_t)bd * h, 8);
|
|
|
|
+ XftDrawRect(xd, fg, x, y + d, w, h - d);
|
|
|
|
+
|
|
|
|
+ } else if (bd & BBU) {
|
|
|
|
+ } else if (cat == BBU) {
|
|
|
|
+ /* upper X/8 block */
|
|
|
|
+ XftDrawRect(xd, fg, x, y, w, ((uint8_t)bd * h + 4) / 8);
|
|
|
|
+ XftDrawRect(xd, fg, x, y, w, DIV((uint8_t)bd * h, 8));
|
|
|
|
+
|
|
|
|
+ } else if (bd & BBL) {
|
|
|
|
+ } else if (cat == BBL) {
|
|
|
|
+ /* left X/8 block */
|
|
|
|
+ XftDrawRect(xd, fg, x, y, ((uint8_t)bd * w + 4) / 8, h);
|
|
|
|
+ XftDrawRect(xd, fg, x, y, DIV((uint8_t)bd * w, 8), h);
|
|
|
|
+
|
|
|
|
+ } else if (bd & BBR) {
|
|
|
|
+ } else if (cat == BBR) {
|
|
|
|
+ /* right (8-X)/8 block */
|
|
|
|
+ int d = ((uint8_t)bd * w + 4) / 8;
|
|
|
|
+ int d = DIV((uint8_t)bd * w, 8);
|
|
|
|
+ XftDrawRect(xd, fg, x + d, y, w - d, h);
|
|
|
|
+
|
|
|
|
+ } else if (bd & BBQ) {
|
|
|
|
+ } else if (cat == BBQ) {
|
|
|
|
+ /* Quadrants */
|
|
|
|
+ int w2 = (w + 1) / 2, h2 = (h + 1) / 2;
|
|
|
|
+ int w2 = DIV(w, 2), h2 = DIV(h, 2);
|
|
|
|
+ if (bd & TL)
|
|
|
|
+ XftDrawRect(xd, fg, x, y, w2, h2);
|
|
|
|
+ if (bd & TR)
|
|
|
@ -125,20 +151,49 @@ index 0000000..357250f |
|
|
|
+ XftDrawRect(xd, fg, x, y + h2, w2, h - h2);
|
|
|
|
+ if (bd & BR)
|
|
|
|
+ XftDrawRect(xd, fg, x + w2, y + h2, w - w2, h - h2);
|
|
|
|
+
|
|
|
|
+ } else if (bd & BBS) {
|
|
|
|
+ /* Shades - data is 1/2/3 for 25%/50%/75% alpha, respectively */
|
|
|
|
+ int d = (uint8_t)bd;
|
|
|
|
+ XftColor xfc;
|
|
|
|
+ XRenderColor xrc = { .alpha = 0xffff };
|
|
|
|
+
|
|
|
|
+ xrc.red = DIV(fg->color.red * d + bg->color.red * (4 - d), 4);
|
|
|
|
+ xrc.green = DIV(fg->color.green * d + bg->color.green * (4 - d), 4);
|
|
|
|
+ xrc.blue = DIV(fg->color.blue * d + bg->color.blue * (4 - d), 4);
|
|
|
|
+
|
|
|
|
+ XftColorAllocValue(xdpy, xvis, xcmap, &xrc, &xfc);
|
|
|
|
+ XftDrawRect(xd, &xfc, x, y, w, h);
|
|
|
|
+ XftColorFree(xdpy, xvis, xcmap, &xfc);
|
|
|
|
+
|
|
|
|
+ } else if (cat == BRL) {
|
|
|
|
+ /* braille, each data bit corresponds to one dot at 2x4 grid */
|
|
|
|
+ int w1 = DIV(w, 2);
|
|
|
|
+ int h1 = DIV(h, 4), h2 = DIV(h, 2), h3 = DIV(3 * h, 4);
|
|
|
|
+
|
|
|
|
+ if (bd & 1) XftDrawRect(xd, fg, x, y, w1, h1);
|
|
|
|
+ if (bd & 2) XftDrawRect(xd, fg, x, y + h1, w1, h2 - h1);
|
|
|
|
+ if (bd & 4) XftDrawRect(xd, fg, x, y + h2, w1, h3 - h2);
|
|
|
|
+ if (bd & 8) XftDrawRect(xd, fg, x + w1, y, w - w1, h1);
|
|
|
|
+ if (bd & 16) XftDrawRect(xd, fg, x + w1, y + h1, w - w1, h2 - h1);
|
|
|
|
+ if (bd & 32) XftDrawRect(xd, fg, x + w1, y + h2, w - w1, h3 - h2);
|
|
|
|
+ if (bd & 64) XftDrawRect(xd, fg, x, y + h3, w1, h - h3);
|
|
|
|
+ if (bd & 128) XftDrawRect(xd, fg, x + w1, y + h3, w - w1, h - h3);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void
|
|
|
|
+drawboxlines(XftDraw *xd, int x, int y, int w, int h, XftColor *fg, ushort bd)
|
|
|
|
+drawboxlines(int x, int y, int w, int h, XftColor *fg, ushort bd)
|
|
|
|
+{
|
|
|
|
+ /* s: stem thickness. width/8 roughly matches underscore thickness. */
|
|
|
|
+ /* We draw bold as 1.5 * normal-stem and at least 1px thicker. */
|
|
|
|
+ /* doubles draw at least 3px, even when w or h < 3. bold needs 6px. */
|
|
|
|
+ int mwh = MIN(w, h);
|
|
|
|
+ int base_s = MAX(1, (mwh + 4) / 8);
|
|
|
|
+ int base_s = MAX(1, DIV(mwh, 8));
|
|
|
|
+ int bold = (bd & BDB) && mwh >= 6; /* possibly ignore boldness */
|
|
|
|
+ int s = bold ? MAX(base_s + 1, (3 * base_s + 1) / 2) : base_s;
|
|
|
|
+ int w2 = (w - s + 1) / 2, h2 = (h - s + 1) / 2;
|
|
|
|
+ int s = bold ? MAX(base_s + 1, DIV(3 * base_s, 2)) : base_s;
|
|
|
|
+ int w2 = DIV(w - s, 2), h2 = DIV(h - s, 2);
|
|
|
|
+ /* the s-by-s square (x + w2, y + h2, s, s) is the center texel. */
|
|
|
|
+ /* The base length (per direction till edge) includes this square. */
|
|
|
|
+
|
|
|
@ -198,10 +253,15 @@ index 0000000..357250f |
|
|
|
+}
|
|
|
|
diff --git a/boxdraw_data.h b/boxdraw_data.h
|
|
|
|
new file mode 100644 |
|
|
|
index 0000000..ee78cdc
|
|
|
|
index 0000000..7890500
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/boxdraw_data.h
|
|
|
|
@@ -0,0 +1,202 @@
|
|
|
|
@@ -0,0 +1,214 @@
|
|
|
|
+/*
|
|
|
|
+ * Copyright 2018 Avi Halachmi (:avih) avihpit@yahoo.com https://github.com/avih
|
|
|
|
+ * MIT/X Consortium License
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * U+25XX codepoints data
|
|
|
|
+ *
|
|
|
@ -215,13 +275,18 @@ index 0000000..ee78cdc |
|
|
|
+
|
|
|
|
+/* Each shape is encoded as 16-bits. Higher bits are category, lower are data */
|
|
|
|
+/* Categories (mutually exclusive except BDB): */
|
|
|
|
+/* For convenience, BDL/BDA/BBS/BDB are 1 bit each, the rest are enums */
|
|
|
|
+#define BDL (1<<8) /* Box Draw Lines (light/double/heavy) */
|
|
|
|
+#define BDA (1<<9) /* Box Draw Arc (light) */
|
|
|
|
+
|
|
|
|
+#define BBD (1<<10) /* Box Block Down (lower) X/8 */
|
|
|
|
+#define BBL (1<<11) /* Box Block Left X/8 */
|
|
|
|
+#define BBU (1<<12) /* Box Block Upper X/8 */
|
|
|
|
+#define BBR (1<<13) /* Box Block Right X/8 */
|
|
|
|
+#define BBQ (1<<14) /* Box Block Quadrants */
|
|
|
|
+#define BBL (2<<10) /* Box Block Left X/8 */
|
|
|
|
+#define BBU (3<<10) /* Box Block Upper X/8 */
|
|
|
|
+#define BBR (4<<10) /* Box Block Right X/8 */
|
|
|
|
+#define BBQ (5<<10) /* Box Block Quadrants */
|
|
|
|
+#define BRL (6<<10) /* Box Braille (data is lower byte of U28XX) */
|
|
|
|
+
|
|
|
|
+#define BBS (1<<14) /* Box Block Shades */
|
|
|
|
+#define BDB (1<<15) /* Box Draw is Bold */
|
|
|
|
+
|
|
|
|
+/* (BDL/BDA) Light/Double/Heavy x Left/Up/Right/Down/Horizontal/Vertical */
|
|
|
@ -253,7 +318,7 @@ index 0000000..ee78cdc |
|
|
|
+#define BL (1<<2)
|
|
|
|
+#define BR (1<<3)
|
|
|
|
+
|
|
|
|
+/* 138 shapes are supported: U+2500 - U+259F except dashes/diagonals/shades */
|
|
|
|
+/* Data for U+2500 - U+259F except dashes/diagonals */
|
|
|
|
+static const unsigned short boxdata[256] = {
|
|
|
|
+ /* light lines */
|
|
|
|
+ [0x00] = BDL + LH, /* light horizontal */
|
|
|
@ -400,45 +465,51 @@ index 0000000..ee78cdc |
|
|
|
+ [0x9e] = BBQ + BL + TR,
|
|
|
|
+ [0x9f] = BBQ + BL + TR + BR,
|
|
|
|
+
|
|
|
|
+ /* Shades, data is an alpha value in 25% units (1/4, 1/2, 3/4) */
|
|
|
|
+ [0x91] = BBS + 1, [0x92] = BBS + 2, [0x93] = BBS + 3,
|
|
|
|
+
|
|
|
|
+ /* U+2504 - U+250B, U+254C - U+254F: unsupported (dashes) */
|
|
|
|
+ /* U+2571 - U+2573: unsupported (diagonals) */
|
|
|
|
+ /* U+2591 - U+2593: unsupported (shades) */
|
|
|
|
+};
|
|
|
|
diff --git a/config.def.h b/config.def.h
|
|
|
|
index 823e79f..018cbe4 100644
|
|
|
|
index 0e01717..e3654a9 100644
|
|
|
|
--- a/config.def.h
|
|
|
|
+++ b/config.def.h
|
|
|
|
@@ -56,6 +56,14 @@ static unsigned int blinktimeout = 800;
|
|
|
|
@@ -56,6 +56,18 @@ static unsigned int blinktimeout = 800;
|
|
|
|
*/ |
|
|
|
static unsigned int cursorthickness = 2; |
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * 1: custom-draw (without using the font) most of the lines/blocks characters
|
|
|
|
+ * for gapless alignment between cells. This includes all the codepoints at
|
|
|
|
+ * U+2500 - U+259F except dashes, diagonals and shades.
|
|
|
|
+ * 0: disable (render all glyphs normally from the font).
|
|
|
|
+ * 1: render most of the lines/blocks characters without using the font for
|
|
|
|
+ * perfect alignment between cells (U2500 - U259F except dashes/diagonals).
|
|
|
|
+ * Bold affects lines thickness if boxdraw_bold is not 0. Italic is ignored.
|
|
|
|
+ * 0: disable (render all U25XX glyphs normally from the font).
|
|
|
|
+ */
|
|
|
|
+const int boxdraw = 0;
|
|
|
|
+const int boxdraw_bold = 0;
|
|
|
|
+
|
|
|
|
+/* braille (U28XX): 1: render as adjacent "pixels", 0: use font */
|
|
|
|
+const int boxdraw_braille = 0;
|
|
|
|
+
|
|
|
|
/* |
|
|
|
* bell volume. It must be a value between -100 and 100. Use 0 for disabling |
|
|
|
* it |
|
|
|
diff --git a/st.c b/st.c
|
|
|
|
index 46cf2da..7ee136a 100644
|
|
|
|
index b8e6077..d65f722 100644
|
|
|
|
--- a/st.c
|
|
|
|
+++ b/st.c
|
|
|
|
@@ -1228,6 +1228,9 @@ tsetchar(Rune u, Glyph *attr, int x, int y)
|
|
|
|
@@ -1230,6 +1230,9 @@ tsetchar(Rune u, Glyph *attr, int x, int y)
|
|
|
|
term.dirty[y] = 1; |
|
|
|
term.line[y][x] = *attr; |
|
|
|
term.line[y][x].u = u; |
|
|
|
+
|
|
|
|
+ if (boxdraw && isboxdraw(&term.line[y][x]))
|
|
|
|
+ if (isboxdraw(u))
|
|
|
|
+ term.line[y][x].mode |= ATTR_BOXDRAW;
|
|
|
|
} |
|
|
|
|
|
|
|
void |
|
|
|
diff --git a/st.h b/st.h
|
|
|
|
index 38c61c4..fc68c3b 100644
|
|
|
|
index 38c61c4..9275632 100644
|
|
|
|
--- a/st.h
|
|
|
|
+++ b/st.h
|
|
|
|
@@ -33,6 +33,7 @@ enum glyph_attribute {
|
|
|
@ -449,30 +520,40 @@ index 38c61c4..fc68c3b 100644 |
|
|
|
ATTR_BOLD_FAINT = ATTR_BOLD | ATTR_FAINT, |
|
|
|
}; |
|
|
|
|
|
|
|
@@ -110,6 +111,13 @@ void *xmalloc(size_t);
|
|
|
|
@@ -110,6 +111,14 @@ void *xmalloc(size_t);
|
|
|
|
void *xrealloc(void *, size_t); |
|
|
|
char *xstrdup(char *); |
|
|
|
|
|
|
|
+int isboxdraw(const Glyph *);
|
|
|
|
+int isboxdraw(Rune);
|
|
|
|
+ushort boxdrawindex(const Glyph *);
|
|
|
|
+#ifdef XFT_VERSION
|
|
|
|
+/* only exposed to x.c, otherwise we'll need Xft.h for the types */
|
|
|
|
+void drawboxes(XftDraw *, int, int, int, int, XftColor *, const XftGlyphFontSpec *, int);
|
|
|
|
+void boxdraw_xinit(Display *, Colormap, XftDraw *, Visual *);
|
|
|
|
+void drawboxes(int, int, int, int, XftColor *, XftColor *, const XftGlyphFontSpec *, int);
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
/* config.h globals */ |
|
|
|
extern char *utmp; |
|
|
|
extern char *stty_args; |
|
|
|
@@ -120,3 +128,4 @@ extern char *termname;
|
|
|
|
@@ -120,3 +129,4 @@ extern char *termname;
|
|
|
|
extern unsigned int tabspaces; |
|
|
|
extern unsigned int defaultfg; |
|
|
|
extern unsigned int defaultbg; |
|
|
|
+extern const int boxdraw;
|
|
|
|
+extern const int boxdraw, boxdraw_bold, boxdraw_braille;
|
|
|
|
diff --git a/x.c b/x.c
|
|
|
|
index 00cb6b1..730f525 100644
|
|
|
|
index 0422421..c740bed 100644
|
|
|
|
--- a/x.c
|
|
|
|
+++ b/x.c
|
|
|
|
@@ -1164,8 +1164,13 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
|
|
|
|
@@ -1118,6 +1118,8 @@ xinit(int cols, int rows)
|
|
|
|
xsel.xtarget = XInternAtom(xw.dpy, "UTF8_STRING", 0); |
|
|
|
if (xsel.xtarget == None) |
|
|
|
xsel.xtarget = XA_STRING; |
|
|
|
+
|
|
|
|
+ boxdraw_xinit(xw.dpy, xw.cmap, xw.draw, xw.vis);
|
|
|
|
} |
|
|
|
|
|
|
|
int |
|
|
|
@@ -1164,8 +1166,13 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len, int x
|
|
|
|
yp = winy + font->ascent; |
|
|
|
} |
|
|
|
|
|
|
@ -488,14 +569,14 @@ index 00cb6b1..730f525 100644 |
|
|
|
if (glyphidx) { |
|
|
|
specs[numspecs].font = font->match; |
|
|
|
specs[numspecs].glyph = glyphidx; |
|
|
|
@@ -1372,8 +1377,12 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
|
|
|
|
@@ -1372,8 +1379,12 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, int x, i
|
|
|
|
r.width = width; |
|
|
|
XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1); |
|
|
|
|
|
|
|
- /* Render the glyphs. */
|
|
|
|
- XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
|
|
|
|
+ if (base.mode & ATTR_BOXDRAW) {
|
|
|
|
+ drawboxes(xw.draw, winx, winy, width / len, win.ch, fg, specs, len);
|
|
|
|
+ drawboxes(winx, winy, width / len, win.ch, fg, bg, specs, len);
|
|
|
|
+ } else {
|
|
|
|
+ /* Render the glyphs. */
|
|
|
|
+ XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
|
|
|
@ -503,7 +584,7 @@ index 00cb6b1..730f525 100644 |
|
|
|
|
|
|
|
/* Render underline and strikethrough. */ |
|
|
|
if (base.mode & ATTR_UNDERLINE) { |
|
|
|
@@ -1416,7 +1425,7 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
|
|
|
|
@@ -1416,7 +1427,7 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
|
|
|
|
/* |
|
|
|
* Select the right color for the right mode. |
|
|
|
*/ |
|
|
@ -513,5 +594,5 @@ index 00cb6b1..730f525 100644 |
|
|
|
if (IS_SET(MODE_REVERSE)) { |
|
|
|
g.mode |= ATTR_REVERSE; |
|
|
|
--
|
|
|
|
2.19.1 |
|
|
|
2.17.1 |
|
|
|
|