[wiki] [sites] add st boldcolor patch || Szabolcs Nagy

From: <hg_AT_suckless.org>
Date: Sat, 3 Nov 2012 17:55:04 +0100 (CET)

changeset: 997:bf5678a95107
tag: tip
user: Szabolcs Nagy <nsz_AT_port70.net>
date: Sat Nov 03 00:28:39 2012 +0100
files: st.suckless.org/patches/boldcolor.md st.suckless.org/patches/index.md st.suckless.org/patches/st-0.3-boldcolor.diff
description:
add st boldcolor patch


diff -r a57baa3b6578 -r bf5678a95107 st.suckless.org/patches/boldcolor.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/st.suckless.org/patches/boldcolor.md Sat Nov 03 00:28:39 2012 +0100
_AT_@ -0,0 +1,49 @@
+boldcolor
+=========
+
+Description
+-----------
+
+This is a hack to allow using different color for bold, italic
+or underlined text when the text is in defaultfg color otherwise.
+
+Makes the special attributes more visible, when no bold or italic
+font is available, or the defaultfg is a special color (>255 value).
+
+Usage
+-----
+
+example config.h
+
+ static const char *colorname[] = {
+ // ...
+ [255]=0,
+ // extra
+ "#00cc00",
+ "#333333",
+ "#cdba96",
+ "#99ff00",
+ "#ffff00",
+ };
+
+ static unsigned int defaultfg = 7;
+ static unsigned int defaultbg = 0;
+ static unsigned int defaultcs = 256;
+ static unsigned int defaultucs = 257;
+ // we don't want bold font (dc.bfont == dc.font)
+ #define NOBOLDFONT 1
+ // we have extra colors to mark bold, italic and underline
+ #define DEFAULTBOLD 258
+ #define DEFAULTITALIC 259
+ #define DEFAULTUNDERLINE 260
+
+Download
+--------
+* [st-0.3-boldcolor.diff][0]
+
+[0]: st-0.3-boldcolor.diff
+
+Author
+------
+
+ * Szabolcs Nagy - nsz
diff -r a57baa3b6578 -r bf5678a95107 st.suckless.org/patches/index.md
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/st.suckless.org/patches/index.md Sat Nov 03 00:28:39 2012 +0100
_AT_@ -0,0 +1,4 @@
+Patches
+-------
+Much like the [dwm patches](http://dwm.suckless.org/patches/) but for st.
+
diff -r a57baa3b6578 -r bf5678a95107 st.suckless.org/patches/st-0.3-boldcolor.diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/st.suckless.org/patches/st-0.3-boldcolor.diff Sat Nov 03 00:28:39 2012 +0100
_AT_@ -0,0 +1,52 @@
+diff -r db4f3f0ef420 st.c
+--- a/st.c Fri Nov 02 20:08:51 2012 +0100
++++ b/st.c Sat Nov 03 00:19:19 2012 +0100
+_AT_@ -2260,8 +2260,10 @@
+ xw.cw = dc.font.width;
+ xw.ch = dc.font.height;
+
++#ifndef NOBOLDFONT
+ FcPatternDel(pattern, FC_WEIGHT);
+ FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
++#endif
+ if(xloadfont(&dc.bfont, pattern))
+ die("st: can't open font %s\n", fontstr);
+
+_AT_@ -2397,6 +2399,10 @@
+ /* greyscale */
+ fg = &dc.xft_col[base.fg + 4];
+ }
++#ifdef DEFAULTBOLD
++ if(base.fg == defaultfg)
++ fg = &dc.xft_col[DEFAULTBOLD];
++#endif
+ /*
+ * Those ranges will not be brightened:
+ * 8 - 15 – bright system colors
+_AT_@ -2406,10 +2412,22 @@
+ font = &dc.bfont;
+ }
+
+- if(base.mode & ATTR_ITALIC)
+- font = &dc.ifont;
+- if(base.mode & (ATTR_ITALIC|ATTR_ITALIC))
+- font = &dc.ibfont;
++ if(base.mode & ATTR_ITALIC) {
++ if(base.mode & ATTR_BOLD) {
++ font = &dc.ibfont;
++ } else {
++ font = &dc.ifont;
++#ifdef DEFAULTITALIC
++ if(base.fg == defaultfg)
++ fg = &dc.xft_col[DEFAULTITALIC];
++#endif
++ }
++ }
++
++#ifdef DEFAULTUNDERLINE
++ if((base.mode & ATTR_UNDERLINE) && base.fg == defaultfg)
++ fg = &dc.xft_col[DEFAULTUNDERLINE];
++#endif
+
+ if(IS_SET(MODE_REVERSE)) {
+ if(fg == &dc.xft_col[defaultfg]) {
Received on Sat Nov 03 2012 - 17:55:04 CET

This archive was generated by hypermail 2.3.0 : Sat Nov 03 2012 - 18:00:10 CET