<Swing Dev> Background is painted taller than needed for superscripted text

Prem Balakrishnan prem.balakrishnan at oracle.com
Wed Jun 15 07:18:29 UTC 2016


Hi Alexander,

 

Thank you for the Review.

    Why passed shape height is larger that the required superscripted text height?

In GlyphView:: getPreferredSpan(int axis) method (Refer lines 609 to 611 copied code snippet below)

...

...

case View.Y_AXIS:

            float h = painter.getHeight(this);

            if (isSuperscript()) {

                h += h/3;

            }

            return h;

...

...

 

Check isSuperscript() check is added, if true height is increased by (h/3),

hence the passed shape height is larger than the required text height.

 

Removing the check isSuperscript() may affect other behaviors. 

Suggested fix just replaces the height with painter.getHeight(this)
                

 

Regards,
Prem

 

From: Alexandr Scherbatiy 
Sent: Thursday, June 09, 2016 9:06 PM
To: Prem Balakrishnan; Sergey Bylokhov; Rajeev Chamyal; swing-dev at openjdk.java.net
Subject: Re: <Swing Dev> Background is painted taller than needed for superscripted text

 

On 6/8/2016 2:30 PM, Prem Balakrishnan wrote:



Hi,

Please review fix for JDK9,

 

Bug: https://bugs.openjdk.java.net/browse/JDK-8017266 

 

Webrev: HYPERLINK "http://cr.openjdk.java.net/%7Epkbalakr/8017266/webrev.00/"http://cr.openjdk.java.net/~pkbalakr/8017266/webrev.00/ 

 

 

Issue:

Background is painted taller than needed for superscripted text.

 

 

Cause:

Bounds(alloc.height) is used to set the height to fill the actual glyphs boundary

    Why passed shape height is larger that the required superscripted text height?

  Thanks,
  Alexandr.



 

Fix:

Used painter.getHeight() instead of alloc.height to fill the actual glyphs boundary

 

Thanks,

Prem

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20160615/ab10a57d/attachment.html>


More information about the swing-dev mailing list