[Konsole-devel] [PATCH] Re: [Bug 131770] no bold is displayed in konsole

lars.doelle at on-line.de lars.doelle at on-line.de
Sun Sep 3 17:54:14 UTC 2006


Hello,

find attached a patch for the related bug.

Note that the patch is against 3.5.4 and the earlier patch posted has to be reverted,
since otherwise the whole mechanism would be broken.

-- 8< snip -----------
--- konsole/TECommon.h.orig     2006-07-22 10:15:55.000000000 +0200
+++ konsole/TECommon.h  2006-09-03 19:10:21.000000000 +0200
@@ -219,8 +219,8 @@

 inline bool ca::isBold(const ColorEntry* base) const
 {
-  return (b.t == CO_DFT) && base[b.u+0+(b.v?BASE_COLORS:0)].bold
-      || (b.t == CO_SYS) && base[b.u+2+(b.v?BASE_COLORS:0)].bold;
+  return (f.t == CO_DFT) && base[f.u+0+(f.v?BASE_COLORS:0)].bold
+      || (f.t == CO_SYS) && base[f.u+2+(f.v?BASE_COLORS:0)].bold;
 }

 #endif // TECOMMON_H
-- 8< snap -----------

The bug had been introduced by me adding the 2^8 and 2^32 colour spaces,
and is a copy-paste error, where i copied the above predicate from the related
one for transparency, which is a background attribute, while bold is a foreground
attribute, forgetting to adjust that. Sorry for the inconvenience.

This also explains, why the bold attribute was visible during reverse rendering,
i.e. during marking.


As some delight came up on the earlier (wrong) fix about the result that it
"brings konsole in line with the xterm rendering", some words of explanation:

The interpretation of BOLD rendition is not really defined. Xterm interprets
BOLD as INTENSIVE+BOLD, while the linux console interprets it as INTENSIVE,
which, together with the fact that the white forground there is not intense-white,
as in xterm, produces a more pleasing and eye-sparing appearance.

The konsole sticks to later interpretation by default, though it is only the
matter of picking a schema, for instance "Xterm Colours", to make the
konsole look like xterm, so nothing new was introduces.

To reiterate, xterm is in no way the only measure, and indeed, the konsole
was also able to produce a pixel identical image of the linux-console screen.
The earlier patch would have broken this feature more than it is anyway,
right now.

The particular way to interpret BOLD is coded in the *.schema files, which
take care to handle the edge cases, in particalar, when e.g. intense black
is used as default foreground colour.

Such edge cases, where BOLD cannot be presented by INTENSIVE, are then
handled as BOLD. Normally, a non-intensive colour is used and the former
interpretation could be applied.

I'm aware that this is a bit obscure, the following examples from the schema
files should make this more understandable:

-- 8< snip -----
# example scheme for konsole

# the title is to appear in the menu.

title Black on White

# foreground colors

# note that the default background color is flagged
# to become transparent when an image is present.

#   slot    transparent bold
#      |              | |
#      V V--color--V  V V

color  0   0   0   0  0 0  # regular   foreground color (Black)
color  1 255 255 255  1 0  # regular   background color (White)

color  2   0   0   0  0 0  # regular   color 0 Black
color  3 178  24  24  0 0  # regular   color 1 Red
color  4  24 178  24  0 0  # regular   color 2 Green
color  5 178 104  24  0 0  # regular   color 3 Yellow
color  6  24  24 178  0 0  # regular   color 4 Blue
color  7 178  24 178  0 0  # regular   color 5 Magenta
color  8  24 178 178  0 0  # regular   color 6 Cyan
color  9 178 178 178  0 0  # regular   color 7 White

# intensive colors

# instead of changing the colors, we've flaged the text to become bold

color 10   0   0   0  0 1  # intensive foreground color
color 11 255 255 255  1 0  # intensive background color

color 12 104 104 104  0 0  # intensive color 0
color 13 255  84  84  0 0  # intensive color 1
color 14  84 255  84  0 0  # intensive color 2
color 15 255 255  84  0 0  # intensive color 3
color 16  84  84 255  0 0  # intensive color 4
color 17 255  84 255  0 0  # intensive color 5
color 18  84 255 255  0 0  # intensive color 6
color 19 255 255 255  0 0  # intensive color 7
-- 8< snap -----

Note that on in colour 10, the "bold attribute" is set on, meaning that
this colour should also render bold. Both colours 0 and 1 and colours
10 and 11 are used for the default colours, the first couple for normal
the second for bold rendering.

Now because colour 0 (default foreground) and colour 10 (default foreground
+ BOLD) spell the same colour (intense black), bold rendering has been
flagged, taking care of this edge case.

An xterm compliant rendering is achieved by using the "Xterm Colour"
schema, listed below

-- 8< snip -----
# xterm color schema for konsole

# xterm colors can be configured (almost) like
# konsole colors can. This is the uncustomized
# xterm schema.
# Please refere to your local xterm setup files
# if this schema differs.

title XTerm Colors

# foreground colors -------------------------------

# note that the default background color is flagged
# to become transparent when an image is present.

#   slot    transparent bold
#      | red grn blu  | |
#      V V--color--V  V V

color  0   0   0   0  0 0  # regular   foreground color (Black)
color  1 255 255 255  1 0  # regular   background color (White)

color  2   0   0   0  0 0  # regular   color 0 Black
color  3 205   0   0  0 0  # regular   color 1 Red
color  4   0 205   0  0 0  # regular   color 2 Green
color  5 205 205   0  0 0  # regular   color 3 Yellow
color  6   0   0 205  0 0  # regular   color 4 Blue
color  7 205   0 205  0 0  # regular   color 5 Magenta
color  8   0 205 205  0 0  # regular   color 6 Cyan
color  9 229 229 229  0 0  # regular   color 7 White

# intensive colors -------------------------------------------

# for some strange reason, intensive colours are bold, also.

color 10  77  77  77  0 1  # intensive foreground color
color 11 255 255 255  1 1  # intensive background color

color 12  77  77  77  0 1  # intensive color 0
color 13 255   0   0  0 1  # intensive color 1
color 14   0 255   0  0 1  # intensive color 2
color 15 255 255   0  0 1  # intensive color 3
color 16   0   0 255  0 1  # intensive color 4
color 17 255   0 255  0 1  # intensive color 5
color 18   0 255 255  0 1  # intensive color 6
color 19 255 255 255  0 1  # intensive color 7
-- 8< snap -----

Note that here, all intense colours are also rendered bold.

-lars
-------------- next part --------------
A non-text attachment was scrubbed...
Name: konsole~TECommon.h.patch
Type: text/x-diff
Size: 495 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/konsole-devel/attachments/20060903/7f24cc3b/attachment.bin>


More information about the konsole-devel mailing list