hi everyone,
i want to know how to change the font to "Draft 10cpi" to print to a printer. i am using Epson LX - 1050 a dot matrix printer. and font draft 10cpi is used because of its speed in printing.
i have done this.
public int print(Graphics g, PageFormat pf, int page) throws
PrinterException {
if (page > 0) { /* We have only one page, and 'page' is zero-based */
return NO_SUCH_PAGE;
}
/* User (0,0) is typically outside the imageable area, so we must
* translate by the X and Y values in the PageFormat to avoid clipping
*/
Graphics2D g2d = (Graphics2D)g;
g2d.translate(pf.getImageableX(), pf.getImageableY());
/* Now we perform our rendering */
g.setFont(new Font("Draft 10cpi",Font.PLAIN,12));
g.drawString("Hello world!", 100, 100);
/* tell the caller that this page is part of the printed document */
return PAGE_EXISTS;
}
but it seems the result is not what i expected.
the font printed is not in Draft 10cpi.
please help...
thank you.
killuasoft