JDK-8011167 : [macosx] Application prints single font/single size, suppose to print several font types and sizes [Regression]
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 7u15,7u17
  • Priority: P2
  • Status: Resolved
  • Resolution: Duplicate
  • OS: os_x
  • CPU: other
  • Submitted: 2013-04-01
  • Updated: 2013-06-25
  • Resolved: 2013-04-10
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 Availabitlity Release.

To download the current JDK release, click here.
JDK 7
7u40Resolved
Description
Java version: Print error occurs with this OS and java version.
Java 1.7.0 Update 17 (build 1.7.0_17-b02) Also fails on 1.7.0 Update 15.

Last version it worked in: Print works with this OS and java version
Mac OS X 10.6.8
Java 1.6.0_43-b01-447

OS: Mac OS X 10.7.5

Applet Name: Simple Print

Bug description: 
This problem is platform specific MAC OS X running Java 1.7.
Print error occurs with this OS and java version.
Mac OS X 10.7.5
Java 1.7.0 Update 17 (build 1.7.0_17-b02)   Also fails on 1.7.0 Update 15.
This is a print "font" problem".  We have very simple print program (Attached) using different font sizes, the hard copy print will use a single font in one size, ignoring the fonts the app is programmed to use.
Problem happens every time.  If you take 2 classes attached and build a signed applet, you will see the problem.
This is a problem only in the MAC OS environment 10.7.5 using Java 1.7 (see above). Earlier versions work fine.
Note: Other printed information like lines and bar codes are correct.
Note: Java console show no errors.

Steps to reproduce:
build a signed applet - 2 files - 2 java classes and an html launch file.
-------------------
package exc.fe;
import java.applet.*;
import java.awt.print.*;

public class SimplePrint extends Applet
{
  public void start()
  {
    PrinterJob pj=PrinterJob.getPrinterJob();
    pj.setPrintable(new PrintTest());

    if(pj.printDialog())
    {
      try
      {
        pj.print();
      }
      catch(PrinterException e)
      {
        System.out.println(e);
      }
    }
  }
} // end of class
----------------------------------------
package exc.fe;
import java.awt.print.*;
import java.awt.*;
public class PrintTest implements Printable
{
  public int print(Graphics g,PageFormat pf,int pageIndex)
  {
    if(pageIndex!=0)
    {
      return NO_SUCH_PAGE;
    }
    Graphics2D g2=(Graphics2D)g;
    int y=100;
    float size;
    Font sf=g2.getFont();
    for(int i=0;i<10;++i)
    {
      g2.drawString("Hello 1111 world! Java Source and Support",100,y);
      size=sf.getSize2D();
      size+=2;
      sf=sf.deriveFont(size);
      System.out.println("font name="+sf.getName()+" size="+sf.getSize());
      g2.setFont(sf);
      y+=30;
    }
    return PAGE_EXISTS;
  }
}
------------------------------------
<html>
<head>
<title>IBM Global Expense Reporting Solutions</title>
</head>
<body>
<APPLET mayscript code="exc.fe.SimplePrint.class" align="baseline" width="0" height="0">
<param  name="archive"          value="exc.jar">
</APPLET>
</body>
</html>

Reproduced by Java.com team: No

Error message/Java console output:
Java Plug-in 10.17.2.02
Using JRE version 1.7.0_17-b02 Java HotSpot(TM) 64-Bit Server VM
User home directory = /Users/rrgreco
----------------------------------------------------
c:   clear console window
f:   finalize objects on finalization queue
g:   garbage collect
h:   display this help message
l:   dump classloader list
m:   print memory usage
o:   trigger logging
q:   hide console
r:   reload policy configuration
s:   dump system and deployment properties
t:   dump thread list
v:   dump thread stack
x:   clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------
font name=Dialog size=14
font name=Dialog size=16
font name=Dialog size=18
font name=Dialog size=20
font name=Dialog size=22
font name=Dialog size=24
font name=Dialog size=26
font name=Dialog size=28
font name=Dialog size=30
font name=Dialog size=32
font name=Dialog size=14
font name=Dialog size=16
font name=Dialog size=18
font name=Dialog size=20
font name=Dialog size=22
font name=Dialog size=24
font name=Dialog size=26
font name=Dialog size=28
font name=Dialog size=30
font name=Dialog size=32
Comments
This has been fixed in 8, I'm checking to see if it was backported to 7. If so it will likely be in an upcoming feature release.
2013-04-10

Do you need any additional information from the user or myself, so we can make a headway with this bug?
2013-04-10

Related OTN forum posting: https://forums.oracle.com/forums/thread.jspa?forumID=937&threadID=2518647
2013-04-01