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

Brackets should be quoted in Postscript output on Linux systems.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.3.1
    • 1.3.0
    • client-libs
    • 2d
    • rc1
    • x86
    • linux



        Name: boT120536 Date: 12/19/2000


        java version "1.3.0beta_refresh"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta_refresh-b09)
        Java HotSpot(TM) Client VM (build 1.3.0beta-b07, mixed mode)

        When running the following sample code on the Linux operating system, brackets
        which appear in text being printed (Postscript) don't get quoted. On Windows
        systems with a standard Adobe Postscript driver they get quoted: \(.
        As a result, Postscript interpreters (I tried an IBM NetworkPrinter 17 and gv
        (Linux) and ghostview (Windows)) can't interpret the page, at least when there
        is only an opening bracket but no closing bracket.
        I've included the Postscript output, too; the offending line is the last but
        fourth line.

        /*****************************************************************/
        package bugtest;

        import javax.swing.UIManager;
        import java.awt.*;
        import javax.swing.JPanel;
        import javax.swing.*;
        import java.awt.*;
        import java.awt.print.*;
        import java.awt.event.*;


        public class bugtestapp
        {
        boolean packFrame = false;

          public bugtestapp()
        {
        Frame2 frame = new Frame2();
        if (packFrame)
        frame.pack();
        else
        frame.validate();
        frame.setVisible(true);
        }

          public static void main(String[] args)
        {
        try
        {
        UIManager.setLookAndFeel
        (UIManager.getSystemLookAndFeelClassName());
        }
        catch(Exception e)
        {
        }
        new bugtestapp();
        }

        }


        class Frame2 extends JFrame
        implements Printable
        {
        JButton jButton1 = new JButton();
        Panel1 jPanel1 = new Panel1();
        FlowLayout flowLayout1 = new FlowLayout();

        public Frame2()
        {
        try
        {
        jbInit();
        }
        catch(Exception e)
        {
        e.printStackTrace();
        }
        }

          public int print(Graphics g, PageFormat pageFormat, int pageIndex)
           throws PrinterException
          {
           Graphics2D g2 = (Graphics2D) g;
            
            jPanel1.paintComponent(g);
            return PAGE_EXISTS;
          }

        private void jbInit() throws Exception
        {
        jButton1.setText("Print");
        jButton1.addActionListener(new java.awt.event.ActionListener()
        {

        public void actionPerformed(ActionEvent e)
        {
        jButton1_actionPerformed(e);
        }
        });
        this.setContentPane(jPanel1);
        this.setTitle("Test");
        jPanel1.setMinimumSize(new Dimension(300, 200));
        jPanel1.setPreferredSize(new Dimension(300, 200));
        jPanel1.setLayout(flowLayout1);
        jPanel1.add(jButton1, null);
        }

        void jButton1_actionPerformed(ActionEvent e)
        {
           PrinterJob pj = PrinterJob.getPrinterJob();

        if (!pj.printDialog())
             return;
            Book bk = new Book();
            bk.append(this, pj.defaultPage(), 1);
        pj.setPageable(bk);
            try {pj.print();} catch (Exception ex) {}


        }

        }

        class Panel1 extends JPanel
        {
        BorderLayout borderLayout1 = new BorderLayout();

        public Panel1()
        {
        try
        {
        jbInit();
        }
        catch(Exception ex)
        {
        ex.printStackTrace();
        }
        }

        private void jbInit() throws Exception
        {
        this.setLayout(borderLayout1);
        }

          public void paintComponent(java.awt.Graphics g)
          {
           super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;

            g2.setColor(Color.black);
           g2.drawString("Test (...", 100, 100);
          }
        }


        /******************************************************/

        %!PS-Adobe-3.0
        %%BeginProlog
        /imStr 0 def /heximageSrc{currentfile imStr readhexstring pop} def
        /BD {bind def} bind def
        /D {def} BD
        /ISOF {
             dup findfont dup length 1 add dict begin {
                     1 index /FID eq {pop pop} {D} ifelse
             } forall /Encoding ISOLatin1Encoding D
             currentdict end definefont
        } BD
        /NZ {dup 1 lt {pop 1} if} BD
        /DS {
             moveto 1 index stringwidth pop NZ sub
             1 index length 1 sub NZ div 0
             3 2 roll ashow newpath} BD
        /F [
         /Helvetica ISOF
         /Helvetica-Bold ISOF
         /Helvetica-Oblique ISOF
         /Helvetica-BoldOblique ISOF
         /Times-Roman ISOF
         /Times-Bold ISOF
         /Times-Italic ISOF
         /Times-BoldItalic ISOF
         /Courier ISOF
         /Courier-Bold ISOF
         /Courier-Oblique ISOF
         /Courier-BoldOblique ISOF
        ] D
        /SF {
             F exch get exch scalefont setfont
         (abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890) stringwidth
        pop div
             currentfont [1 0 0 -1 0 0]makefont exch scalefont setfont} BD
        %%EndProlog
        %%BeginSetup
        1/#copies exch def
        %%EndSetup
        %%Page: 1 1
        /pgSave save def
        792.0 0 exch translate 1 -1 scale[72 300 div 0 0 72 300 div 0 0]concat
        0.8 setgray
        gsave
        [4.166666666666667 0.0 0.0 4.166666666666667 -0.0 -0.0] concat
        newpath
        72.0 72.0 moveto
        540.0 72.0 lineto
        540.0 720.0 lineto
        72.0 720.0 lineto
        72.0 72.0 lineto
        closepath
        clip
        newpath
        0.0 0.0 moveto
        458.0 0.0 lineto
        458.0 277.0 lineto
        0.0 277.0 lineto
        0.0 0.0 lineto
        closepath
        fill
        0.0 setgray
        % Font[dialog, 0, 12]
        481 12 0 SF
        100.0 100.0 moveto(Test (...)show
        pgSave restore
        showpage
        %%EOF
        (Review ID: 108600)
        ======================================================================

              prr Philip Race
              bonealsunw Bret O'neal (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: