FontData fontData = text.getFont().getFontData()[0]; printerFont = new Font(printer, fontData.getName(), fontData.getHeight(), fontData.getStyle());
	void print(Printer printer) {		if (printer.startJob("Text")) {   // the string is the job name - shows up in the printer's job list			Rectangle clientArea = printer.getClientArea();			Rectangle trim = printer.computeTrim(0, 0, 0, 0);			Point dpi = printer.getDPI();			leftMargin = dpi.x + trim.x; // one inch from left side of paper			rightMargin = clientArea.width - dpi.x + trim.x + trim.width; // one inch from right side of paper			topMargin = dpi.y + trim.y; // one inch from top edge of paper			bottomMargin = clientArea.height - dpi.y + trim.y + trim.height; // one inch from bottom edge of paper						/* Create a buffer for computing tab width. */			int tabSize = 4; // is tab width a user setting in your UI?			StringBuffer tabBuffer = new StringBuffer(tabSize);			for (int i = 0; i < tabSize; i++) tabBuffer.append(' ');			tabs = tabBuffer.toString();			/* Create printer GC, and create and set the printer font & foreground color. */			gc = new GC(printer);						FontData fontData = text.getFont().getFontData()[0];			printerFont = new Font(printer, fontData.getName(), fontData.getHeight(), fontData.getStyle());			gc.setFont(printerFont);			tabWidth = gc.stringExtent(tabs).x;			lineHeight = gc.getFontMetrics().getHeight();						RGB rgb = text.getForeground().getRGB();			printerForegroundColor = new Color(printer, rgb);			gc.setForeground(printerForegroundColor);					rgb = text.getBackground().getRGB();			printerBackgroundColor = new Color(printer, rgb);			gc.setBackground(printerBackgroundColor);					/* Print text to current gc using word wrap */			printText();			printer.endJob();			/* Cleanup graphics resources used in printing */			printerFont.dispose();			printerForegroundColor.dispose();			printerBackgroundColor.dispose();			gc.dispose();		}	}