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

Spacing is incorrect printing Arial 8pt on Windows.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 7
    • client-libs
    • 2d
    • x86
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.7.0"
      Java(TM) SE Runtime Environment (build 1.7.0-b147)
      Java HotSpot(TM) Client VM (build 21.0-b17, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]
      Microsoft Windows [Version 6.1.7600]


      A DESCRIPTION OF THE PROBLEM :
      Spacing is incorrect printing Arial 8pt on Windows.

      REGRESSION. Last worked in version 5.0

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile, run, select printer and print.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      printing printing printing
      ACTUAL -
      printingprintingprinting

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package test;

      import java.awt.*;
      import java.awt.print.*;
      import javax.swing.*;

      public class PrintLabel extends JLabel implements Printable {
      public PrintLabel() {
      // Spacing is incorrect printing Arial 8pt on Windows.
      setFont(new Font("Arial", Font.PLAIN, 8));
      setText("printing printing printing");
      setBounds(10, 10, 200, 10);

              PrinterJob printJob = PrinterJob.getPrinterJob();
      printJob.setPrintable(this);
      if (printJob.printDialog()) {
      try {
      printJob.print();
      System.exit(0);
      } catch (Exception PrintException) {
      PrintException.printStackTrace();
      }
      }
      }

      public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException {
      if (pageIndex == 0) {
      paint(graphics);
      return Printable.PAGE_EXISTS;
      }
      return Printable.NO_SUCH_PAGE;
      }

      public static void main(String [] args) {
      new PrintLabel();
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Unknown

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: