1
0
mirror of https://github.com/gryf/gryf-overlay.git synced 2026-03-26 22:53:32 +01:00

Compare commits

...

3 Commits

Author SHA1 Message Date
f5c26bc70b Removed old urxvt ebuild. 2023-10-30 18:40:01 +01:00
54244e93a0 Removed old patches 2023-10-30 18:26:20 +01:00
16767ef3ff Added updated patches for rxvt unicode 2023-10-30 18:24:11 +01:00
13 changed files with 529 additions and 983 deletions

View File

@@ -1,12 +0,0 @@
diff -ur rxvt-unicode-9.22-a/src/rxvtfont.C rxvt-unicode-9.22-b/src/rxvtfont.C
--- rxvt-unicode-9.22-a/src/rxvtfont.C 2021-01-26 13:41:32.889882053 +0100
+++ rxvt-unicode-9.22-b/src/rxvtfont.C 2021-01-26 13:43:25.909883427 +0100
@@ -155,7 +155,7 @@
// these characters are used to guess the font height and width
// pango uses a similar algorithm and doesn't trust the font either.
static uint16_t extent_test_chars[] = {
- '0', '1', '8', 'a', 'd', 'x', 'm', 'y', 'g', 'W', 'X', '\'', '_',
+ ' ', '0', '1', '8', 'a', 'd', 'x', 'm', 'y', 'g', 'W', 'X', '\'', '_',
0x00cd, 0x00d5, 0x0114, 0x0177, 0x0643, // ÍÕĔŷﻙ
0x304c, 0x672c, // が本
};

View File

@@ -1,23 +0,0 @@
diff -ur rxvt-unicode-9.22-orig/src/command.C rxvt-unicode-9.22/src/command.C
--- rxvt-unicode-9.22-orig/src/command.C 2016-01-18 20:35:08.000000000 +0100
+++ rxvt-unicode-9.22/src/command.C 2021-05-17 21:22:29.068263084 +0200
@@ -2722,12 +2722,13 @@
}
break;
- /* kidnapped escape sequence: Should be 8.3.48 */
- case C1_ESA: /* ESC G */
- // used by original rxvt for rob nations own graphics mode
- if (cmd_getc () == 'Q')
- tt_printf ("\033G0\012"); /* query graphics - no graphics */
- break;
+// disabled because embedded newlines can make exploits easier
+// /* kidnapped escape sequence: Should be 8.3.48 */
+// case C1_ESA: /* ESC G */
+// // used by original rxvt for rob nations own graphics mode
+// if (cmd_getc () == 'Q')
+// tt_printf ("\033G0\012"); /* query graphics - no graphics */
+// break;
/* 8.3.63: CHARACTER TABULATION SET */
case C1_HTS: /* ESC H */

View File

@@ -1,271 +0,0 @@
diff -ur rxvt-unicode-9.22-a/config.h.in rxvt-unicode-9.22-b/config.h.in
--- rxvt-unicode-9.22-a/config.h.in 2015-06-17 13:57:42.000000000 +0200
+++ rxvt-unicode-9.22-b/config.h.in 2021-01-26 13:41:32.889882053 +0100
@@ -18,6 +18,9 @@
/* Define if you want your background to use the parent window background */
#undef ENABLE_TRANSPARENCY
+/* Define if you want to display wide glyphs */
+#undef ENABLE_WIDE_GLYPHS
+
/* Define if you want european extended codesets */
#undef ENCODING_EU
diff -ur rxvt-unicode-9.22-a/configure rxvt-unicode-9.22-b/configure
--- rxvt-unicode-9.22-a/configure 2016-01-23 21:08:12.000000000 +0100
+++ rxvt-unicode-9.22-b/configure 2021-01-26 13:41:32.889882053 +0100
@@ -717,6 +717,7 @@
enable_combining
enable_xft
enable_font_styles
+enable_wide_glyphs
enable_pixbuf
enable_startup_notification
enable_transparency
@@ -1390,6 +1391,7 @@
--enable-combining enable composition of base and combining characters
--enable-xft enable xft support on systems that have it
--enable-font-styles enable bold and italic support
+ --enable-wide-glyphs enable displaying of wide glyphs
--enable-pixbuf enable integration with gdk-pixbuf for background images
--enable-startup-notification enable freedesktop startup notification support
--enable-transparency enable transparent backgrounds
@@ -4780,6 +4782,7 @@
support_8bitctrls=no
support_iso14755=no
support_styles=no
+ support_wide_glyphs=no
support_perl=no
codesets=
fi
@@ -4808,6 +4811,7 @@
#support_8bitctrls=yes
support_iso14755=yes
support_styles=yes
+ support_wide_glyphs=yes
support_perl=yes
codesets=all
fi
@@ -4909,6 +4913,14 @@
fi
+# Check whether --enable-wide-glyphs was given.
+if test "${enable_wide_glyphs+set}" = set; then :
+ enableval=$enable_wide_glyphs; if test x$enableval = xyes -o x$enableval = xno; then
+ support_wide_glyphs=$enableval
+ fi
+fi
+
+
# Check whether --enable-pixbuf was given.
if test "${enable_pixbuf+set}" = set; then :
enableval=$enable_pixbuf; if test x$enableval = xyes -o x$enableval = xno; then
@@ -7734,6 +7746,11 @@
$as_echo "#define ENABLE_STYLES 1" >>confdefs.h
fi
+if test x$support_wide_glyphs = xyes; then
+
+$as_echo "#define ENABLE_WIDE_GLYPHS 1" >>confdefs.h
+
+fi
if test x$support_iso14755 = xyes; then
$as_echo "#define ISO_14755 1" >>confdefs.h
diff -ur rxvt-unicode-9.22-a/configure.ac rxvt-unicode-9.22-b/configure.ac
--- rxvt-unicode-9.22-a/configure.ac 2015-06-17 13:57:42.000000000 +0200
+++ rxvt-unicode-9.22-b/configure.ac 2021-01-26 13:41:32.889882053 +0100
@@ -132,6 +132,7 @@
support_8bitctrls=no
support_iso14755=no
support_styles=no
+ support_wide_glyphs=no
support_perl=no
codesets=
fi
@@ -160,6 +161,7 @@
#support_8bitctrls=yes
support_iso14755=yes
support_styles=yes
+ support_wide_glyphs=yes
support_perl=yes
codesets=all
fi
@@ -225,6 +227,12 @@
support_styles=$enableval
fi])
+AC_ARG_ENABLE(wide-glyphs,
+ [ --enable-wide-glyphs enable displaying of wide glyphs],
+ [if test x$enableval = xyes -o x$enableval = xno; then
+ support_wide_glyphs=$enableval
+ fi])
+
AC_ARG_ENABLE(pixbuf,
[ --enable-pixbuf enable integration with gdk-pixbuf for background images],
[if test x$enableval = xyes -o x$enableval = xno; then
@@ -648,6 +656,9 @@
if test x$support_styles = xyes; then
AC_DEFINE(ENABLE_STYLES, 1, Define if you want bold and italic support)
fi
+if test x$support_wide_glyphs = xyes; then
+ AC_DEFINE(ENABLE_WIDE_GLYPHS, 1, Define if you want to display wide glyphs)
+fi
if test x$support_iso14755 = xyes; then
AC_DEFINE(ISO_14755, 1, Define if you want ISO 14755 extended support)
fi
diff -ur rxvt-unicode-9.22-a/src/command.C rxvt-unicode-9.22-b/src/command.C
--- rxvt-unicode-9.22-a/src/command.C 2016-01-18 20:35:08.000000000 +0100
+++ rxvt-unicode-9.22-b/src/command.C 2021-01-26 13:41:32.889882053 +0100
@@ -237,7 +237,9 @@
# endif
scr_overlay_set (11, y + 1, ch, r);
+#if !ENABLE_WIDE_GLYPHS
if (WCWIDTH (ch) >= 2)
+#endif
scr_overlay_set (12, y + 1, NOCHAR, r);
}
diff -ur rxvt-unicode-9.22-a/src/rxvtfont.C rxvt-unicode-9.22-b/src/rxvtfont.C
--- rxvt-unicode-9.22-a/src/rxvtfont.C 2021-01-26 13:39:13.257880354 +0100
+++ rxvt-unicode-9.22-b/src/rxvtfont.C 2021-01-26 13:41:32.889882053 +0100
@@ -471,6 +471,7 @@
else
switch (t)
{
+ case ' ':
case '\t':
case ZERO_WIDTH_CHAR:
case NOCHAR:
@@ -1026,8 +1027,10 @@
careful = xcs->lbearing < 0 || xcs->rbearing > prop->width * wcw;
+#if !ENABLE_WIDE_GLYPHS
if (careful && !OVERLAP_OK (w, wcw, prop))
return false;
+#endif
return true;
}
@@ -1365,12 +1368,14 @@
careful = g.x > 0 || w > prop->width * wcw;
+#if !ENABLE_WIDE_GLYPHS
if (careful && !OVERLAP_OK (w, wcw, prop))
return false;
// this weeds out _totally_ broken fonts, or glyphs
if (!OVERLAP_OK (g.xOff, wcw, prop))
return false;
+#endif
return true;
}
@@ -1415,6 +1420,10 @@
ep->glyph = glyph;
ep->x = x_ + (cwidth - extents.xOff >> 1);
+#if ENABLE_WIDE_GLYPHS
+ /* Left-align to bounding box, do not overlap to the left. */
+ max_it(ep->x, x_);
+#endif
ep->y = y_ + ascent;
if (extents.xOff == 0)
diff -ur rxvt-unicode-9.22-a/src/screen.C rxvt-unicode-9.22-b/src/screen.C
--- rxvt-unicode-9.22-a/src/screen.C 2016-01-18 20:35:08.000000000 +0100
+++ rxvt-unicode-9.22-b/src/screen.C 2021-01-26 13:41:32.889882053 +0100
@@ -936,7 +936,61 @@
# endif
#endif
- rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c));
+ rend_t rend;
+#if ENABLE_WIDE_GLYPHS
+ // Re-use previous font for space characters.
+ // This allows for better display of wider chars with regard to
+ // backtracking (which uses RS_SAME).
+ if (c != ' ')
+ {
+#endif
+ rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c));
+#if ENABLE_WIDE_GLYPHS
+
+ }
+ else
+ {
+ // Code taken from ENABLE_COMBINING - might get refactored.
+ line_t *linep;
+ text_t *tp;
+ rend_t *rp = NULL;
+
+ if (screen.cur.col > 0)
+ {
+ linep = line;
+ tp = line->t + screen.cur.col - 1;
+ rp = line->r + screen.cur.col - 1;
+ }
+ else if (screen.cur.row > 0
+ && ROW(screen.cur.row - 1).is_longer ())
+ {
+ linep = &ROW(screen.cur.row - 1);
+ tp = linep->t + ncol - 1;
+ rp = linep->r + ncol - 1;
+ }
+
+ if (rp)
+ {
+ // XXX: this font does not show up in iso-14755 mode for the space!?
+ if (*tp == NOCHAR)
+ {
+ while (*tp == NOCHAR && tp > linep->t)
+ tp--, rp--;
+
+ // first try to find a precomposed character
+ unicode_t n = rxvt_compose (*tp, c);
+ if (n == NOCHAR)
+ n = rxvt_composite.compose (*tp, c);
+
+ *tp = n;
+ *rp = SET_FONT (*rp, FONTSET (*rp)->find_font (*tp));
+ }
+ rend = SET_FONT (rstyle, GET_FONT(*rp));
+ }
+ else
+ rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c));
+ }
+#endif
// if the character doesn't fit into the remaining columns...
if (ecb_unlikely (screen.cur.col > ncol - width && ncol >= width))
@@ -2387,7 +2441,12 @@
text--, count++, xpixel -= fwidth;
// force redraw after "careful" characters to avoid pixel droppings
- for (int i = 0; srp[col + i] & RS_Careful && col + i < ncol - 1; i++)
+ for (int i = 0; srp[col + i] & RS_Careful && col + i < ncol - 1
+#if ENABLE_WIDE_GLYPHS
+ // But not for spaces.
+ && stp[col + i + 1] != ' '
+#endif
+ ; i++)
drp[col + i + 1] = srp[col + i + 1] ^ RS_redraw;
// force redraw before "careful" characters to avoid pixel droppings
diff -ur rxvt-unicode-9.22-a/src/xdefaults.C rxvt-unicode-9.22-b/src/xdefaults.C
--- rxvt-unicode-9.22-a/src/xdefaults.C 2016-01-23 19:38:47.000000000 +0100
+++ rxvt-unicode-9.22-b/src/xdefaults.C 2021-01-26 13:41:32.889882053 +0100
@@ -305,6 +305,9 @@
#if ENABLE_STYLES
"styles,"
#endif
+#if ENABLE_WIDE_GLYPHS
+ "wide-glyphs,"
+#endif
#if ENABLE_COMBINING
"combining,"
#endif

View File

@@ -1,26 +0,0 @@
diff -ur rxvt-unicode-9.22-a/src/rxvtfont.C rxvt-unicode-9.22-b/src/rxvtfont.C
--- rxvt-unicode-9.22-a/src/rxvtfont.C 2015-09-07 16:49:33.000000000 +0200
+++ rxvt-unicode-9.22-b/src/rxvtfont.C 2021-01-26 13:38:12.669879617 +0100
@@ -1267,12 +1267,21 @@
XGlyphInfo g;
XftTextExtents16 (disp, f, &ch, 1, &g);
+/*
+ * bukind: don't use g.width as a width of a character!
+ * instead use g.xOff, see e.g.: http://keithp.com/~keithp/render/Xft.tutorial
+
g.width -= g.x;
int wcw = WCWIDTH (ch);
if (wcw > 0) g.width = (g.width + wcw - 1) / wcw;
if (width < g.width ) width = g.width;
+ */
+ int wcw = WCWIDTH (ch);
+ if (wcw > 1) g.xOff = g.xOff / wcw;
+ if (width < g.xOff) width = g.xOff;
+
if (height < g.height ) height = g.height;
if (glheight < g.height - g.y) glheight = g.height - g.y;
}
Only in rxvt-unicode-9.22-b/src: rxvtfont.C.orig

View File

@@ -1,26 +0,0 @@
diff -ur rxvt-unicode-9.22-a/src/rxvtfont.C rxvt-unicode-9.22-b/src/rxvtfont.C
--- rxvt-unicode-9.22-a/src/rxvtfont.C 2021-01-26 13:38:12.669879617 +0100
+++ rxvt-unicode-9.22-b/src/rxvtfont.C 2021-01-26 13:39:13.257880354 +0100
@@ -1239,11 +1239,22 @@
FT_Face face = XftLockFace (f);
+/*
+ * use ascent, descent and height from XftFont *f instead of FT_Face face.
+ * this somehow reproduces the behaviour of the line height as seen on xterm.
+
ascent = (face->size->metrics.ascender + 63) >> 6;
descent = (-face->size->metrics.descender + 63) >> 6;
height = max (ascent + descent, (face->size->metrics.height + 63) >> 6);
width = 0;
+ */
+
+ ascent = f->ascent;
+ descent = f->descent;
+ height = max (ascent + descent, f->height);
+ width = 0;
+
bool scalable = face->face_flags & FT_FACE_FLAG_SCALABLE;
XftUnlockFace (f);

View File

@@ -1,165 +0,0 @@
diff --git a/config.h.in b/config.h.in
index 914d606..b869bfb 100644
--- a/config.h.in
+++ b/config.h.in
@@ -9,6 +9,9 @@
/* Define if you want handling for rarely used but handy features */
#undef ENABLE_FRILLS
+/* Define if you want support for SGR mouse mode 1006 */
+#undef ENABLE_SGRMOUSE
+
/* Define if you can embed a perl interpreter */
#undef ENABLE_PERL
diff --git a/configure.ac b/configure.ac
index 0da3b59..c8b9c80 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,6 +76,7 @@ AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(socket, socket)
support_frills=yes
+support_sgrmouse=yes
support_inheritpixmap=yes
support_fading=yes
support_keepscrolling=yes
@@ -109,6 +110,7 @@ AC_ARG_ENABLE(everything,
[
if test x$enableval = xno; then
support_frills=no
+ support_sgrmouse=no
support_inheritpixmap=no
support_fading=no
support_keepscrolling=no
@@ -137,6 +139,7 @@ AC_ARG_ENABLE(everything,
fi
if test x$enableval = xyes; then
support_frills=yes
+ support_sgrmouse=yes
support_inheritpixmap=yes
support_fading=yes
support_keepscrolling=yes
@@ -359,6 +362,12 @@ AC_ARG_ENABLE(frills,
support_frills=$enableval
fi])
+AC_ARG_ENABLE(sgrmouse,
+ [ --enable-sgrmouse enable support for SGR mouse mode 1006],
+ [if test x$enableval = xyes -o x$enableval = xno; then
+ support_sgrmouse=$enableval
+ fi])
+
AC_ARG_ENABLE(keepscrolling,
[ --enable-keepscrolling enable continual scrolling on scrollbar arrow press],
[if test x$enableval = xyes -o x$enableval = xno; then
@@ -666,6 +675,9 @@ fi
if test x$support_frills = xyes; then
AC_DEFINE(ENABLE_FRILLS, 1, Define if you want handling for rarely used but handy features)
fi
+if test x$support_sgrmouse = xyes; then
+ AC_DEFINE(ENABLE_SGRMOUSE, 1, Define if you want support for SGR mouse mode 1006)
+fi
if test x$support_mousewheel = xyes; then
AC_DEFINE(MOUSE_WHEEL, 1, Define to use wheel events (button4 and button5) to scroll)
fi
diff --git a/src/command.C b/src/command.C
index 7b79f51..a62ef87 100644
--- a/src/command.C
+++ b/src/command.C
@@ -1282,6 +1282,13 @@ rxvt_term::mouse_report (XButtonEvent &ev)
int button_number, key_state = 0;
int x, y;
int code = 32;
+ bool mode_sgr = false;
+
+#if ENABLE_SGRMOUSE
+ if (priv_modes & PrivMode_ExtMouseSgr) mode_sgr = true;
+#endif
+
+ if (mode_sgr) code = 0;
x = Pixel2Col (ev.x) + 1;
y = Pixel2Row (ev.y) + 1;
@@ -1296,11 +1303,18 @@ rxvt_term::mouse_report (XButtonEvent &ev)
code += 32;
}
- if (MEvent.button == AnyButton)
+ if (!(mode_sgr) && MEvent.button == AnyButton)
button_number = 3;
else
{
- button_number = MEvent.button - Button1;
+ if (ev.type == MotionNotify) {
+ if (ev.state & Button1Mask) button_number = 0;
+ else if (ev.state & Button2Mask) button_number = 1;
+ else if (ev.state & Button3Mask) button_number = 2;
+ else return;
+ } else {
+ button_number = ev.button - Button1;
+ }
/* add 0x3D for wheel events, like xterm does */
if (button_number >= 3)
button_number += 64 - 3;
@@ -1361,6 +1375,15 @@ rxvt_term::mouse_report (XButtonEvent &ev)
wint_t (32 + x),
wint_t (32 + y));
else
+#endif
+#if ENABLE_SGRMOUSE
+ if (mode_sgr)
+ tt_printf ("\033[<%d;%d;%d%c",
+ code + button_number + key_state,
+ x,
+ y,
+ (ev.type == ButtonRelease ? 'm' : 'M'));
+ else
#endif
tt_printf ("\033[M%c%c%c",
code + button_number + key_state,
@@ -2904,7 +2927,7 @@ rxvt_term::process_csi_seq ()
scr_soft_reset ();
static const int pm_h[] = { 7, 25 };
- static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1005, 1015, 1049 };
+ static const int pm_l[] = { 1, 3, 4, 5, 6, 9, 66, 1000, 1001, 1002, 1003, 1005, 1006, 1015, 1049 };
process_terminal_mode ('h', 0, ecb_array_length (pm_h), pm_h);
process_terminal_mode ('l', 0, ecb_array_length (pm_l), pm_l);
@@ -3710,6 +3733,9 @@ rxvt_term::process_terminal_mode (int mode, int priv ecb_unused, unsigned int na
{ 1003, PrivMode_MouseAnyEvent },
#if ENABLE_FRILLS
{ 1005, PrivMode_ExtModeMouse },
+#endif
+#if ENABLE_SGRMOUSE
+ { 1006, PrivMode_ExtMouseSgr },
#endif
{ 1010, PrivMode_TtyOutputInh }, // rxvt extension
{ 1011, PrivMode_Keypress }, // rxvt extension
diff --git a/src/rxvt.h b/src/rxvt.h
index 5c7cf66..2ffd3fb 100644
--- a/src/rxvt.h
+++ b/src/rxvt.h
@@ -645,6 +645,7 @@ enum {
#define PrivMode_ExtModeMouse (1UL<<23) // xterm pseudo-utf-8 hack
#define PrivMode_ExtMouseRight (1UL<<24) // xterm pseudo-utf-8, but works in non-utf-8-locales
#define PrivMode_BlinkingCursor (1UL<<25)
+#define PrivMode_ExtMouseSgr (1UL<<27) // sgr mouse extension
#define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11|PrivMode_MouseBtnEvent|PrivMode_MouseAnyEvent)
diff --git a/src/xdefaults.C b/src/xdefaults.C
index 894aa8d..e5952b7 100644
--- a/src/xdefaults.C
+++ b/src/xdefaults.C
@@ -359,6 +359,9 @@ static const char optionsstring[] = "options: "
#if defined(ENABLE_FRILLS)
"frills,"
#endif
+#if defined(ENABLE_SGRMOUSE)
+ "sgrmouse,"
+#endif
#if defined(SELECTION_SCROLLING)
"selectionscrolling,"
#endif

View File

@@ -1,271 +0,0 @@
diff -ur rxvt-unicode-9.30/config.h.in rxvt-unicode-9.30-wide-glyphs/config.h.in
--- rxvt-unicode-9.30/config.h.in 2021-07-23 22:57:20.000000000 +0200
+++ rxvt-unicode-9.30-wide-glyphs/config.h.in 2022-01-16 16:10:47.000676909 +0100
@@ -18,6 +18,9 @@
/* Define if you want your background to use the parent window background */
#undef ENABLE_TRANSPARENCY
+/* Define if you want to display wide glyphs */
+#undef ENABLE_WIDE_GLYPHS
+
/* Define if you want european extended codesets */
#undef ENCODING_EU
diff -ur rxvt-unicode-9.30/configure rxvt-unicode-9.30-wide-glyphs/configure
--- rxvt-unicode-9.30/configure 2021-11-27 21:07:00.000000000 +0100
+++ rxvt-unicode-9.30-wide-glyphs/configure 2022-01-16 16:14:15.100672381 +0100
@@ -744,6 +744,7 @@
enable_fading
enable_rxvt_scroll
enable_next_scroll
+enable_wide_glyphs
enable_xterm_scroll
enable_perl
with_codesets
@@ -1412,6 +1413,7 @@
--enable-combining enable composition of base and combining characters
--enable-xft enable xft support on systems that have it
--enable-font-styles enable bold and italic support
+ --enable-wide-glyphs enable displaying of wide glyphs
--enable-pixbuf enable integration with gdk-pixbuf for background images
--enable-startup-notification enable freedesktop startup notification support
--enable-transparency enable transparent backgrounds
@@ -5023,6 +5025,7 @@
support_8bitctrls=no
support_iso14755=no
support_styles=no
+ support_wide_glyphs=no
support_perl=no
codesets=
fi
@@ -5048,6 +5051,7 @@
#support_8bitctrls=yes
support_iso14755=yes
support_styles=yes
+ support_wide_glyphs=yes
support_perl=yes
codesets=all
fi
@@ -5165,6 +5169,14 @@
fi
+# Check whether --enable-wide-glyphs was given.
+if test "${enable_wide_glyphs+set}" = set; then :
+ enableval=$enable_wide_glyphs; if test x$enableval = xyes -o x$enableval = xno; then
+ support_wide_glyphs=$enableval
+ fi
+fi
+
+
# Check whether --enable-pixbuf was given.
if test ${enable_pixbuf+y}
then :
@@ -7675,6 +7687,11 @@
printf "%s\n" "#define ISO_14755 1" >>confdefs.h
fi
+if test x$support_wide_glyphs = xyes; then
+
+printf "%s\n" "#define ENABLE_WIDE_GLYPHS 1" >>confdefs.h
+
+fi
if test x$support_8bitctrls = xyes; then
printf "%s\n" "#define EIGHT_BIT_CONTROLS 1" >>confdefs.h
diff -ur rxvt-unicode-9.30/configure.ac rxvt-unicode-9.30-wide-glyphs/configure.ac
--- rxvt-unicode-9.30/configure.ac 2021-11-27 21:07:00.000000000 +0100
+++ rxvt-unicode-9.30-wide-glyphs/configure.ac 2022-01-16 16:15:41.224670506 +0100
@@ -123,6 +123,7 @@
support_8bitctrls=no
support_iso14755=no
support_styles=no
+ support_wide_glyphs=no
support_perl=no
codesets=
fi
@@ -148,6 +149,7 @@
#support_8bitctrls=yes
support_iso14755=yes
support_styles=yes
+ support_wide_glyphs=yes
support_perl=yes
codesets=all
fi
@@ -221,6 +223,12 @@
support_styles=$enableval
fi])
+AC_ARG_ENABLE(wide-glyphs,
+ [ --enable-wide-glyphs enable displaying of wide glyphs],
+ [if test x$enableval = xyes -o x$enableval = xno; then
+ support_wide_glyphs=$enableval
+ fi])
+
AC_ARG_ENABLE(pixbuf,
[ --enable-pixbuf enable integration with gdk-pixbuf for background images],
[if test x$enableval = xyes -o x$enableval = xno; then
@@ -643,6 +651,9 @@
if test x$support_styles = xyes; then
AC_DEFINE(ENABLE_STYLES, 1, Define if you want bold and italic support)
fi
+if test x$support_wide_glyphs = xyes; then
+ AC_DEFINE(ENABLE_WIDE_GLYPHS, 1, Define if you want to display wide glyphs)
+fi
if test x$support_iso14755 = xyes; then
AC_DEFINE(ISO_14755, 1, Define if you want ISO 14755 extended support)
fi
diff -ur rxvt-unicode-9.30/src/command.C rxvt-unicode-9.30-wide-glyphs/src/command.C
--- rxvt-unicode-9.30/src/command.C 2021-11-22 00:34:29.000000000 +0100
+++ rxvt-unicode-9.30-wide-glyphs/src/command.C 2022-01-16 16:16:34.580669345 +0100
@@ -237,7 +237,9 @@
# endif
scr_overlay_set (11, y + 1, ch, r);
+#if !ENABLE_WIDE_GLYPHS
if (WCWIDTH (ch) >= 2)
+#endif
scr_overlay_set (12, y + 1, NOCHAR, r);
}
diff -ur rxvt-unicode-9.30/src/rxvtfont.C rxvt-unicode-9.30-wide-glyphs/src/rxvtfont.C
--- rxvt-unicode-9.30/src/rxvtfont.C 2021-11-21 20:33:25.000000000 +0100
+++ rxvt-unicode-9.30-wide-glyphs/src/rxvtfont.C 2022-01-16 16:27:54.948654540 +0100
@@ -471,6 +471,7 @@
else
switch (t)
{
+ case ' ':
case '\t':
case ZERO_WIDTH_CHAR:
case NOCHAR:
@@ -1038,8 +1039,10 @@
careful = xcs->lbearing < 0 || xcs->rbearing > prop->width * wcw;
+#if !ENABLE_WIDE_GLYPHS
if (careful && !OVERLAP_OK (w, wcw, prop))
return false;
+#endif
return true;
}
@@ -1410,12 +1413,14 @@
careful = g.x > 0 || w > cwidth;
+#if !ENABLE_WIDE_GLYPHS
if (careful && !OVERLAP_OK (w, wcw, prop))
return false;
// this weeds out _totally_ broken fonts, or glyphs
if (!OVERLAP_OK (g.xOff, wcw, prop))
return false;
+#endif
return true;
}
@@ -1502,6 +1507,11 @@
// in which case we use the average between the two.
ep->x += xOff ? cwidth - xOff >> 1 : 0;
+#if ENABLE_WIDE_GLYPHS
+ /* Left-align to bounding box, do not overlap to the left. */
+ max_it(ep->x, x_);
+#endif
+
// xft/freetype represent combining characters as characters with zero
// width rendered over the previous character with some fonts, while
// in other fonts, they are considered normal characters, while yet
diff -ur rxvt-unicode-9.30/src/screen.C rxvt-unicode-9.30-wide-glyphs/src/screen.C
--- rxvt-unicode-9.30/src/screen.C 2021-07-03 05:55:47.000000000 +0200
+++ rxvt-unicode-9.30-wide-glyphs/src/screen.C 2022-01-16 16:31:19.644650086 +0100
@@ -936,7 +936,60 @@
# endif
#endif
- rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c));
+ rend_t rend;
+#if ENABLE_WIDE_GLYPHS
+ // Re-use previous font for space characters.
+ // This allows for better display of wider chars with regard to
+ // backtracking (which uses RS_SAME).
+ if (c != ' ')
+ {
+#endif
+ rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c));
+#if ENABLE_WIDE_GLYPHS
+ }
+ else
+ {
+ // Code taken from ENABLE_COMBINING - might get refactored.
+ line_t *linep;
+ text_t *tp;
+ rend_t *rp = NULL;
+
+ if (screen.cur.col > 0)
+ {
+ linep = line;
+ tp = line->t + screen.cur.col - 1;
+ rp = line->r + screen.cur.col - 1;
+ }
+ else if (screen.cur.row > 0
+ && ROW(screen.cur.row - 1).is_longer ())
+ {
+ linep = &ROW(screen.cur.row - 1);
+ tp = linep->t + ncol - 1;
+ rp = linep->r + ncol - 1;
+ }
+
+ if (rp)
+ {
+ // XXX: this font does not show up in iso-14755 mode for the space!?
+ if (*tp == NOCHAR)
+ {
+ while (*tp == NOCHAR && tp > linep->t)
+ tp--, rp--;
+
+ // first try to find a precomposed character
+ unicode_t n = rxvt_compose (*tp, c);
+ if (n == NOCHAR)
+ n = rxvt_composite.compose (*tp, c);
+
+ *tp = n;
+ *rp = SET_FONT (*rp, FONTSET (*rp)->find_font (*tp));
+ }
+ rend = SET_FONT (rstyle, GET_FONT(*rp));
+ }
+ else
+ rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c));
+ }
+#endif
// if the character doesn't fit into the remaining columns...
if (ecb_unlikely (screen.cur.col > ncol - width && ncol >= width))
@@ -2395,7 +2448,12 @@
text--, count++, xpixel -= fwidth;
// force redraw after "careful" characters to avoid pixel droppings
- for (int i = 0; srp[col + i] & RS_Careful && col + i < ncol - 1; i++)
+ for (int i = 0; srp[col + i] & RS_Careful && col + i < ncol - 1
+#if ENABLE_WIDE_GLYPHS
+ // But not for spaces.
+ && stp[col + i + 1] != ' '
+#endif
+ ; i++)
drp[col + i + 1] = srp[col + i + 1] ^ RS_redraw;
// force redraw before "careful" characters to avoid pixel droppings
diff -ur rxvt-unicode-9.30/src/xdefaults.C rxvt-unicode-9.30-wide-glyphs/src/xdefaults.C
--- rxvt-unicode-9.30/src/xdefaults.C 2021-07-03 18:36:13.000000000 +0200
+++ rxvt-unicode-9.30-wide-glyphs/src/xdefaults.C 2022-01-16 16:31:59.204649225 +0100
@@ -298,6 +298,9 @@
#if ENABLE_STYLES
"styles,"
#endif
+#if ENABLE_WIDE_GLYPHS
+ "wide-glyphs,"
+#endif
#if ENABLE_COMBINING
"combining,"
#endif

View File

@@ -0,0 +1,153 @@
diff --git a/config.h.in b/config.h.in
index b9c7e0c..ead1f1f 100644
--- a/config.h.in
+++ b/config.h.in
@@ -24,6 +24,9 @@
/* Define if you want your background to use the parent window background */
#undef ENABLE_TRANSPARENCY
+/* Define if you want add space when testing character width */
+#undef ENABLE_USE_SPACE
+
/* Define if you want to display wide glyphs */
#undef ENABLE_WIDE_GLYPHS
diff --git a/configure b/configure
index 6b50a6b..a89170f 100755
--- a/configure
+++ b/configure
@@ -741,6 +741,7 @@ enable_font_styles
enable_wide_glyphs
enable_font_width
enable_line_spacing
+enable_use_space
enable_pixbuf
enable_startup_notification
enable_transparency
@@ -1418,6 +1419,7 @@ Optional Features:
--enable-wide-glyphs enable displaying of wide glyphs
--enable-font-width enable proper way to calculate character width
--enable-line-spacing enable line spacing fix
+ --enable-use-space enable add space to extent test characters
--enable-pixbuf enable integration with gdk-pixbuf for background images
--enable-startup-notification enable freedesktop startup notification support
--enable-transparency enable transparent backgrounds
@@ -5001,6 +5003,7 @@ support_iso14755=yes
support_styles=yes
support_font_width=no
support_line_spacing=no
+support_use_space=no
support_perl=yes
codesets=all
@@ -5034,6 +5037,7 @@ then :
support_wide_glyphs=no
support_font_width=no
support_line_spacing=no
+ support_use_space=no
support_perl=no
codesets=
fi
@@ -5062,6 +5066,7 @@ then :
support_wide_glyphs=yes
support_font_width=yes
support_line_spacing=yes
+ support_use_space=yes
support_perl=yes
codesets=all
fi
@@ -5205,6 +5210,15 @@ then :
fi
+# Check whether --enable-use-space was given.
+if test ${enable_use_space+y}
+then :
+ enableval=$enable_use_space; if test x$enableval = xyes -o x$enableval = xno; then
+ support_use_space=$enableval
+ fi
+fi
+
+
# Check whether --enable-pixbuf was given.
if test ${enable_pixbuf+y}
then :
@@ -7719,6 +7733,11 @@ if test x$support_line_spacing = xyes; then
printf "%s\n" "#define ENABLE_LINE_SPACING 1" >>confdefs.h
+fi
+if test x$support_use_space = xyes; then
+
+printf "%s\n" "#define ENABLE_USE_SPACE 1" >>confdefs.h
+
fi
if test x$support_iso14755 = xyes; then
diff --git a/configure.ac b/configure.ac
index 1cffda6..f623818 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,6 +92,7 @@ support_iso14755=yes
support_styles=yes
support_font_width=no
support_line_spacing=no
+support_use_space=no
support_perl=yes
codesets=all
@@ -128,6 +129,7 @@ AC_ARG_ENABLE(everything,
support_wide_glyphs=no
support_font_width=no
support_line_spacing=no
+ support_use_space=no
support_perl=no
codesets=
fi
@@ -156,6 +158,7 @@ AC_ARG_ENABLE(everything,
support_wide_glyphs=yes
support_font_width=yes
support_line_spacing=yes
+ support_use_space=yes
support_perl=yes
codesets=all
fi
@@ -247,6 +250,12 @@ AC_ARG_ENABLE(line-spacing,
support_line_spacing=$enableval
fi])
+AC_ARG_ENABLE(use-space,
+ [ --enable-use-space enable add space to extent test characters],
+ [if test x$enableval = xyes -o x$enableval = xno; then
+ support_use_space=$enableval
+ fi])
+
AC_ARG_ENABLE(pixbuf,
[ --enable-pixbuf enable integration with gdk-pixbuf for background images],
[if test x$enableval = xyes -o x$enableval = xno; then
@@ -678,6 +687,9 @@ fi
if test x$support_line_spacing = xyes; then
AC_DEFINE(ENABLE_LINE_SPACING, 1, Define if you want line spacing fix)
fi
+if test x$support_use_space = xyes; then
+ AC_DEFINE(ENABLE_USE_SPACE, 1, Define if you want add space when testing character width)
+fi
if test x$support_iso14755 = xyes; then
AC_DEFINE(ISO_14755, 1, Define if you want ISO 14755 extended support)
fi
diff --git a/src/rxvtfont.C b/src/rxvtfont.C
index 9420a22..27b0958 100644
--- a/src/rxvtfont.C
+++ b/src/rxvtfont.C
@@ -155,7 +155,11 @@ static const struct rxvt_fallback_font {
// these characters are used to guess the font height and width
// pango uses a similar algorithm and doesn't trust the font either.
static uint16_t extent_test_chars[] = {
+#ifdef ENABLE_USE_SPACE
+ ' ', '0', '1', '8', 'a', 'd', 'x', 'm', 'y', 'g', 'W', 'X', '\'', '_',
+#else
'0', '1', '8', 'a', 'd', 'x', 'm', 'y', 'g', 'W', 'X', '\'', '_',
+#endif
0x00cd, 0x00d5, 0x0114, 0x0177, 0x0643, // ÍÕĔŷﻙ
0x304c, 0x672c, // が本
};

View File

@@ -1,6 +1,5 @@
diff -ur rxvt-unicode-9.26/config.h.in rxvt-unicode-9.26_wide/config.h.in
--- rxvt-unicode-9.26/config.h.in 2020-01-22 14:41:54.000000000 +0100
+++ rxvt-unicode-9.26_wide/config.h.in 2021-07-13 19:50:20.006549931 +0200
--- a/config.h.in
+++ b/config.h.in
@@ -18,6 +18,9 @@
/* Define if you want your background to use the parent window background */
#undef ENABLE_TRANSPARENCY
@@ -11,10 +10,9 @@ diff -ur rxvt-unicode-9.26/config.h.in rxvt-unicode-9.26_wide/config.h.in
/* Define if you want european extended codesets */
#undef ENCODING_EU
diff -ur rxvt-unicode-9.26/configure rxvt-unicode-9.26_wide/configure
--- rxvt-unicode-9.26/configure 2021-05-14 15:50:48.000000000 +0200
+++ rxvt-unicode-9.26_wide/configure 2021-07-13 20:12:01.802581704 +0200
@@ -744,6 +744,7 @@
--- a/configure
+++ b/configure
@@ -739,6 +739,7 @@
enable_combining
enable_xft
enable_font_styles
@@ -22,7 +20,7 @@ diff -ur rxvt-unicode-9.26/configure rxvt-unicode-9.26_wide/configure
enable_pixbuf
enable_startup_notification
enable_transparency
@@ -1425,6 +1426,7 @@
@@ -1414,6 +1415,7 @@
--enable-combining enable composition of base and combining characters
--enable-xft enable xft support on systems that have it
--enable-font-styles enable bold and italic support
@@ -30,7 +28,7 @@ diff -ur rxvt-unicode-9.26/configure rxvt-unicode-9.26_wide/configure
--enable-pixbuf enable integration with gdk-pixbuf for background images
--enable-startup-notification enable freedesktop startup notification support
--enable-transparency enable transparent backgrounds
@@ -5182,6 +5184,7 @@
@@ -5025,6 +5027,7 @@
support_8bitctrls=no
support_iso14755=no
support_styles=no
@@ -38,7 +36,7 @@ diff -ur rxvt-unicode-9.26/configure rxvt-unicode-9.26_wide/configure
support_perl=no
codesets=
fi
@@ -5210,6 +5213,7 @@
@@ -5050,6 +5053,7 @@
#support_8bitctrls=yes
support_iso14755=yes
support_styles=yes
@@ -46,7 +44,7 @@ diff -ur rxvt-unicode-9.26/configure rxvt-unicode-9.26_wide/configure
support_perl=yes
codesets=all
fi
@@ -5319,6 +5323,14 @@
@@ -5182,6 +5186,14 @@
fi
@@ -61,8 +59,8 @@ diff -ur rxvt-unicode-9.26/configure rxvt-unicode-9.26_wide/configure
# Check whether --enable-pixbuf was given.
if test ${enable_pixbuf+y}
then :
@@ -8542,6 +8554,11 @@
printf "%s\n" "#define ISO_14755 1" >>confdefs.h
@@ -7727,6 +7739,11 @@
printf "%s\n" "#define MOUSE_SLIP_WHEELING 1" >>confdefs.h
fi
+if test x$support_wide_glyphs = xyes; then
@@ -70,13 +68,12 @@ diff -ur rxvt-unicode-9.26/configure rxvt-unicode-9.26_wide/configure
+printf "%s\n" "#define ENABLE_WIDE_GLYPHS 1" >>confdefs.h
+
+fi
if test x$support_8bitctrls = xyes; then
printf "%s\n" "#define EIGHT_BIT_CONTROLS 1" >>confdefs.h
diff -ur rxvt-unicode-9.26/configure.ac rxvt-unicode-9.26_wide/configure.ac
--- rxvt-unicode-9.26/configure.ac 2021-05-13 21:40:55.000000000 +0200
+++ rxvt-unicode-9.26_wide/configure.ac 2021-07-13 19:55:10.702557026 +0200
@@ -134,6 +134,7 @@
scrolltypes=plain
--- a/configure.ac
+++ b/configure.ac
@@ -123,6 +123,7 @@
support_8bitctrls=no
support_iso14755=no
support_styles=no
@@ -84,7 +81,7 @@ diff -ur rxvt-unicode-9.26/configure.ac rxvt-unicode-9.26_wide/configure.ac
support_perl=no
codesets=
fi
@@ -162,6 +163,7 @@
@@ -148,6 +149,7 @@
#support_8bitctrls=yes
support_iso14755=yes
support_styles=yes
@@ -92,7 +89,7 @@ diff -ur rxvt-unicode-9.26/configure.ac rxvt-unicode-9.26_wide/configure.ac
support_perl=yes
codesets=all
fi
@@ -227,6 +229,12 @@
@@ -231,6 +233,12 @@
support_styles=$enableval
fi])
@@ -105,7 +102,7 @@ diff -ur rxvt-unicode-9.26/configure.ac rxvt-unicode-9.26_wide/configure.ac
AC_ARG_ENABLE(pixbuf,
[ --enable-pixbuf enable integration with gdk-pixbuf for background images],
[if test x$enableval = xyes -o x$enableval = xno; then
@@ -650,6 +658,9 @@
@@ -653,6 +661,9 @@
if test x$support_styles = xyes; then
AC_DEFINE(ENABLE_STYLES, 1, Define if you want bold and italic support)
fi
@@ -115,9 +112,8 @@ diff -ur rxvt-unicode-9.26/configure.ac rxvt-unicode-9.26_wide/configure.ac
if test x$support_iso14755 = xyes; then
AC_DEFINE(ISO_14755, 1, Define if you want ISO 14755 extended support)
fi
diff -ur rxvt-unicode-9.26/src/command.C rxvt-unicode-9.26_wide/src/command.C
--- rxvt-unicode-9.26/src/command.C 2021-05-13 21:40:55.000000000 +0200
+++ rxvt-unicode-9.26_wide/src/command.C 2021-07-13 19:55:52.990558058 +0200
--- a/src/command.C
+++ b/src/command.C
@@ -237,7 +237,9 @@
# endif
scr_overlay_set (11, y + 1, ch, r);
@@ -128,9 +124,8 @@ diff -ur rxvt-unicode-9.26/src/command.C rxvt-unicode-9.26_wide/src/command.C
scr_overlay_set (12, y + 1, NOCHAR, r);
}
diff -ur rxvt-unicode-9.26/src/rxvtfont.C rxvt-unicode-9.26_wide/src/rxvtfont.C
--- rxvt-unicode-9.26/src/rxvtfont.C 2020-01-20 10:19:11.000000000 +0100
+++ rxvt-unicode-9.26_wide/src/rxvtfont.C 2021-07-13 19:58:46.890562302 +0200
--- a/src/rxvtfont.C
+++ b/src/rxvtfont.C
@@ -471,6 +471,7 @@
else
switch (t)
@@ -139,7 +134,7 @@ diff -ur rxvt-unicode-9.26/src/rxvtfont.C rxvt-unicode-9.26_wide/src/rxvtfont.C
case '\t':
case ZERO_WIDTH_CHAR:
case NOCHAR:
@@ -1026,8 +1027,10 @@
@@ -1038,8 +1039,10 @@
careful = xcs->lbearing < 0 || xcs->rbearing > prop->width * wcw;
@@ -150,9 +145,9 @@ diff -ur rxvt-unicode-9.26/src/rxvtfont.C rxvt-unicode-9.26_wide/src/rxvtfont.C
return true;
}
@@ -1345,12 +1348,14 @@
@@ -1410,12 +1413,14 @@
careful = g.x > 0 || w > prop->width * wcw;
careful = g.x > 0 || w > cwidth;
+#if !ENABLE_WIDE_GLYPHS
if (careful && !OVERLAP_OK (w, wcw, prop))
@@ -165,21 +160,20 @@ diff -ur rxvt-unicode-9.26/src/rxvtfont.C rxvt-unicode-9.26_wide/src/rxvtfont.C
return true;
}
@@ -1395,6 +1400,10 @@
@@ -1496,6 +1501,10 @@
ep->glyph = glyph;
ep->x = x_ + (cwidth - extents.xOff >> 1);
ep->x = x_;
+#if ENABLE_WIDE_GLYPHS
+ /* Left-align to bounding box, do not overlap to the left. */
+ max_it(ep->x, x_);
+#endif
ep->y = y_ + ascent;
if (extents.xOff == 0)
diff -ur rxvt-unicode-9.26/src/screen.C rxvt-unicode-9.26_wide/src/screen.C
--- rxvt-unicode-9.26/src/screen.C 2021-05-13 21:40:55.000000000 +0200
+++ rxvt-unicode-9.26_wide/src/screen.C 2021-07-13 20:01:29.694566276 +0200
@@ -936,7 +936,61 @@
// the xft font cell might differ from the terminal font cell,
--- a/src/screen.C
+++ b/src/screen.C
@@ -976,7 +976,61 @@
# endif
#endif
@@ -242,7 +236,7 @@ diff -ur rxvt-unicode-9.26/src/screen.C rxvt-unicode-9.26_wide/src/screen.C
// if the character doesn't fit into the remaining columns...
if (ecb_unlikely (screen.cur.col > ncol - width && ncol >= width))
@@ -2395,7 +2449,12 @@
@@ -2435,7 +2489,12 @@
text--, count++, xpixel -= fwidth;
// force redraw after "careful" characters to avoid pixel droppings
@@ -256,10 +250,9 @@ diff -ur rxvt-unicode-9.26/src/screen.C rxvt-unicode-9.26_wide/src/screen.C
drp[col + i + 1] = srp[col + i + 1] ^ RS_redraw;
// force redraw before "careful" characters to avoid pixel droppings
diff -ur rxvt-unicode-9.26/src/xdefaults.C rxvt-unicode-9.26_wide/src/xdefaults.C
--- rxvt-unicode-9.26/src/xdefaults.C 2019-09-17 22:38:30.000000000 +0200
+++ rxvt-unicode-9.26_wide/src/xdefaults.C 2021-07-13 20:02:34.230567851 +0200
@@ -294,6 +294,9 @@
--- a/src/xdefaults.C
+++ b/src/xdefaults.C
@@ -299,6 +299,9 @@
#if ENABLE_STYLES
"styles,"
#endif

View File

@@ -0,0 +1,164 @@
diff --git a/config.h.in b/config.h.in
index b50ab85..51e6d76 100644
--- a/config.h.in
+++ b/config.h.in
@@ -6,6 +6,9 @@
/* Define if you want to automatically compose combining characters */
#undef ENABLE_COMBINING
+/* Define if you want proper way to calculate character width */
+#undef ENABLE_FONT_WIDTH
+
/* Define if you want handling for rarely used but handy features */
#undef ENABLE_FRILLS
diff --git a/configure b/configure
index ed2f2b2..1b72b89 100755
--- a/configure
+++ b/configure
@@ -739,6 +739,7 @@ enable_combining
enable_xft
enable_font_styles
enable_wide_glyphs
+enable_font_width
enable_pixbuf
enable_startup_notification
enable_transparency
@@ -1414,6 +1415,7 @@ Optional Features:
--enable-xft enable xft support on systems that have it
--enable-font-styles enable bold and italic support
--enable-wide-glyphs enable displaying of wide glyphs
+ --enable-font-width enable proper way to calculate character width
--enable-pixbuf enable integration with gdk-pixbuf for background images
--enable-startup-notification enable freedesktop startup notification support
--enable-transparency enable transparent backgrounds
@@ -4995,6 +4997,7 @@ support_combining=yes
support_8bitctrls=no
support_iso14755=yes
support_styles=yes
+support_font_width=no
support_perl=yes
codesets=all
@@ -5026,6 +5029,7 @@ then :
support_iso14755=no
support_styles=no
support_wide_glyphs=no
+ support_font_width=no
support_perl=no
codesets=
fi
@@ -5052,6 +5056,7 @@ then :
support_iso14755=yes
support_styles=yes
support_wide_glyphs=yes
+ support_font_width=yes
support_perl=yes
codesets=all
fi
@@ -5177,6 +5182,15 @@ if test "${enable_wide_glyphs+set}" = set; then :
fi
+# Check whether --enable-font-width was given.
+if test ${enable_font_width+y}
+then :
+ enableval=$enable_font_width; if test x$enableval = xyes -o x$enableval = xno; then
+ support_font_width=$enableval
+ fi
+fi
+
+
# Check whether --enable-pixbuf was given.
if test ${enable_pixbuf+y}
then :
@@ -7681,6 +7695,11 @@ if test x$support_styles = xyes; then
printf "%s\n" "#define ENABLE_STYLES 1" >>confdefs.h
+fi
+if test x$support_font_width = xyes; then
+
+printf "%s\n" "#define ENABLE_FONT_WIDTH 1" >>confdefs.h
+
fi
if test x$support_iso14755 = xyes; then
diff --git a/configure.ac b/configure.ac
index 510fa44..54ab35b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,6 +90,7 @@ support_combining=yes
support_8bitctrls=no
support_iso14755=yes
support_styles=yes
+support_font_width=no
support_perl=yes
codesets=all
@@ -124,6 +125,7 @@ AC_ARG_ENABLE(everything,
support_iso14755=no
support_styles=no
support_wide_glyphs=no
+ support_font_width=no
support_perl=no
codesets=
fi
@@ -150,6 +152,7 @@ AC_ARG_ENABLE(everything,
support_iso14755=yes
support_styles=yes
support_wide_glyphs=yes
+ support_font_width=yes
support_perl=yes
codesets=all
fi
@@ -229,6 +232,12 @@ AC_ARG_ENABLE(wide-glyphs,
support_wide_glyphs=$enableval
fi])
+AC_ARG_ENABLE(font-width,
+ [ --enable-font-width enable proper way to calculate character width],
+ [if test x$enableval = xyes -o x$enableval = xno; then
+ support_font_width=$enableval
+ fi])
+
AC_ARG_ENABLE(pixbuf,
[ --enable-pixbuf enable integration with gdk-pixbuf for background images],
[if test x$enableval = xyes -o x$enableval = xno; then
@@ -654,6 +663,9 @@ fi
if test x$support_wide_glyphs = xyes; then
AC_DEFINE(ENABLE_WIDE_GLYPHS, 1, Define if you want to display wide glyphs)
fi
+if test x$support_font_width = xyes; then
+ AC_DEFINE(ENABLE_FONT_WIDTH, 1, Define if you want proper way to calculate character width)
+fi
if test x$support_iso14755 = xyes; then
AC_DEFINE(ISO_14755, 1, Define if you want ISO 14755 extended support)
fi
diff --git a/src/rxvtfont.C b/src/rxvtfont.C
index 5d51eea..50f629f 100644
--- a/src/rxvtfont.C
+++ b/src/rxvtfont.C
@@ -1307,12 +1307,22 @@ rxvt_font_xft::load (const rxvt_fontprop &prop, bool force_prop)
XGlyphInfo g;
XftTextExtents16 (disp, f, &ch, 1, &g);
+#if ENABLE_FONT_WIDTH
+/*
+ * bukind: don't use g.width as a width of a character!
+ * instead use g.xOff, see e.g.: http://keithp.com/~keithp/render/Xft.tutorial
+ */
+ int wcw = WCWIDTH (ch);
+ if (wcw > 1) g.xOff = g.xOff / wcw;
+ if (width < g.xOff) width = g.xOff;
+#else
g.width -= g.x;
int wcw = WCWIDTH (ch);
if (wcw > 0) g.width = (g.width + wcw - 1) / wcw;
if (width < g.width ) width = g.width;
+#endif
if (height < g.height ) height = g.height;
if (glheight < g.height - g.y) glheight = g.height - g.y;
}

View File

@@ -0,0 +1,163 @@
diff --git a/config.h.in b/config.h.in
index 51e6d76..b9c7e0c 100644
--- a/config.h.in
+++ b/config.h.in
@@ -12,6 +12,9 @@
/* Define if you want handling for rarely used but handy features */
#undef ENABLE_FRILLS
+/* Define if you want line spacing fix */
+#undef ENABLE_LINE_SPACING
+
/* Define if you can embed a perl interpreter */
#undef ENABLE_PERL
diff --git a/configure b/configure
index 1b72b89..6b50a6b 100755
--- a/configure
+++ b/configure
@@ -740,6 +740,7 @@ enable_xft
enable_font_styles
enable_wide_glyphs
enable_font_width
+enable_line_spacing
enable_pixbuf
enable_startup_notification
enable_transparency
@@ -1416,6 +1417,7 @@ Optional Features:
--enable-font-styles enable bold and italic support
--enable-wide-glyphs enable displaying of wide glyphs
--enable-font-width enable proper way to calculate character width
+ --enable-line-spacing enable line spacing fix
--enable-pixbuf enable integration with gdk-pixbuf for background images
--enable-startup-notification enable freedesktop startup notification support
--enable-transparency enable transparent backgrounds
@@ -4998,6 +5000,7 @@ support_8bitctrls=no
support_iso14755=yes
support_styles=yes
support_font_width=no
+support_line_spacing=no
support_perl=yes
codesets=all
@@ -5030,6 +5033,7 @@ then :
support_styles=no
support_wide_glyphs=no
support_font_width=no
+ support_line_spacing=no
support_perl=no
codesets=
fi
@@ -5057,6 +5061,7 @@ then :
support_styles=yes
support_wide_glyphs=yes
support_font_width=yes
+ support_line_spacing=yes
support_perl=yes
codesets=all
fi
@@ -5191,6 +5196,15 @@ then :
fi
+# Check whether --enable-line-spacing was given.
+if test ${enable_line_spacing+y}
+then :
+ enableval=$enable_line_spacing; if test x$enableval = xyes -o x$enableval = xno; then
+ support_line_spacing=$enableval
+ fi
+fi
+
+
# Check whether --enable-pixbuf was given.
if test ${enable_pixbuf+y}
then :
@@ -7700,6 +7714,11 @@ if test x$support_font_width = xyes; then
printf "%s\n" "#define ENABLE_FONT_WIDTH 1" >>confdefs.h
+fi
+if test x$support_line_spacing = xyes; then
+
+printf "%s\n" "#define ENABLE_LINE_SPACING 1" >>confdefs.h
+
fi
if test x$support_iso14755 = xyes; then
diff --git a/configure.ac b/configure.ac
index 54ab35b..1cffda6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,6 +91,7 @@ support_8bitctrls=no
support_iso14755=yes
support_styles=yes
support_font_width=no
+support_line_spacing=no
support_perl=yes
codesets=all
@@ -126,6 +127,7 @@ AC_ARG_ENABLE(everything,
support_styles=no
support_wide_glyphs=no
support_font_width=no
+ support_line_spacing=no
support_perl=no
codesets=
fi
@@ -153,6 +155,7 @@ AC_ARG_ENABLE(everything,
support_styles=yes
support_wide_glyphs=yes
support_font_width=yes
+ support_line_spacing=yes
support_perl=yes
codesets=all
fi
@@ -238,6 +241,12 @@ AC_ARG_ENABLE(font-width,
support_font_width=$enableval
fi])
+AC_ARG_ENABLE(line-spacing,
+ [ --enable-line-spacing enable line spacing fix],
+ [if test x$enableval = xyes -o x$enableval = xno; then
+ support_line_spacing=$enableval
+ fi])
+
AC_ARG_ENABLE(pixbuf,
[ --enable-pixbuf enable integration with gdk-pixbuf for background images],
[if test x$enableval = xyes -o x$enableval = xno; then
@@ -666,6 +675,9 @@ fi
if test x$support_font_width = xyes; then
AC_DEFINE(ENABLE_FONT_WIDTH, 1, Define if you want proper way to calculate character width)
fi
+if test x$support_line_spacing = xyes; then
+ AC_DEFINE(ENABLE_LINE_SPACING, 1, Define if you want line spacing fix)
+fi
if test x$support_iso14755 = xyes; then
AC_DEFINE(ISO_14755, 1, Define if you want ISO 14755 extended support)
fi
diff --git a/src/rxvtfont.C b/src/rxvtfont.C
index 50f629f..9420a22 100644
--- a/src/rxvtfont.C
+++ b/src/rxvtfont.C
@@ -1279,10 +1279,21 @@ rxvt_font_xft::load (const rxvt_fontprop &prop, bool force_prop)
break;
}
+#ifdef ENABLE_LINE_SPACING
+/*
+ * use ascent, descent and height from XftFont *f instead of FT_Face face.
+ * this somehow reproduces the behaviour of the line height as seen on xterm.
+ */
+ ascent = f->ascent;
+ descent = f->descent;
+ height = max (ascent + descent, f->height);
+ width = 0;
+#else
ascent = (face->size->metrics.ascender + 63) >> 6;
descent = (-face->size->metrics.descender + 63) >> 6;
height = max (ascent + descent, (face->size->metrics.height + 63) >> 6);
width = 0;
+#endif
bool scalable = face->face_flags & FT_FACE_FLAG_SCALABLE;

View File

@@ -0,0 +1,13 @@
Perl 5.38 does not handle empty locale names. Backported upstream fix.
--- a/src/rxvtperl.xs
+++ b/src/rxvtperl.xs
@@ -399,7 +399,7 @@ rxvt_perl_interp::init ()
{
if (!perl)
{
- rxvt_push_locale (""); // perl init destroys current locale
+ rxvt_push_locale ("C"); // perl init destroys current locale
{
perl_environ = rxvt_environ;

View File

@@ -1,146 +0,0 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
#
# NOTE(gryf): this ebuild differ from official one by using 3rd party patches,
# and configuration options, which are absent in official ebuild, but are
# accepted by configure script:
# enabled options as a use flags:
# - smart-resize
# 3rd party patches (by flags):
# - font-width - use xOff instead of width attribute for a glyph.
# - line-spacing - use ascent, descent and height from XftFont *f instead of
# FT_Face face.
# - use-space - add space for characters to figure out width and height of
# chars
# - wide-glyphs - add support for wide glyphs
EAPI=8
inherit autotools desktop systemd prefix
COLOUR_PATCH_NAME="${PN}-9.29_24-bit-color_aur-9.26-20210712.patch"
DESCRIPTION="rxvt clone with xft and unicode support"
HOMEPAGE="http://software.schmorp.de/pkg/rxvt-unicode.html"
SRC_URI="http://dist.schmorp.de/rxvt-unicode/Attic/${P}.tar.bz2
https://dev.gentoo.org/~marecki/dists/${CATEGORY}/${PN}/${COLOUR_PATCH_NAME}.xz"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~sparc ~x86"
IUSE="24-bit-color 256-color blink fading-colors +font-styles -font-width
gdk-pixbuf iso14755 -line-spacing +mousewheel +perl -smart-resize
-use-space startup-notification unicode3 -wide-glyphs xft"
RDEPEND=">=sys-libs/ncurses-5.7-r6:=
dev-libs/libptytty
media-libs/fontconfig
x11-libs/libX11
x11-libs/libXrender
x11-libs/libXt
gdk-pixbuf? ( x11-libs/gdk-pixbuf )
perl? ( dev-lang/perl:= )
startup-notification? ( x11-libs/startup-notification )
xft? ( x11-libs/libXft )"
DEPEND="${RDEPEND}
x11-base/xorg-proto"
# autoconf dependency hopefully temporary, see Bug #827852
BDEPEND="virtual/pkgconfig
>=sys-devel/autoconf-2.71"
PATCHES=(
"${FILESDIR}"/${PN}-9.06-case-insensitive-fs.patch
"${FILESDIR}"/${PN}-9.21-xsubpp.patch
)
DOCS=(
Changes
README.FAQ
doc/README.xvt
doc/changes.txt
doc/etc/${PN}.term{cap,info}
doc/rxvt-tabbed
)
src_prepare() {
default
# Current patch is too aggressive to apply unconditionally, see Bug #801571
if use 24-bit-color; then
eapply "${WORKDIR}"/${COLOUR_PATCH_NAME}
eautoreconf
fi
# custom patches
if use font-width; then
eapply "${FILESDIR}"/${PN}-9.22-font-width-fix.patch
fi
if use line-spacing; then
eapply "${FILESDIR}"/${PN}-9.22-line-spacing-fix.patch
fi
if use wide-glyphs; then
eapply "${FILESDIR}"/${PN}-9.30-enable-wide-glyphs.patch
fi
if use use-space; then
eapply "${FILESDIR}"/${PN}-9.22-add-space-to-extent_test_chars.patch
fi
# kill the rxvt-unicode terminfo file - #192083
sed -i -e "/rxvt-unicode.terminfo/d" doc/Makefile.in || die "sed failed"
# use xsubpp from Prefix - #506500
hprefixify -q '"' -w "/xsubpp/" src/Makefile.in
}
src_configure() {
# --enable-everything goes first: the order of the arguments matters
local myconf=(
--enable-everything
$(use_enable 256-color)
$(use_enable blink text-blink)
$(use_enable fading-colors fading)
$(use_enable font-styles)
$(use_enable gdk-pixbuf pixbuf)
$(use_enable iso14755)
$(use_enable mousewheel)
$(use_enable perl)
$(use_enable smart-resize)
$(use_enable startup-notification)
$(use_enable unicode3)
$(use_enable wide-glyphs)
$(use_enable xft)
)
if use 24-bit-color; then
myconf+=( --enable-24-bit-color )
fi
if use wide-glyphs; then
myconf+=( --enable-wide-glyphs )
fi
econf "${myconf[@]}"
}
src_compile() {
default
sed -i \
-e 's/RXVT_BASENAME = "rxvt"/RXVT_BASENAME = "urxvt"/' \
"${S}"/doc/rxvt-tabbed || die
}
src_install() {
default
systemd_douserunit "${FILESDIR}"/urxvtd.service
systemd_douserunit "${FILESDIR}"/urxvtd.socket
make_desktop_entry urxvt rxvt-unicode utilities-terminal \
"System;TerminalEmulator"
}
pkg_postinst() {
if use 24-bit-color; then
ewarn
ewarn "You have enabled 24-bit colour support in ${PN}, which is UNOFFICIAL and INCOMPLETE."
ewarn "You may or may not encounter visual glitches or stability issues. When in doubt,"
ewarn "rebuild =${CATEGORY}/${PF} with USE=-24-bit-color (the default setting)."
ewarn
fi
}