JDK-8015291 : [macosx] Wrong letters are printed when we draw Japanese and English
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7,7u6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2013-05-23
  • Updated: 2014-11-17
  • Resolved: 2013-05-24
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 8
8Resolved
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version  " 1.7.0_21 " 
Java(TM) SE Runtime Environment (build 1.7.0_21-b12)
Java HotSpot(TM) 64-Bit Server VM (build 23.21-b01, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Mac OS X 10.7.5

A DESCRIPTION OF THE PROBLEM :
Wrong letters are printed when we draw Japanese and English on Mac.  " :abc123 "  is printed as  " >cde345 " .
We can see this problem when we print the drawn String by graphics.drawString(AttributedStringIterator)

REGRESSION.  Last worked in version 6u45

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the program to test
2. Print dialog is shown
3. Push the [Print] button
4. Check the output

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
 " ???:abc123 "  should be printed.
ACTUAL -
 " ???<cde345 "  is printed.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.font.TextAttribute; import java.awt.print.PageFormat;
import java.awt.print.Printable;
import java.awt.print.PrinterException; import java.awt.print.PrinterJob; import java.text.AttributedString;
import javax.swing.SwingUtilities;

public class PrintTest2 implements Printable {
    public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException {
        if (pageIndex > 1) {
            return Printable.NO_SUCH_PAGE;
        }

        Graphics2D g2 = (Graphics2D) g;
        g2.translate((int) pf.getImageableX(), (int) pf.getImageableY());
        AttributedString attrString = new AttributedString( " ???:abc123 " );
        attrString.addAttribute(TextAttribute.FONT, new Font(Font.SERIF, Font.PLAIN, 48));
        g2.drawString(attrString.getIterator(), 20f, 60f);
        return Printable.PAGE_EXISTS;
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    PrinterJob job = PrinterJob.getPrinterJob();
                    PrintTest2 printable = new PrintTest2();
                    job.setPrintable(printable);
                    if (job.printDialog()) {
                        job.print();
                    }
                } catch (PrinterException e) {
                    e.printStackTrace();
                }
            }
        });
    }
}

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

CUSTOMER SUBMITTED WORKAROUND :
We can avoid this bug if we use Java standard printing dialog.
But the OS native printing dialog is better because that has a function to export PDF.
Comments
is it 2D issue?
24-05-2013