Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8011167

[macosx] Application prints single font/single size, suppose to print several font types and sizes [Regression]

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • 7u40
    • 7u15, 7u17
    • deploy
    • 7u17

    • other
    • os_x

      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

            ddehaven David Dehaven (Inactive)
            sharehma Shakeel Rehman (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: