Hi All,

Please review a fix for an issue where it is seen that a string beginning with multiple whitespaces is displayed properly in Swing
component.

However, when printing, the start position of the line changes.

Basically,in SwingUtilities#drawString(), during printing,
 we calculate the screenWidth, obtain a TextLayout with advances for printer graphics FontRenderContext and then justify it to fit the entire width of screen. It is seen that this justification of textlayout through TextLayout.getJustifiedLayout(screenWidth) is aligning the printed text wrongly.

Proposed fix is to check if we need text layouting for printing too as it is done for swing text drawing on console. If we need text layouting, then only use textlayout justification.

Bug: https://bugs.openjdk.java.net/browse/JDK-8214702
webrev: http://cr.openjdk.java.net/~psadhukhan/8214702/webrev.0/

Regards
Prasanta

Reply via email to