<Swing Dev> [8] Review request for 8023392: Swing text components printed with spaces between chars

anton nashatyrev anton.nashatyrev at oracle.com
Thu Aug 22 11:57:17 UTC 2013


Hello,
     could you please review the following fix:

fix: http://cr.openjdk.java.net/~vkarnauk/8023392/jdk8/webrev.00/ 
<http://cr.openjdk.java.net/%7Evkarnauk/8023392/jdk8/webrev.00/>
bug: http://bugs.sun.com/view_bug.do?bug_id=80223392 (the bug is still 
not replicated here, so internal link might be used if available)

     The problem description: While printing the text output is handled 
a bit differently: the text layout is justified for the text width (in 
theory on the screen this text should look identically as without 
justification), which helps printer to output text more evenly 
(https://bugs.openjdk.java.net/browse/JDK-6488219).
     But the problem is the TextLayout.getJustifiedLayout() trim the 
trailing spaces from the string before laying it out. In the case when 
the string contains trailing spaces it is justified for the width 
greater than required.

     The fix description: as far as we likely don't want to change 
TextLayout.getJustifiedLayout() behavior, we should respect that 
implementation feature and justify the text for the width of the string 
without trailing spaces. I.e. trim trailing spaces before 
TextLayout.getAdvance().

Thanks!
Anton.



More information about the swing-dev mailing list