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

Java 2 : 1.1 printing API on Solaris : text always prints using Courier

XMLWordPrintable

    • 2d
    • beta
    • x86, sparc
    • solaris_7, solaris_8

      import java.awt.*;

      public class PrintText {

        static public void main(String[] args) {

          Frame f = new Frame("test");
          f.pack();

          PrintJob pj = f.getToolkit().getPrintJob(f, "print1", null);
       
          if (pj != null) {
            String s = "abcdefghijklmnopqrstuvwxyzABCEFGHIJKLMNOPQRSTUVWXYZ1234567890";
            int yoffset = 50;

            Graphics g = pj.getGraphics();

            g.setFont(new Font("Serif",Font.PLAIN,14));
            g.drawString("Serif: " +s,10,yoffset);
            yoffset+=100;

            g.setFont(new Font("SansSerif",Font.PLAIN,14));
            g.drawString("SansSerif: "+s,10,yoffset);
            yoffset+=100;

            g.setFont(new Font("Dialog",Font.PLAIN,14));
            g.drawString("Dialog: "+s,10,yoffset);
            yoffset+=100;

            g.setFont(new Font("DialogInput",Font.PLAIN,14));
            g.drawString("DialogInput: "+ s,10,yoffset);
            yoffset+=100;
       
            g.setFont(new Font("MonoSpaced",Font.PLAIN,14));
            g.drawString("MonoSpaced: "+ s,10,yoffset);
            yoffset+=100;

            g.setFont(new Font("Courier",Font.PLAIN,14));
            g.drawString("Courier: "+s,10,yoffset);
            yoffset+=100;
       
            g.dispose();
       
            pj.end();
          }
        }
      }
      Using the 1.1(AWT) printing API on Java 2 (1.2, 1.2,2) on Solaris, text
      in component labels and text drawn using Graphics.drawString always appears
      as "Courier" even though the font is set to "Serif" or "SanSerif".

      Test case below ..

            prr Philip Race
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: