├── urxvt.desktop ├── urxvtc.desktop ├── urxvt-tabbed.desktop ├── line-spacing-fix.patch ├── font-width-fix.patch ├── README.md ├── add-space-to-extent_test_chars.patch ├── .SRCINFO ├── PKGBUILD ├── sgr-mouse-mode.patch └── enable-wide-glyphs.patch /urxvt.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Encoding=UTF-8 4 | Name=urxvt 5 | Comment=An unicode capable rxvt clone 6 | Exec=urxvt 7 | Icon=terminal 8 | Terminal=false 9 | Type=Application 10 | Categories=Application;System;TerminalEmulator; 11 | -------------------------------------------------------------------------------- /urxvtc.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Encoding=UTF-8 4 | Name=urxvt (client) 5 | Comment=An unicode capable rxvt clone client for urxvtd 6 | Exec=urxvtc 7 | Icon=terminal 8 | Terminal=false 9 | Type=Application 10 | Categories=Application;System;TerminalEmulator; 11 | -------------------------------------------------------------------------------- /urxvt-tabbed.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Encoding=UTF-8 4 | Name=urxvt (tabbed) 5 | Comment=An unicode capable and tabbed rxvt clone 6 | Exec=urxvt-tabbed 7 | Icon=terminal 8 | Terminal=false 9 | Type=Application 10 | Categories=Application;System;TerminalEmulator; 11 | -------------------------------------------------------------------------------- /line-spacing-fix.patch: -------------------------------------------------------------------------------- 1 | --- src/rxvtfont.C.orig 2011-07-20 22:19:29.878012201 -0300 2 | +++ src/rxvtfont.C 2011-07-20 22:19:33.634671723 -0300 3 | @@ -1237,11 +1237,22 @@ 4 | 5 | FT_Face face = XftLockFace (f); 6 | 7 | +/* 8 | + * use ascent, descent and height from XftFont *f instead of FT_Face face. 9 | + * this somehow reproduces the behaviour of the line height as seen on xterm. 10 | + 11 | ascent = (face->size->metrics.ascender + 63) >> 6; 12 | descent = (-face->size->metrics.descender + 63) >> 6; 13 | height = max (ascent + descent, (face->size->metrics.height + 63) >> 6); 14 | width = 0; 15 | 16 | + */ 17 | + 18 | + ascent = f->ascent; 19 | + descent = f->descent; 20 | + height = max (ascent + descent, f->height); 21 | + width = 0; 22 | + 23 | bool scalable = face->face_flags & FT_FACE_FLAG_SCALABLE; 24 | 25 | XftUnlockFace (f); 26 | -------------------------------------------------------------------------------- /font-width-fix.patch: -------------------------------------------------------------------------------- 1 | --- src/rxvtfont.C.bukind 2007-11-30 14:36:33.000000000 +0600 2 | +++ src/rxvtfont.C 2007-11-30 14:39:29.000000000 +0600 3 | @@ -1171,12 +1171,21 @@ 4 | XGlyphInfo g; 5 | XftTextExtents16 (disp, f, &ch, 1, &g); 6 | 7 | +/* 8 | + * bukind: don't use g.width as a width of a character! 9 | + * instead use g.xOff, see e.g.: http://keithp.com/~keithp/render/Xft.tutorial 10 | + 11 | g.width -= g.x; 12 | 13 | int wcw = WCWIDTH (ch); 14 | if (wcw > 0) g.width = (g.width + wcw - 1) / wcw; 15 | 16 | if (width < g.width ) width = g.width; 17 | + */ 18 | + int wcw = WCWIDTH (ch); 19 | + if (wcw > 1) g.xOff = g.xOff / wcw; 20 | + if (width < g.xOff) width = g.xOff; 21 | + 22 | if (height < g.height ) height = g.height; 23 | if (glheight < g.height - g.y) glheight = g.height - g.y; 24 | } 25 | 26 | 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PKGBUILD for rxvt-unicode with support for displaying wide glyphs 2 | 3 | This PKGBUILD builds urxvt-unicode with the patch from 4 | https://github.com/blueyed/rxvt-unicode/tree/display-wide-glyphs to display 5 | glyhps that are too wide instead of a square. 6 | 7 | urxvt considers the font to be broken, e.g. if the glyph is wider than the 8 | number of cells that `wcwidth(3)` reports. This gets better with Unicode 9 9 | (since e.g. more characters are assigned a width of 2), but it does not help 10 | with characters from the Private Use Area (e.g. Font Awesome). 11 | 12 | I am coming back to this approach after 13 | https://github.com/blueyed/rxvt-unicode/pull/1 turned out to be too fragile: 14 | 15 | 1. the method of using a socket for communication fails for remote 16 | applications, and already when re-attaching to a tmux session after closing 17 | the terminal it was started from (where the terminal cannot respond to 18 | requests on the socket then anymore). 19 | 2. using OSC terminal escape sequences also does not work with tmux (server), 20 | and other applications that have no tty attached. 21 | 22 | 23 | Included in Arch's user repository (AUR): https://aur.archlinux.org/packages/rxvt-unicode-cvs-patched-wideglyphs/ 24 | -------------------------------------------------------------------------------- /add-space-to-extent_test_chars.patch: -------------------------------------------------------------------------------- 1 | Add space to extent_test_chars to have FontAwesome being recognized. 2 | 3 | Fixes: 4 | 5 | $ urxvt -fn "xft:FontAwesome" 6 | urxvt: unable to calculate font width for 'FontAwesome:minspace=True', ignoring. 7 | urxvt: unable to load base fontset, please specify a valid one using -fn, aborting. 8 | 9 | Posted to upstream mailinglist: 10 | 11 | http://lists.schmorp.de/pipermail/rxvt-unicode/2016q4/002308.html 12 | Followed up in http://lists.schmorp.de/pipermail/rxvt-unicode/2017q4/002441.html 13 | 14 | src/rxvtfont.C | 2 +- 15 | 1 file changed, 1 insertion(+), 1 deletion(-) 16 | 17 | diff --git a/src/rxvtfont.C b/src/rxvtfont.C 18 | index c56921c..5932f03 100644 19 | --- a/src/rxvtfont.C 20 | +++ b/src/rxvtfont.C 21 | @@ -155,7 +155,7 @@ static const struct rxvt_fallback_font { 22 | // these characters are used to guess the font height and width 23 | // pango uses a similar algorithm and doesn't trust the font either. 24 | static uint16_t extent_test_chars[] = { 25 | - '0', '1', '8', 'a', 'd', 'x', 'm', 'y', 'g', 'W', 'X', '\'', '_', 26 | + ' ', '0', '1', '8', 'a', 'd', 'x', 'm', 'y', 'g', 'W', 'X', '\'', '_', 27 | 0x00cd, 0x00d5, 0x0114, 0x0177, 0x0643, // ÍÕĔŷﻙ 28 | 0x304c, 0x672c, // が本 29 | }; 30 | -- 31 | 2.10.0 32 | 33 | -------------------------------------------------------------------------------- /.SRCINFO: -------------------------------------------------------------------------------- 1 | pkgbase = rxvt-unicode-cvs-patched-wideglyphs 2 | pkgdesc = Unicode enabled rxvt-clone terminal emulator (urxvt) with fixed font spacing and wide glyphs patch (cvs version) 3 | pkgver = 20170412 4 | pkgrel = 6 5 | url = http://software.schmorp.de/pkg/rxvt-unicode.html 6 | arch = i686 7 | arch = x86_64 8 | license = GPL 9 | makedepends = cvs 10 | depends = libxft 11 | depends = perl 12 | depends = startup-notification 13 | depends = rxvt-unicode-terminfo 14 | optdepends = gtk2-perl: to use the urxvt-tabbed 15 | provides = rxvt-unicode 16 | conflicts = rxvt-unicode 17 | source = urxvt.desktop 18 | source = urxvtc.desktop 19 | source = urxvt-tabbed.desktop 20 | source = font-width-fix.patch 21 | source = line-spacing-fix.patch 22 | source = sgr-mouse-mode.patch 23 | source = add-space-to-extent_test_chars.patch 24 | source = enable-wide-glyphs.patch 25 | sha1sums = b5a4507f85ebb7bac589db2e07d9bc40106720d9 26 | sha1sums = 62c4ffecfce6967def394dd4d418b68652372ea2 27 | sha1sums = cd204d608d114d39c80331efe0af0231ad6b7e18 28 | sha1sums = 01ee8f212add79a158dcd4ed78d0ea1324bdc59b 29 | sha1sums = b7fde1c46af45e831828738874f14b092b1e795f 30 | sha1sums = f478acf3662aab3f5b1703a4a29bcfe055dbdd66 31 | sha1sums = 69b77c0b4b4587117f3a6e240a5bd6389ed40be3 32 | sha1sums = 5b37be933d9b6cc1f7e3129a69c338d232bf7808 33 | 34 | pkgname = rxvt-unicode-cvs-patched-wideglyphs 35 | 36 | -------------------------------------------------------------------------------- /PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: Daniel Hahler 2 | # Contributor: Florian Bruhin (The-Compiler) 3 | # Contributor: Daniel Micay 4 | # Contributor: Sébastien Luttringer 5 | # Contributor: Angel Velasquez 6 | # Contributor: tobias 7 | # Contributor: dibblethewrecker dibblethewrecker.at.jiwe.dot.org 8 | 9 | _pkgname=rxvt-unicode 10 | pkgname=rxvt-unicode-cvs-patched-wideglyphs 11 | pkgver=20170412 12 | pkgrel=6 13 | pkgdesc='Unicode enabled rxvt-clone terminal emulator (urxvt) with fixed font spacing and wide glyphs patch (cvs version)' 14 | arch=('i686' 'x86_64') 15 | url='http://software.schmorp.de/pkg/rxvt-unicode.html' 16 | license=('GPL') 17 | depends=('libxft' 'perl' 'startup-notification' 'rxvt-unicode-terminfo') 18 | makedepends=('cvs') 19 | optdepends=('gtk2-perl: to use the urxvt-tabbed') 20 | provides=(rxvt-unicode) 21 | conflicts=(rxvt-unicode) 22 | source=('urxvt.desktop' 23 | 'urxvtc.desktop' 24 | 'urxvt-tabbed.desktop' 25 | 'font-width-fix.patch' 26 | 'line-spacing-fix.patch' 27 | 'sgr-mouse-mode.patch' 28 | 'add-space-to-extent_test_chars.patch' 29 | 'enable-wide-glyphs.patch') 30 | sha1sums=('b5a4507f85ebb7bac589db2e07d9bc40106720d9' 31 | '62c4ffecfce6967def394dd4d418b68652372ea2' 32 | 'cd204d608d114d39c80331efe0af0231ad6b7e18' 33 | '01ee8f212add79a158dcd4ed78d0ea1324bdc59b' 34 | 'b7fde1c46af45e831828738874f14b092b1e795f' 35 | 'f478acf3662aab3f5b1703a4a29bcfe055dbdd66' 36 | '69b77c0b4b4587117f3a6e240a5bd6389ed40be3' 37 | '5b37be933d9b6cc1f7e3129a69c338d232bf7808') 38 | 39 | prepare() { 40 | cd ${srcdir} 41 | cvs -z3 -d :pserver:anonymous@cvs.schmorp.de/schmorpforge co ${_pkgname} 42 | 43 | cd $_pkgname 44 | patch -p0 -i ../font-width-fix.patch 45 | patch -p0 -i ../line-spacing-fix.patch 46 | patch -p0 -i ../sgr-mouse-mode.patch 47 | patch -p1 -i ../enable-wide-glyphs.patch 48 | } 49 | 50 | build() { 51 | cd ${srcdir}/${_pkgname} 52 | 53 | # do not specify --with-terminfo (FS#46424) 54 | ./configure \ 55 | --prefix=/usr \ 56 | --enable-256-color \ 57 | --enable-combining \ 58 | --enable-fading \ 59 | --enable-font-styles \ 60 | --enable-iso14755 \ 61 | --enable-keepscrolling \ 62 | --enable-lastlog \ 63 | --enable-mousewheel \ 64 | --enable-next-scroll \ 65 | --enable-perl \ 66 | --enable-pointer-blank \ 67 | --enable-rxvt-scroll \ 68 | --enable-selectionscrolling \ 69 | --enable-slipwheeling \ 70 | --enable-smart-resize \ 71 | --enable-startup-notification \ 72 | --enable-transparency \ 73 | --enable-unicode3 \ 74 | --enable-utmp \ 75 | --enable-wide-glyphs \ 76 | --enable-wtmp \ 77 | --enable-xft \ 78 | --enable-xim \ 79 | --enable-xterm-scroll 80 | make 81 | } 82 | 83 | package() { 84 | 85 | # install freedesktop menu 86 | for _f in urxvt urxvtc urxvt-tabbed; do 87 | install -Dm644 $_f.desktop "$pkgdir/usr/share/applications/$_f.desktop" 88 | done 89 | 90 | cd $_pkgname 91 | 92 | # workaround terminfo installation 93 | export TERMINFO="$srcdir/terminfo" 94 | install -d "$TERMINFO" 95 | make DESTDIR="$pkgdir" install 96 | 97 | # install the tabbing wrapper ( requires gtk2-perl! ) 98 | sed -i 's/\"rxvt\"/"urxvt"/' doc/rxvt-tabbed 99 | install -Dm 755 doc/rxvt-tabbed "$pkgdir/usr/bin/urxvt-tabbed" 100 | } 101 | -------------------------------------------------------------------------------- /sgr-mouse-mode.patch: -------------------------------------------------------------------------------- 1 | Source: https://gist.githubusercontent.com/alexoj/df5bae7a4825cb596581/raw/75a1e75c2ae1ec5c0db68a29f8a6821e9e3d87a5/sgr-mouse-mode.patch 2 | Upated to work with CVS (focus reporting) 3 | --- src/command.C 2014-12-13 13:22:09.000000000 +0100 4 | +++ src/command.C 2016-01-13 04:50:39.161862513 +0100 5 | @@ -1280,6 +1280,8 @@ 6 | int x, y; 7 | int code = 32; 8 | 9 | + if (priv_modes & PrivMode_ExtMouseSgr) code = 0; 10 | + 11 | x = Pixel2Col (ev.x) + 1; 12 | y = Pixel2Row (ev.y) + 1; 13 | 14 | @@ -1293,11 +1295,18 @@ 15 | code += 32; 16 | } 17 | 18 | - if (MEvent.button == AnyButton) 19 | + if (!(priv_modes & PrivMode_ExtMouseSgr) && MEvent.button == AnyButton) 20 | button_number = 3; 21 | else 22 | { 23 | - button_number = MEvent.button - Button1; 24 | + if (ev.type == MotionNotify) { 25 | + if (ev.state & Button1Mask) button_number = 0; 26 | + else if (ev.state & Button2Mask) button_number = 1; 27 | + else if (ev.state & Button3Mask) button_number = 2; 28 | + else return; 29 | + } else { 30 | + button_number = ev.button - Button1; 31 | + } 32 | /* add 0x3D for wheel events, like xterm does */ 33 | if (button_number >= 3) 34 | button_number += 64 - 3; 35 | @@ -1347,16 +1356,22 @@ 36 | #endif 37 | 38 | #if ENABLE_FRILLS 39 | + if (priv_modes & PrivMode_ExtMouseSgr) 40 | + tt_printf ("\033[<%d;%d;%d%c", 41 | + code + button_number + key_state, 42 | + x, 43 | + y, 44 | + (ev.type == ButtonRelease ? 'm' : 'M')); 45 | - if (priv_modes & PrivMode_ExtMouseRight) 46 | + else if (priv_modes & PrivMode_ExtMouseRight) 47 | tt_printf ("\033[%d;%d;%dM", 48 | code + button_number + key_state, 49 | x, 50 | y); 51 | else if (priv_modes & PrivMode_ExtModeMouse) 52 | tt_printf ("\033[M%c%lc%lc", 53 | code + button_number + key_state, 54 | wint_t (32 + x), 55 | wint_t (32 + y)); 56 | else 57 | #endif 58 | tt_printf ("\033[M%c%c%c", 59 | @@ -2908,7 +2913,7 @@ 60 | scr_soft_reset (); 61 | 62 | static const int pm_h[] = { 7, 25 }; 63 | - static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1005, 1015, 1049 }; 64 | + static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1002, 1003, 1005, 1006, 1015, 1049 }; 65 | 66 | process_terminal_mode ('h', 0, ecb_array_length (pm_h), pm_h); 67 | process_terminal_mode ('l', 0, ecb_array_length (pm_l), pm_l); 68 | @@ -3713,13 +3718,14 @@ 69 | { 1002, PrivMode_MouseBtnEvent }, 70 | { 1003, PrivMode_MouseAnyEvent }, 71 | #if ENABLE_FRILLS 72 | { 1004, PrivMode_FocusEvent }, 73 | { 1005, PrivMode_ExtModeMouse }, 74 | + { 1006, PrivMode_ExtMouseSgr }, 75 | #endif 76 | { 1010, PrivMode_TtyOutputInh }, // rxvt extension 77 | { 1011, PrivMode_Keypress }, // rxvt extension 78 | #if ENABLE_FRILLS 79 | { 1015, PrivMode_ExtMouseRight }, // urxvt extension of 1005 80 | #endif 81 | // 1035 enable modifiers for alt, numlock NYI 82 | // 1036 send ESC for meta keys NYI 83 | // 1037 send DEL for keypad delete NYI 84 | --- src/rxvt.h 2014-12-17 16:33:08.000000000 +0100 85 | +++ src/rxvt.h 2016-01-13 03:42:31.508911380 +0100 86 | @@ -644,6 +644,7 @@ 87 | #define PrivMode_ExtModeMouse (1UL<<23) // xterm pseudo-utf-8 hack 88 | #define PrivMode_ExtMouseRight (1UL<<24) // xterm pseudo-utf-8, but works in non-utf-8-locales 89 | #define PrivMode_BlinkingCursor (1UL<<25) 90 | #define PrivMode_FocusEvent (1UL<<26) 91 | +#define PrivMode_ExtMouseSgr (1UL<<27) // sgr mouse extension 92 | 93 | #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent) 94 | 95 | -------------------------------------------------------------------------------- /enable-wide-glyphs.patch: -------------------------------------------------------------------------------- 1 | diff --git a/config.h.in b/config.h.in 2 | index 914d6062..2e2e03f3 100644 3 | --- a/config.h.in 4 | +++ b/config.h.in 5 | @@ -18,6 +18,9 @@ 6 | /* Define if you want your background to use the parent window background */ 7 | #undef ENABLE_TRANSPARENCY 8 | 9 | +/* Define if you want to display wide glyphs */ 10 | +#undef ENABLE_WIDE_GLYPHS 11 | + 12 | /* Define if you want european extended codesets */ 13 | #undef ENCODING_EU 14 | 15 | diff --git a/configure b/configure 16 | index 3e3f78bd..b8b1591d 100755 17 | --- a/configure 18 | +++ b/configure 19 | @@ -717,6 +717,7 @@ enable_unicode3 20 | enable_combining 21 | enable_xft 22 | enable_font_styles 23 | +enable_wide_glyphs 24 | enable_pixbuf 25 | enable_startup_notification 26 | enable_transparency 27 | @@ -1390,6 +1391,7 @@ Optional Features: 28 | --enable-combining enable composition of base and combining characters 29 | --enable-xft enable xft support on systems that have it 30 | --enable-font-styles enable bold and italic support 31 | + --enable-wide-glyphs enable displaying of wide glyphs 32 | --enable-pixbuf enable integration with gdk-pixbuf for background images 33 | --enable-startup-notification enable freedesktop startup notification support 34 | --enable-transparency enable transparent backgrounds 35 | @@ -4780,6 +4782,7 @@ if test "${enable_everything+set}" = set; then : 36 | support_8bitctrls=no 37 | support_iso14755=no 38 | support_styles=no 39 | + support_wide_glyphs=no 40 | support_perl=no 41 | codesets= 42 | fi 43 | @@ -4808,6 +4811,7 @@ if test "${enable_everything+set}" = set; then : 44 | #support_8bitctrls=yes 45 | support_iso14755=yes 46 | support_styles=yes 47 | + support_wide_glyphs=yes 48 | support_perl=yes 49 | codesets=all 50 | fi 51 | @@ -4909,6 +4913,14 @@ if test "${enable_font_styles+set}" = set; then : 52 | fi 53 | 54 | 55 | +# Check whether --enable-wide-glyphs was given. 56 | +if test "${enable_wide_glyphs+set}" = set; then : 57 | + enableval=$enable_wide_glyphs; if test x$enableval = xyes -o x$enableval = xno; then 58 | + support_wide_glyphs=$enableval 59 | + fi 60 | +fi 61 | + 62 | + 63 | # Check whether --enable-pixbuf was given. 64 | if test "${enable_pixbuf+set}" = set; then : 65 | enableval=$enable_pixbuf; if test x$enableval = xyes -o x$enableval = xno; then 66 | @@ -7733,6 +7745,11 @@ if test x$support_styles = xyes; then 67 | 68 | $as_echo "#define ENABLE_STYLES 1" >>confdefs.h 69 | 70 | +fi 71 | +if test x$support_wide_glyphs = xyes; then 72 | + 73 | +$as_echo "#define ENABLE_WIDE_GLYPHS 1" >>confdefs.h 74 | + 75 | fi 76 | if test x$support_iso14755 = xyes; then 77 | 78 | diff --git a/configure.ac b/configure.ac 79 | index 0da3b596..52ab8e4c 100644 80 | --- a/configure.ac 81 | +++ b/configure.ac 82 | @@ -132,6 +132,7 @@ AC_ARG_ENABLE(everything, 83 | support_8bitctrls=no 84 | support_iso14755=no 85 | support_styles=no 86 | + support_wide_glyphs=no 87 | support_perl=no 88 | codesets= 89 | fi 90 | @@ -160,6 +161,7 @@ AC_ARG_ENABLE(everything, 91 | #support_8bitctrls=yes 92 | support_iso14755=yes 93 | support_styles=yes 94 | + support_wide_glyphs=yes 95 | support_perl=yes 96 | codesets=all 97 | fi 98 | @@ -225,6 +227,12 @@ AC_ARG_ENABLE(font-styles, 99 | support_styles=$enableval 100 | fi]) 101 | 102 | +AC_ARG_ENABLE(wide-glyphs, 103 | + [ --enable-wide-glyphs enable displaying of wide glyphs], 104 | + [if test x$enableval = xyes -o x$enableval = xno; then 105 | + support_wide_glyphs=$enableval 106 | + fi]) 107 | + 108 | AC_ARG_ENABLE(pixbuf, 109 | [ --enable-pixbuf enable integration with gdk-pixbuf for background images], 110 | [if test x$enableval = xyes -o x$enableval = xno; then 111 | @@ -648,6 +656,9 @@ fi 112 | if test x$support_styles = xyes; then 113 | AC_DEFINE(ENABLE_STYLES, 1, Define if you want bold and italic support) 114 | fi 115 | +if test x$support_wide_glyphs = xyes; then 116 | + AC_DEFINE(ENABLE_WIDE_GLYPHS, 1, Define if you want to display wide glyphs) 117 | +fi 118 | if test x$support_iso14755 = xyes; then 119 | AC_DEFINE(ISO_14755, 1, Define if you want ISO 14755 extended support) 120 | fi 121 | diff --git a/src/command.C b/src/command.C 122 | index 19e4fccf..75853d75 100644 123 | --- a/src/command.C 124 | +++ b/src/command.C 125 | @@ -237,7 +237,9 @@ rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y, int y2) 126 | # endif 127 | scr_overlay_set (11, y + 1, ch, r); 128 | 129 | +#if !ENABLE_WIDE_GLYPHS 130 | if (WCWIDTH (ch) >= 2) 131 | +#endif 132 | scr_overlay_set (12, y + 1, NOCHAR, r); 133 | } 134 | 135 | diff --git a/src/rxvtfont.C b/src/rxvtfont.C 136 | index c56921c8..9d75541a 100644 137 | --- a/src/rxvtfont.C 138 | +++ b/src/rxvtfont.C 139 | @@ -471,6 +471,7 @@ rxvt_font_default::draw (rxvt_drawable &d, int x, int y, 140 | else 141 | switch (t) 142 | { 143 | + case ' ': 144 | case '\t': 145 | case ZERO_WIDTH_CHAR: 146 | case NOCHAR: 147 | @@ -1026,8 +1027,10 @@ rxvt_font_x11::has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &car 148 | 149 | careful = xcs->lbearing < 0 || xcs->rbearing > prop->width * wcw; 150 | 151 | +#if !ENABLE_WIDE_GLYPHS 152 | if (careful && !OVERLAP_OK (w, wcw, prop)) 153 | return false; 154 | +#endif 155 | 156 | return true; 157 | } 158 | @@ -1345,12 +1348,14 @@ rxvt_font_xft::has_char (unicode_t unicode, const rxvt_fontprop *prop, bool &car 159 | 160 | careful = g.x > 0 || w > prop->width * wcw; 161 | 162 | +#if !ENABLE_WIDE_GLYPHS 163 | if (careful && !OVERLAP_OK (w, wcw, prop)) 164 | return false; 165 | 166 | // this weeds out _totally_ broken fonts, or glyphs 167 | if (!OVERLAP_OK (g.xOff, wcw, prop)) 168 | return false; 169 | +#endif 170 | 171 | return true; 172 | } 173 | @@ -1395,6 +1400,10 @@ rxvt_font_xft::draw (rxvt_drawable &d, int x, int y, 174 | 175 | ep->glyph = glyph; 176 | ep->x = x_ + (cwidth - extents.xOff >> 1); 177 | +#if ENABLE_WIDE_GLYPHS 178 | + /* Left-align to bounding box, do not overlap to the left. */ 179 | + max_it(ep->x, x_); 180 | +#endif 181 | ep->y = y_ + ascent; 182 | 183 | if (extents.xOff == 0) 184 | diff --git a/src/screen.C b/src/screen.C 185 | index 115afbf2..61681b84 100644 186 | --- a/src/screen.C 187 | +++ b/src/screen.C 188 | @@ -936,7 +936,61 @@ rxvt_term::scr_add_lines (const wchar_t *str, int len, int minlines) NOTHROW 189 | # endif 190 | #endif 191 | 192 | - rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c)); 193 | + rend_t rend; 194 | +#if ENABLE_WIDE_GLYPHS 195 | + // Re-use previous font for space characters. 196 | + // This allows for better display of wider chars with regard to 197 | + // backtracking (which uses RS_SAME). 198 | + if (c != ' ') 199 | + { 200 | +#endif 201 | + rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c)); 202 | +#if ENABLE_WIDE_GLYPHS 203 | + 204 | + } 205 | + else 206 | + { 207 | + // Code taken from ENABLE_COMBINING - might get refactored. 208 | + line_t *linep; 209 | + text_t *tp; 210 | + rend_t *rp = NULL; 211 | + 212 | + if (screen.cur.col > 0) 213 | + { 214 | + linep = line; 215 | + tp = line->t + screen.cur.col - 1; 216 | + rp = line->r + screen.cur.col - 1; 217 | + } 218 | + else if (screen.cur.row > 0 219 | + && ROW(screen.cur.row - 1).is_longer ()) 220 | + { 221 | + linep = &ROW(screen.cur.row - 1); 222 | + tp = linep->t + ncol - 1; 223 | + rp = linep->r + ncol - 1; 224 | + } 225 | + 226 | + if (rp) 227 | + { 228 | + // XXX: this font does not show up in iso-14755 mode for the space!? 229 | + if (*tp == NOCHAR) 230 | + { 231 | + while (*tp == NOCHAR && tp > linep->t) 232 | + tp--, rp--; 233 | + 234 | + // first try to find a precomposed character 235 | + unicode_t n = rxvt_compose (*tp, c); 236 | + if (n == NOCHAR) 237 | + n = rxvt_composite.compose (*tp, c); 238 | + 239 | + *tp = n; 240 | + *rp = SET_FONT (*rp, FONTSET (*rp)->find_font (*tp)); 241 | + } 242 | + rend = SET_FONT (rstyle, GET_FONT(*rp)); 243 | + } 244 | + else 245 | + rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c)); 246 | + } 247 | +#endif 248 | 249 | // if the character doesn't fit into the remaining columns... 250 | if (ecb_unlikely (screen.cur.col > ncol - width && ncol >= width)) 251 | @@ -2387,7 +2441,12 @@ rxvt_term::scr_refresh () NOTHROW 252 | text--, count++, xpixel -= fwidth; 253 | 254 | // force redraw after "careful" characters to avoid pixel droppings 255 | - for (int i = 0; srp[col + i] & RS_Careful && col + i < ncol - 1; i++) 256 | + for (int i = 0; srp[col + i] & RS_Careful && col + i < ncol - 1 257 | +#if ENABLE_WIDE_GLYPHS 258 | + // But not for spaces. 259 | + && stp[col + i + 1] != ' ' 260 | +#endif 261 | + ; i++) 262 | drp[col + i + 1] = srp[col + i + 1] ^ RS_redraw; 263 | 264 | // force redraw before "careful" characters to avoid pixel droppings 265 | diff --git a/src/xdefaults.C b/src/xdefaults.C 266 | index 9b47bf2c..add21eec 100644 267 | --- a/src/xdefaults.C 268 | +++ b/src/xdefaults.C 269 | @@ -294,6 +294,9 @@ static const char optionsstring[] = "options: " 270 | #if ENABLE_STYLES 271 | "styles," 272 | #endif 273 | +#if ENABLE_WIDE_GLYPHS 274 | + "wide-glyphs," 275 | +#endif 276 | #if ENABLE_COMBINING 277 | "combining," 278 | #endif 279 | diff --git a/wide-glyphs-after.png b/wide-glyphs-after.png 280 | new file mode 100644 281 | index 00000000..5661ea79 282 | Binary files /dev/null and b/wide-glyphs-after.png differ 283 | diff --git a/wide-glyphs-before.png b/wide-glyphs-before.png 284 | new file mode 100644 285 | index 00000000..71ae7d5d 286 | Binary files /dev/null and b/wide-glyphs-before.png differ 287 | --------------------------------------------------------------------------------