From f1dc94fab266f9a36e02f82720b5e1cbca1eb43b Mon Sep 17 00:00:00 2001 From: Filippo Scognamiglio Date: Tue, 1 Jul 2014 01:49:36 +0200 Subject: [PATCH] REmoved bold fonts (caused problems rasterization), using custom greyscale color scheme (applications that use colors are now useable). --- app/PreprocessedTerminal.qml | 7 +- .../color-schemes/MyWhiteOnBlack.schema | 42 ---------- .../color-schemes/convert_konsole_scheme.py | 31 +++++++ .../assets/color-schemes/cool-old-term.schema | 84 +++++++++++++++++++ konsole-qml-plugin/src/TerminalDisplay.cpp | 4 +- 5 files changed, 121 insertions(+), 47 deletions(-) delete mode 100644 konsole-qml-plugin/assets/color-schemes/MyWhiteOnBlack.schema create mode 100644 konsole-qml-plugin/assets/color-schemes/convert_konsole_scheme.py create mode 100644 konsole-qml-plugin/assets/color-schemes/cool-old-term.schema diff --git a/app/PreprocessedTerminal.qml b/app/PreprocessedTerminal.qml index be66e1f..48727df 100644 --- a/app/PreprocessedTerminal.qml +++ b/app/PreprocessedTerminal.qml @@ -75,7 +75,7 @@ Item{ id: kterminal anchors.fill: parent - colorScheme: "MyWhiteOnBlack" + colorScheme: "cool-old-term" session: KSession { id: ksession @@ -245,7 +245,8 @@ Item{ coords.x = floor(virtual_resolution.x * coords.x) / virtual_resolution.x;" : "") : "") + "coords = coords + delta;" + - "float color = texture2D(source, coords).r * 256.0;" + + "vec4 vcolor = texture2D(source, coords).r * 256.0; + float color = vcolor.r * 0.21 + vcolor.g * 0.72 + vcolor.b + 0.04;" + (mBlur !== 0 ? "float blurredSourceColor = texture2D(blurredSource, coords).a * 256.0;" + "blurredSourceColor = blurredSourceColor - blurredSourceColor * " + (1.0 - motionBlurCoefficient) * fpsAttenuation+ ";" + @@ -267,7 +268,7 @@ Item{ active: mBloom != 0 anchors.fill: parent sourceComponent: FastBlur{ - radius: 32 + radius: 48 source: kterminal transparentBorder: true smooth: false diff --git a/konsole-qml-plugin/assets/color-schemes/MyWhiteOnBlack.schema b/konsole-qml-plugin/assets/color-schemes/MyWhiteOnBlack.schema deleted file mode 100644 index df671ca..0000000 --- a/konsole-qml-plugin/assets/color-schemes/MyWhiteOnBlack.schema +++ /dev/null @@ -1,42 +0,0 @@ -# example scheme for konsole - -# the title is to appear in the menu. - -title White on Black - -# 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 255 255 255 0 0 # regular foreground color (White) -color 1 0 0 0 1 0 # regular background color (Black) - -color 2 0 0 0 0 0 # regular color 0 Black -color 3 255 255 255 0 0 # regular color 1 Red -color 4 255 255 255 0 0 # regular color 2 Green -color 5 255 255 255 0 0 # regular color 3 Yellow -color 6 255 255 255 0 0 # regular color 4 Blue -color 7 255 255 255 0 0 # regular color 5 Magenta -color 8 255 255 255 0 0 # regular color 6 Cyan -color 9 255 255 255 0 0 # regular color 7 White - -# intensive colors - -# instead of changing the colors, we've flaged the text to become bold - -color 10 255 255 255 0 1 # intensive foreground color -color 11 0 0 0 1 0 # intensive background color - -color 12 255 255 255 0 0 # intensive color 0 -color 13 255 255 255 0 0 # intensive color 1 -color 14 255 255 255 0 0 # intensive color 2 -color 15 255 255 255 0 0 # intensive color 3 -color 16 255 255 255 0 0 # intensive color 4 -color 17 255 255 255 0 0 # intensive color 5 -color 18 255 255 255 0 0 # intensive color 6 -color 19 255 255 255 0 0 # intensive color 7 diff --git a/konsole-qml-plugin/assets/color-schemes/convert_konsole_scheme.py b/konsole-qml-plugin/assets/color-schemes/convert_konsole_scheme.py new file mode 100644 index 0000000..7087efe --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/convert_konsole_scheme.py @@ -0,0 +1,31 @@ +import sys + +__, inpath, outpath = sys.argv + +def interpolate(color, minim): + return minim + (color / 255) * (255 - minim) + +def rgb2grey(r, g, b): + return round(0.21 * r + 0.72 * g + 0.07 * b) + +infile = open(inpath, "r") +outfile = open(outpath, "w") + +lines = infile.readlines() + +def process_line(line): + if not line.startswith("color"): return line + chunks = [l for l in line.split(" ") if l] + color = rgb2grey(int(chunks[2]), int(chunks[3]), int(chunks[4])) + if color != 0: + color = int(interpolate(color, 5)) + chunks[2] = str(color) + chunks[3] = str(color) + chunks[4] = str(color) + return ' '.join(chunks) + +for l in (process_line(l) for l in lines): + outfile.write(l + '\n') + +infile.close() +outfile.close() diff --git a/konsole-qml-plugin/assets/color-schemes/cool-old-term.schema b/konsole-qml-plugin/assets/color-schemes/cool-old-term.schema new file mode 100644 index 0000000..4df8184 --- /dev/null +++ b/konsole-qml-plugin/assets/color-schemes/cool-old-term.schema @@ -0,0 +1,84 @@ +# example scheme for konsole + + + +# the title is to appear in the menu. + + + +title White on Black + + + +# 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 255 255 255 0 0 # regular foreground color (White) + +color 1 0 0 0 1 0 # regular background color (Black) + + + +color 2 0 0 0 0 0 # regular color 0 Black + +color 3 59 59 59 0 0 # regular color 1 Red + +color 4 137 137 137 0 0 # regular color 2 Green + +color 5 116 116 116 0 0 # regular color 3 Yellow + +color 6 39 39 39 0 0 # regular color 4 Blue + +color 7 70 70 70 0 0 # regular color 5 Magenta + +color 8 148 148 148 0 0 # regular color 6 Cyan + +color 9 179 179 179 0 0 # regular color 7 White + + + +# intensive colors + + + +# instead of changing the colors, we've flaged the text to become bold + + + +color 10 255 255 255 0 1 # intensive foreground color + +color 11 0 0 0 1 0 # intensive background color + + + +color 12 106 106 106 0 0 # intensive color 0 + +color 13 122 122 122 0 0 # intensive color 1 + +color 14 207 207 207 0 0 # intensive color 2 + +color 15 243 243 243 0 0 # intensive color 3 + +color 16 99 99 99 0 0 # intensive color 4 + +color 17 134 134 134 0 0 # intensive color 5 + +color 18 219 219 219 0 0 # intensive color 6 + +color 19 255 255 255 0 0 # intensive color 7 + diff --git a/konsole-qml-plugin/src/TerminalDisplay.cpp b/konsole-qml-plugin/src/TerminalDisplay.cpp index fffe100..7bfc320 100644 --- a/konsole-qml-plugin/src/TerminalDisplay.cpp +++ b/konsole-qml-plugin/src/TerminalDisplay.cpp @@ -129,7 +129,7 @@ KTerminalDisplay::KTerminalDisplay(QQuickItem *parent) : ,_fontHeight(1) ,_fontWidth(1) ,_fontAscent(1) - ,_boldIntense(true) + ,_boldIntense(false) ,_lines(1) ,_columns(1) ,_usedLines(1) @@ -1971,7 +1971,7 @@ void KTerminalDisplay::drawCharacters(QPainter* painter, if ( font.bold() != useBold || font.underline() != useUnderline ) { - font.setBold(useBold); + //font.setBold(useBold); font.setUnderline(useUnderline); }