aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO1
-rw-r--r--config.def.h10
-rw-r--r--st.c30
-rw-r--r--st.info10
4 files changed, 32 insertions, 19 deletions
diff --git a/TODO b/TODO
index 84025ae..c77c105 100644
--- a/TODO
+++ b/TODO
@@ -4,7 +4,6 @@ vt emulation
4* implement BCE right 4* implement BCE right
5* color definition in CSI 5* color definition in CSI
6 * implement CSI parsing 6 * implement CSI parsing
7* implement real italic
8* make the keypad keys really work 7* make the keypad keys really work
9 * kf0 .. kf44 8 * kf0 .. kf44
10 * kend, kel, kent, kfnd, ked, kext 9 * kend, kel, kent, kfnd, ked, kext
diff --git a/config.def.h b/config.def.h
index 047b5d1..0aef8be 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1,6 +1,8 @@
1 1
2#define FONT "-*-*-medium-r-*-*-*-120-75-75-*-60-*-*" 2#define FONT "-*-*-medium-r-*-*-*-120-75-75-*-60-*-*"
3#define BOLDFONT "-*-*-bold-r-*-*-*-120-75-75-*-60-*-*" 3#define BOLDFONT "-*-*-bold-r-*-*-*-120-75-75-*-60-*-*"
4/* If italic is not availbel, fall back to bold. */
5#define ITALICFONT "-*-*-medium-o-*-*-*-120-75-75-*-60-*-*," BOLDFONT
4 6
5/* Space in pixels around the terminal buffer */ 7/* Space in pixels around the terminal buffer */
6#define BORDER 2 8#define BORDER 2
@@ -29,9 +31,9 @@ static const char *colorname[] = {
29 "magenta", 31 "magenta",
30 "cyan", 32 "cyan",
31 "white", 33 "white",
32 34
33 [255] = 0, 35 [255] = 0,
34 36
35 /* more colors can be added after 255 to use with DefaultXX */ 37 /* more colors can be added after 255 to use with DefaultXX */
36 "#cccccc", 38 "#cccccc",
37 "#333333", 39 "#333333",
@@ -50,11 +52,11 @@ static const char *colorname[] = {
50 Mask value: 52 Mask value:
51 * Use XK_ANY_MOD to match the key no matter modifiers state 53 * Use XK_ANY_MOD to match the key no matter modifiers state
52 * Use XK_NO_MOD to match the key alone (no modifiers) 54 * Use XK_NO_MOD to match the key alone (no modifiers)
53 55
54 key, mask, output */ 56 key, mask, output */
55static Key key[] = { 57static Key key[] = {
56 { XK_BackSpace, XK_NO_MOD, "\177" }, 58 { XK_BackSpace, XK_NO_MOD, "\177" },
57 { XK_Insert, XK_NO_MOD, "\033[2~" }, 59 { XK_Insert, XK_NO_MOD, "\033[2~" },
58 { XK_Delete, XK_NO_MOD, "\033[3~" }, 60 { XK_Delete, XK_NO_MOD, "\033[3~" },
59 { XK_Home, XK_NO_MOD, "\033[1~" }, 61 { XK_Home, XK_NO_MOD, "\033[1~" },
60 { XK_End, XK_NO_MOD, "\033[4~" }, 62 { XK_End, XK_NO_MOD, "\033[4~" },
diff --git a/st.c b/st.c
index cf329fd..655d5a3 100644
--- a/st.c
+++ b/st.c
@@ -76,6 +76,7 @@ enum glyph_attribute {
76 ATTR_UNDERLINE = 2, 76 ATTR_UNDERLINE = 2,
77 ATTR_BOLD = 4, 77 ATTR_BOLD = 4,
78 ATTR_GFX = 8, 78 ATTR_GFX = 8,
79 ATTR_ITALIC = 16,
79}; 80};
80 81
81enum cursor_movement { 82enum cursor_movement {
@@ -238,7 +239,7 @@ typedef struct {
238 short lbearing; 239 short lbearing;
239 short rbearing; 240 short rbearing;
240 XFontSet set; 241 XFontSet set;
241 } font, bfont; 242 } font, bfont, ifont;
242} DC; 243} DC;
243 244
244static void die(const char*, ...); 245static void die(const char*, ...);
@@ -1122,8 +1123,8 @@ tsetattr(int *attr, int l) {
1122 case 1: 1123 case 1:
1123 term.c.attr.mode |= ATTR_BOLD; 1124 term.c.attr.mode |= ATTR_BOLD;
1124 break; 1125 break;
1125 case 3: /* enter standout (highlight) mode TODO: make it italic */ 1126 case 3: /* enter standout (highlight) */
1126 term.c.attr.mode |= ATTR_REVERSE; 1127 term.c.attr.mode |= ATTR_ITALIC;
1127 break; 1128 break;
1128 case 4: 1129 case 4:
1129 term.c.attr.mode |= ATTR_UNDERLINE; 1130 term.c.attr.mode |= ATTR_UNDERLINE;
@@ -1134,8 +1135,8 @@ tsetattr(int *attr, int l) {
1134 case 22: 1135 case 22:
1135 term.c.attr.mode &= ~ATTR_BOLD; 1136 term.c.attr.mode &= ~ATTR_BOLD;
1136 break; 1137 break;
1137 case 23: /* leave standout (highlight) mode TODO: make it italic */ 1138 case 23: /* leave standout (highlight) mode */
1138 term.c.attr.mode &= ~ATTR_REVERSE; 1139 term.c.attr.mode &= ~ATTR_ITALIC;
1139 break; 1140 break;
1140 case 24: 1141 case 24:
1141 term.c.attr.mode &= ~ATTR_UNDERLINE; 1142 term.c.attr.mode &= ~ATTR_UNDERLINE;
@@ -1886,14 +1887,20 @@ xgetfontinfo(XFontSet set, int *ascent, int *descent, short *lbearing, short *rb
1886} 1887}
1887 1888
1888void 1889void
1889initfonts(char *fontstr, char *bfontstr) { 1890initfonts(char *fontstr, char *bfontstr, char *ifontstr) {
1890 if((dc.font.set = xinitfont(fontstr)) == NULL || 1891 if((dc.font.set = xinitfont(fontstr)) == NULL)
1891 (dc.bfont.set = xinitfont(bfontstr)) == NULL) 1892 die("Can't load font %s\n", fontstr);
1892 die("Can't load font %s\n", dc.font.set ? BOLDFONT : FONT); 1893 if((dc.bfont.set = xinitfont(bfontstr)) == NULL)
1894 die("Can't load bfont %s\n", bfontstr);
1895 if((dc.ifont.set = xinitfont(ifontstr)) == NULL)
1896 die("Can't load ifont %s\n", ifontstr);
1897
1893 xgetfontinfo(dc.font.set, &dc.font.ascent, &dc.font.descent, 1898 xgetfontinfo(dc.font.set, &dc.font.ascent, &dc.font.descent,
1894 &dc.font.lbearing, &dc.font.rbearing); 1899 &dc.font.lbearing, &dc.font.rbearing);
1895 xgetfontinfo(dc.bfont.set, &dc.bfont.ascent, &dc.bfont.descent, 1900 xgetfontinfo(dc.bfont.set, &dc.bfont.ascent, &dc.bfont.descent,
1896 &dc.bfont.lbearing, &dc.bfont.rbearing); 1901 &dc.bfont.lbearing, &dc.bfont.rbearing);
1902 xgetfontinfo(dc.ifont.set, &dc.ifont.ascent, &dc.ifont.descent,
1903 &dc.ifont.lbearing, &dc.ifont.rbearing);
1897} 1904}
1898 1905
1899void 1906void
@@ -1927,7 +1934,7 @@ xinit(void) {
1927 } 1934 }
1928 1935
1929 /* font */ 1936 /* font */
1930 initfonts(FONT, BOLDFONT); 1937 initfonts(FONT, BOLDFONT, ITALICFONT);
1931 1938
1932 /* XXX: Assuming same size for bold font */ 1939 /* XXX: Assuming same size for bold font */
1933 xw.cw = dc.font.rbearing - dc.font.lbearing; 1940 xw.cw = dc.font.rbearing - dc.font.lbearing;
@@ -2002,6 +2009,9 @@ xdraws(char *s, Glyph base, int x, int y, int charlen, int bytelen) {
2002 fontset = dc.bfont.set; 2009 fontset = dc.bfont.set;
2003 } 2010 }
2004 2011
2012 if(base.mode & ATTR_ITALIC)
2013 fontset = dc.ifont.set;
2014
2005 XSetBackground(xw.dpy, dc.gc, dc.col[bg]); 2015 XSetBackground(xw.dpy, dc.gc, dc.col[bg]);
2006 XSetForeground(xw.dpy, dc.gc, dc.col[fg]); 2016 XSetForeground(xw.dpy, dc.gc, dc.col[fg]);
2007 2017
diff --git a/st.info b/st.info
index aaae099..38012d8 100644
--- a/st.info
+++ b/st.info
@@ -83,15 +83,16 @@ st| simpleterm,
83 op=\E[39;49m, 83 op=\E[39;49m,
84 pairs#64, 84 pairs#64,
85 rc=\E8, 85 rc=\E8,
86 rs1=\Ec,
87 rs2=\E[4l\E>,
88 rev=\E[7m, 86 rev=\E[7m,
89 ri=\EM, 87 ri=\EM,
88 ritm=\E[23m,
90 rmacs=\E(B, 89 rmacs=\E(B,
91 rmcup=\E[?1049l, 90 rmcup=\E[?1049l,
92 rmkx=\E>, 91# rmkx=\E>,
93 rmso=\E[23m, 92 rmso=\E[23m,
94 rmul=\E[m, 93 rmul=\E[m,
94 rs1=\Ec,
95 rs2=\E[4l\E>,
95 sc=\E7, 96 sc=\E7,
96 setab=\E[4%p1%dm, 97 setab=\E[4%p1%dm,
97 setaf=\E[3%p1%dm, 98 setaf=\E[3%p1%dm,
@@ -99,9 +100,10 @@ st| simpleterm,
99 setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, 100 setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m,
100 sgr0=\E[0m, 101 sgr0=\E[0m,
101 sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, 102 sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m,
103 sitm=\E[3m,
102 smacs=\E(0, 104 smacs=\E(0,
103 smcup=\E[?1049h, 105 smcup=\E[?1049h,
104 smkx=\E=, 106# smkx=\E=,
105 smso=\E[3m, 107 smso=\E[3m,
106 smul=\E[4m, 108 smul=\E[4m,
107 tbc=\E[3g, 109 tbc=\E[3g,