Summary: | [PATCH] rendering of indentation lines is ugly | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | nfxjfg |
Component: | part | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | cfeck, mail, nfxjfg |
Priority: | HI | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Debian unstable | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/kate/c66be2a73282275819aed69dd9421e83c4be9f26 | Version Fixed In: | 4.12 |
Sentry Crash Report: | |||
Attachments: | Antialiasing switched off |
Description
nfxjfg
2012-07-15 12:42:35 UTC
Created attachment 72556 [details]
Antialiasing switched off
Using "QPainter::Antialiasing = false" does wonders (only 1 pixel thick now). The other problem is that the line is not positioned correctly. The metrics calculation Kate uses does not follow the metrics calculation Qt uses.
Screen shot attached.
On the other hand, on very high DPI displays, a single-pixel line might be too thin. I suggest to use the same line thickness as the "underline". See QFontMetricsF::lineWidth(). Ah, Kate uses QFontMetrics, instead of QFontMetricsF... To compute the width of eight spaces, you either have to use QFontMetrics::width(" "); or use 8 * QFontMetricsF.width(' '); Git commit 18afabd3cf527e8ce987b25c74eb8ee6dbf7ed96 by Christoph Cullmann. Committed on 24/10/2012 at 15:45. Pushed by cullmann into branch 'master'. use fontmetricsF that fixes positioning (and using qreal for calc) new style without dotted lines is wanted M +6 -6 part/render/katerenderer.cpp M +3 -8 part/render/katerenderer.h M +3 -3 part/utils/kateconfig.cpp M +3 -3 part/utils/kateconfig.h M +1 -1 part/view/kateviewhelpers.cpp http://commits.kde.org/kate/18afabd3cf527e8ce987b25c74eb8ee6dbf7ed96 After having used 4.7 for a long time (because Debian was keeping 4.8 and 4.8 is broken), I tried 4.10. Well, the indentation lines are still ugly and 2 pixels wide. They are thicker than the underline thickness of the normal font too. The lighter color makes it look better than on 4.8, though. (Not sure where that color comes from, I didn't change any settings when upgrading though.) Assuming this commit is included in 4.10, I'm reopening the bug. Here's a screenshot that contains both indentation line and underline: http://www.abload.de/img/scra7upt.png Settings > Configure Kate > Fonts & Colors. There you have "Indentation Lines" as entry. You can change the color to your liking. Would the Dottet style on http://qt-project.org/doc/qt-4.8/qpen.html#pen-style work for you? Qt::DotLine has too much spacing between the dots (looks like a 2-1-2-1 pattern), but with "pen.setDashPattern( QVector<qreal>() << 1 << 1 );" an even pattern with a 1 pixel dot followed by 1 pixel space. Thanks for caring about this! Git commit 46022a0ca69fdd1901d912f7828613baea8a4f8a by Joseph Wenninger. Committed on 18/07/2013 at 09:11. Pushed by jowenn into branch 'master'. experimental in master. Show dots again instead of a solid line, can't promise that it will stay in M +8 -2 part/render/katerenderer.cpp http://commits.kde.org/kate/46022a0ca69fdd1901d912f7828613baea8a4f8a Given jowenn's commit, close this report. Thank you. But unfortunately, it's still not right. The dots are not quadratic: they are 1 pixel high (good), but 2 pixels wide (bad). Also, the last dot before an empty line starts is slightly lighter. Not a problem by itself, but maybe it gives a hint what goes wrong when rendering. Note that the word wrap marker line has the correct width (1 pixel). Here's a screenshot: http://www.abload.de/img/shot9zahp.png (For some reason, the font rendering looks worse than on the screen. I used imagemagick import to take this screenshot and I'm not sure what's going wrong. But it still conveys the basic idea what's wrong.) Yep, the actual problem is not fixed. To fix it, either anti-aliasing (see comment #1) could be switched off, or line coordinates rounded to nearest integer. Git commit c66be2a73282275819aed69dd9421e83c4be9f26 by Milian Wolff. Committed on 18/07/2013 at 19:50. Pushed by mwolff into branch 'master'. Disable antialiasing for the indentation lines. Since the lines are now not washed out anymore, the contrast should probably be decreased by default. M +5 -0 part/render/katerenderer.cpp http://commits.kde.org/kate/c66be2a73282275819aed69dd9421e83c4be9f26 I tried it, and I think it looks pretty good now! Sometimes it looks a bit odd, though: http://abload.de/img/shot22wuir.png (Again, font rendering looks broken on the screenshot, but looks fine on actual display for unknown reason. The indention lines look the same, though.) |