-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
6-pool
-
generic
-
generic
In the sample printing example "PaginationExample.java" referenced here:
http://download.oracle.com/javase/tutorial/2d/printing/set.html
with source code here:
http://download.oracle.com/javase/tutorial/2d/printing/examples/PaginationExample.java
You are creating a Font, and obtaining metrics on that Font, which affects the pagination of the printed output, but you do not actually *set* the Font on the Graphics context.
You may have been making an assumption on the default Font, but that assumption will not always be correct; it's certainly not when running this example on Mac OS.
The fix is simple. In the print() method, simply add
g.setFont(font);
before you call drawString().
Perhaps right after you create the font:
Font font = new Font("Serif", Font.PLAIN, 10);
g.setFont(font);
http://download.oracle.com/javase/tutorial/2d/printing/set.html
with source code here:
http://download.oracle.com/javase/tutorial/2d/printing/examples/PaginationExample.java
You are creating a Font, and obtaining metrics on that Font, which affects the pagination of the printed output, but you do not actually *set* the Font on the Graphics context.
You may have been making an assumption on the default Font, but that assumption will not always be correct; it's certainly not when running this example on Mac OS.
The fix is simple. In the print() method, simply add
g.setFont(font);
before you call drawString().
Perhaps right after you create the font:
Font font = new Font("Serif", Font.PLAIN, 10);
g.setFont(font);