JDK-8039468 : [macosx] Problems when rendering Thai texts on OS X 10.9 Mavericks
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7u45
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: os_x
  • Submitted: 2014-01-07
  • Updated: 2021-07-08
  • Resolved: 2021-07-08
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.
Other
tbdResolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
1.7.0_45
1.8.0-ea-b121
1.7.0_60-ea-b02

ADDITIONAL OS VERSION INFORMATION :
ProductName: Mac OS X, ProductVersion: 10.9.1, BuildVersion:   13B42

A DESCRIPTION OF THE PROBLEM :
Rendering diacritic characters in Thai texts does not work in DIALOG-Font, SANS_SERIF-Font and several other fonts, when running on OS X 10.9.
 

ADDITIONAL REGRESSION INFORMATION:
Works on OS X 10.8.5 (Mountain Lion) with same JVM


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
create a Java application with a TextArea or TextField and paste a Thai text into the field.
You can use the URL "http://translate.google.com/#auto/th/ABCD%20you%20are%20the%20greatest" for this.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should render correct diacritic characters
ACTUAL -
Diacritic characters are rendered as separate character.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.JTextField;

public class ThaiText
    implements ActionListener
{
    JTextField textField;
    JTextArea textArea;

    public ThaiText()
    {
        JFrame frame = new JFrame("ThaiText <"+System.getProperty("java.runtime.version")+">");
        
        // create a text fiels and a text area
        textField = new JTextField(30);
        frame.add(textField, BorderLayout.NORTH);
        
        textArea =  new JTextArea(10, 30);
        frame.add(textArea, BorderLayout.CENTER);
        
        // create a font list
        String[] action = new String[]
                {
                    "Lucida Grande",    // Error
                    Font.DIALOG,        // Error
                    Font.SANS_SERIF,    // Error
                    Font.MONOSPACED,    // OK
                    "Ayuthaya",         // OK
                    "Thonburi",         // Error
                };
        JComboBox<String> combo = new JComboBox<String>(action);
        combo.setSelectedIndex(0);
        combo.addActionListener(this);
        frame.add(combo, BorderLayout.SOUTH);

        // set a THAI text
        // you can use url "http://translate.google.com/#auto/th/ABCD%20you%20are%20the%20greatest"
        // to create it too
        String text = "ABCD ????????????????????????????????????????????????????????????????????????";
        textField.setText(text);
        textArea.setText(text);
        
        System.err.println("ThaiText.ThaiText() Initial Font: "+textField.getFont());
        frame.pack();
        frame.setVisible(true);
    }
    
    @Override
    public void actionPerformed(ActionEvent e)
    {
        String fontName = (String)((JComboBox)e.getSource()).getSelectedItem();
        
        Font font = Font.decode(fontName);
        if(font==null)
        {
            System.err.println("ERROR ThaiText.actionPerformed() font == null");
            return;
        }
        textArea.setFont(font);
        textField.setFont(font);
        
        // just to see the font type etc.
        textArea.setToolTipText(font.toString());
        textField.setToolTipText(font.toString());
    }
    
    private static void createAndShowGUI()
    {
        new ThaiText();
    }
    
    public static void main(String[] args)
    {
        javax.swing.SwingUtilities.invokeLater(new Runnable()
        {
            public void run()
            {
                createAndShowGUI();
            }
        });
    }

}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Use MONOSPACED font or "Ayuthaya"-font
Comments
This seems to work fine with harfbuzz
08-07-2021

The Rampdown phase start [1] milestone is approaching, it means we are not targeting "9" to fix P4s anymore, unless the fix is ready and not risky, safe enough not introduce P2-P3 regressions; if this is a case you can retarget back to "9" right before the push the reviewed code. [1] http://openjdk.java.net/projects/jdk8/milestones#Rampdown_start
29-08-2016

I do not have time to check this right now but it could be related to https://bugs.openjdk.java.net/browse/JDK-8139741 and if there is something about the font that is a problem perhaps harfbuzz will help.
12-11-2015

Since the JDK didn't change, sounds like an O/S incompatibility. I don't have mavericks so I can't even try this.
08-04-2014

is it reproducible on 8 ?
08-04-2014