|
From: SourceForge.net <no...@so...> - 2009-09-22 22:02:56
|
Patches item #2844750, was opened at 2009-08-26 08:46 Message generated for change (Settings changed) made by blueyed You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300588&aid=2844750&group_id=588 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: texteditor Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Suraj Kurapati (cyzsuraj) Assigned to: Nobody/Anonymous (nobody) Summary: line height correction (disappearing underscores) Initial Comment: Attached is a patch (against SVN r16059) which solves problem of underscores disappearing when the cursor is moved up and down the lines of the TextArea with the "DejaVu Sans Mono" at 15pt in jEdit from SVN trunk (r16059) under openjdk6-1.5-2-i686. The root cause was the underscore in this particular font descends below lineHeight and appears on the first pixel of the next line. So when the next line is drawn, the underscore of the current line is painted-over and it disappears. The solution used in the patch is to always draw one extra line above the first line being repainted, so that any underscores in the extra above line are preserved during the repaint. Thanks for your consideration. ---------------------------------------------------------------------- Comment By: daniel hahler (blueyed) Date: 2009-09-23 00:02 Message: Sorry for not having looked into this earlier again. Just committed in r16233. Thanks again, a lot! btw: patch is fine, applies cleanly using "patch -p1". ---------------------------------------------------------------------- Comment By: Matthieu Casanova (kpouer) Date: 2009-09-22 14:58 Message: Hi, I want to try your patch but I'm unable to reproduce the bug here, and I am also unable to apply the patch because of it's format, why not using svn patch ? ---------------------------------------------------------------------- Comment By: Suraj Kurapati (cyzsuraj) Date: 2009-09-11 00:18 Message: Deassign from blueyed. It seems he's too busy lately. Please someone review my new patch! Thanks. ---------------------------------------------------------------------- Comment By: Suraj Kurapati (cyzsuraj) Date: 2009-08-28 20:40 Message: Assigned to blueyed since he reviewed my original patch. ---------------------------------------------------------------------- Comment By: Suraj Kurapati (cyzsuraj) Date: 2009-08-28 09:30 Message: Attached is a new patch which uses a better strategy of adding +1 pixels to the getLeading() --- the area between the ascent and descent of a font. In this new patch, we no longer have to redraw 1 extra line at the top. No problems seen so far. Please test and accept if satisfactory. Cheers! ---------------------------------------------------------------------- Comment By: Suraj Kurapati (cyzsuraj) Date: 2009-08-28 03:09 Message: Wow, even the documentation for FontMetrics.getHeight() says it's unreliable: http://java.sun.com/javase/6/docs/api/java/awt/FontMetrics.html#getHeight%28%29 public int getHeight() Gets the standard height of a line of text in this font. This is the distance between the baseline of adjacent lines of text. It is the sum of the leading + ascent + descent. Due to rounding this may not be the same as getAscent() + getDescent() + getLeading(). There is no guarantee that lines of text spaced at this distance are disjoint; such lines may overlap if some characters overshoot either the standard ascent or the standard descent metric. I am going to add a TextAreaPainter.getLineHeight() method which returns the correct value, and then use that everywhere instead of TextAreaPainter.getFontMetrics.getHeight(). ---------------------------------------------------------------------- Comment By: Suraj Kurapati (cyzsuraj) Date: 2009-08-28 02:58 Message: I see now. TextAreaPainter.getFontMetrics().getHeight() is used as the lineHeight everywhere. I'll see if we can detect and correct the value provided by FontMetrics inside TextAreaPainter.setFont(). ---------------------------------------------------------------------- Comment By: Suraj Kurapati (cyzsuraj) Date: 2009-08-28 02:53 Message: I noticed that the problem of underscores not being rendered also occurs within the drop-down menu that appears when the "complete word" action is issued. Is there a global place where the lineHeight is calculated for a font? If we add +1 pixels to that result, then this problem will be solved everywhere without having to do things like redraw lines (as my patch does). Thanks. ---------------------------------------------------------------------- Comment By: Suraj Kurapati (cyzsuraj) Date: 2009-08-27 01:22 Message: Actually, I don't think the problem is entirely fixed. I was using this patch some more last night and noticed that after editor actions such as "complete word" are performed, underscores on the current line are obscured once again. It seems the current line is being drawn LAST (the lines below & above it are being drawn before the current line). Any suggestions? We should definitely test out this patch before submitting into SVN.... Thanks for your consideration. ---------------------------------------------------------------------- Comment By: daniel hahler (blueyed) Date: 2009-08-26 19:41 Message: I confirm this bug, using DejaVu Sans 12 Plain. Also the patch fixes it for me and I intend to commit it, if nobody speaks up against it. ---------------------------------------------------------------------- Comment By: Suraj Kurapati (cyzsuraj) Date: 2009-08-26 08:52 Message: Here two are screencasts showing before & after the patch: http://snk.tuxfamily.org/tmp/before.gif http://snk.tuxfamily.org/tmp/after.gif ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300588&aid=2844750&group_id=588 |