<Swing Dev> [8] Review request for 8016833: Underlines and strikethrough not rendering correctly
anton nashatyrev
anton.nashatyrev at oracle.com
Thu Jun 20 10:41:35 UTC 2013
Hello,
could you please review the following fix:
fix: http://cr.openjdk.java.net/~vkarnauk/8016833/jdk8/webrev.00/
<http://cr.openjdk.java.net/%7Evkarnauk/8016833/jdk8/webrev.00/>
bug: http://bugs.sun.com/view_bug.do?bug_id=8016833
The reason of such behavior is that the superscripted GlyphView requested
increased vertical span, since the alignment of value 1.0
(GlyphView.getAligment(View.Y_AXIS) returns 1.0) isn't enough to paint
it as
high as required.
(BTW, for subscripted text setting the alignment is enough)
GlyphView.paintTextUsingColor() calculates the Y position of the underscore
as following:
int y = alloc.y + alloc.height - (int) painter.getDescent(this);
but here alloc.height means the space _reserved_ for glyphs and not the
actual boundary of the painted text. To fix that we need to substitute
alloc.height with painter.getHeight(this).
The fix looks safe since the GlyphView preferred vertical span is initially
requested from the GlyphPainter.
Thanks!
Anton.
More information about the swing-dev
mailing list