From 4c954be7a6d86b21da512fc533eb3362ac737221 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Mon, 31 May 2021 17:10:05 +0200 Subject: config: add boolean option tweak.pua-double-width When enabled, PUA (Private Usage Area) codepoints are always treated as double-width glyphs, regardless of the actual glyph width. Requires allow-overflowing-double-width-glyphs=yes --- render.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'render.c') diff --git a/render.c b/render.c index 5ca64738..d66058c8 100644 --- a/render.c +++ b/render.c @@ -499,9 +499,9 @@ render_cell(struct terminal *term, pixman_image_t *pix, const struct fcft_glyph *glyph = NULL; const struct composed *composed = NULL; - if (cell->wc != 0) { - wchar_t base = cell->wc; + wchar_t base = cell->wc; + if (base != 0) { if (base >= CELL_COMB_CHARS_LO && base < (CELL_COMB_CHARS_LO + term->composed_count)) { @@ -576,11 +576,15 @@ render_cell(struct terminal *term, pixman_image_t *pix, * - *this* cells is followed by an empty cell, or a space */ if (term->conf->tweak.allow_overflowing_double_width_glyphs && - glyph != NULL && - glyph->cols == 1 && - glyph->width >= term->cell_width * 15 / 10 && - glyph->width < 3 * term->cell_width && - col < term->cols - 1 && + ((glyph != NULL && + glyph->cols == 1 && + glyph->width >= term->cell_width * 15 / 10 && + glyph->width < 3 * term->cell_width && + col < term->cols - 1) || + (term->conf->tweak.pua_double_width && + ((base >= 0x00e000 && base <= 0x00f8ff) || + (base >= 0x0f0000 && base <= 0x0ffffd) || + (base >= 0x100000 && base <= 0x10fffd)))) && (row->cells[col + 1].wc == 0 || row->cells[col + 1].wc == L' ')) { cell_cols = 2; -- cgit v1.3