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

Alexandr Scherbatiy alexandr.scherbatiy at oracle.com
Thu Jun 16 09:24:08 UTC 2016


  - Could you add the bug id to the email subject?
  - Before the fix the superscript background color was filled till the 
previous line.
    After the fix there is a gap between the line above and the 
superscripted text.
    See the screenshots:
http://cr.openjdk.java.net/~alexsch/8017266/superscript-before-fix.png
http://cr.openjdk.java.net/~alexsch/8017266/superscript-after-fix.png

   Is it an intended behavior?

   Thanks,
   Alexandr.

On 6/15/2016 10:18 AM, Prem Balakrishnan wrote:
>
> 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:* http://cr.openjdk.java.net/~pkbalakr/8017266/webrev.00/ 
> <http://cr.openjdk.java.net/%7Epkbalakr/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/20160616/1776a306/attachment.html>


More information about the swing-dev mailing list