JDK-8158924 : Incorrect i18n text document layout.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2016-06-07
  • Updated: 2016-09-22
  • Resolved: 2016-09-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b137Fixed
Related Reports
Blocks :  
Relates :  
Description
setting i18n property to true for a document brakes the text layout.

Compile and run the next test:

public class I18nTest {
    public static void main(String[] args) throws Exception {
        JFrame jFrame = new JFrame();
        JEditorPane component = new JEditorPane();
        component.setEditorKit(new StyledEditorKit());
        component.getDocument().putProperty("i18n", Boolean.TRUE);
        SimpleAttributeSet attrs = new SimpleAttributeSet();
        StyleConstants.setFontSize(attrs, 72);
        StyleConstants.setBold(attrs, true);
        StyleConstants.setUnderline(attrs, true);
        component.getDocument().insertString(0, "test test", null);
        component.getDocument().insertString(5, "TEST TEST TEST", attrs);
        jFrame.getContentPane().add(new JScrollPane(component));
        jFrame.setSize(300, 500);
        jFrame.setVisible(true);
    }
}

it produces layout shown on the l2.png screenshot, but should look like l1.png.


Comments
This is failing because the lookup array created by ExtendedTextSourceLabel.createCharinfo() to map char indices to glyphs was not as expected. The code was expecting filler glyphs as generated by ICU. the same is also causing the failure of closed/java/awt/font/LineBreakMeasurer/TestLineBreakWithFontSub.java as listed in https://bugs.openjdk.java.net/browse/JDK-8144015
24-08-2016

There seems to be a difference in determining when to insert a line break. Needs some investigation
13-06-2016