if (printOptions.printLineNumbers) { printMargin = 3 * printerDPI.x / screenDPI.x; }
	void cacheLineData(StyledText styledText) {		StyledTextRenderer renderer = styledText.renderer;		renderer.copyInto(printerRenderer);		fontData = styledText.getFont().getFontData()[0];		tabLength = styledText.tabLength;		int lineCount = printerRenderer.lineCount;		if (styledText.isListening(LineGetBackground) || (styledText.isBidi() && styledText.isListening(LineGetSegments)) || styledText.isListening(LineGetStyle)) {			StyledTextContent content = printerRenderer.content;			for (int i = 0; i < lineCount; i++) {				String line = content.getLine(i);				int lineOffset = content.getOffsetAtLine(i);				StyledTextEvent event = styledText.getLineBackgroundData(lineOffset, line);				if (event != null && event.lineBackground != null) {					printerRenderer.setLineBackground(i, 1, event.lineBackground);				}				if (styledText.isBidi()) {					int[] segments = styledText.getBidiSegments(lineOffset, line);					printerRenderer.setLineSegments(i, 1, segments);				}							event = styledText.getLineStyleData(lineOffset, line);				if (event != null) {					printerRenderer.setLineIndent(i, 1, event.indent);					printerRenderer.setLineAlignment(i, 1, event.alignment);					printerRenderer.setLineJustify(i, 1, event.justify);					printerRenderer.setLineBullet(i, 1, event.bullet);					StyleRange[] styles = event.styles;					if (styles != null && styles.length > 0) {						printerRenderer.setStyleRanges(event.ranges, styles);					}				}			}		}		Point screenDPI = styledText.getDisplay().getDPI();		Point printerDPI = printer.getDPI();		resources = new Hashtable ();		for (int i = 0; i < lineCount; i++) {			Color color = printerRenderer.getLineBackground(i, null);			if (color != null) {				if (printOptions.printLineBackground) {					Color printerColor = (Color)resources.get(color);					if (printerColor == null) {						printerColor = new Color (printer, color.getRGB());						resources.put(color, printerColor); 					}					printerRenderer.setLineBackground(i, 1, printerColor);				} else {					printerRenderer.setLineBackground(i, 1, null);				}			}			int indent = printerRenderer.getLineIndent(i, 0);			if (indent != 0) {				printerRenderer.setLineIndent(i, 1, indent * printerDPI.x / screenDPI.x);			}		}		StyleRange[] styles = printerRenderer.styles;		for (int i = 0; i < printerRenderer.styleCount; i++) {			StyleRange style = styles[i];			Font font = style.font;			if (style.font != null) {				Font printerFont = (Font)resources.get(font);				if (printerFont == null) {					printerFont = new Font (printer, font.getFontData());					resources.put(font, printerFont);									}				style.font = printerFont;			}			Color color = style.foreground;			if (color != null) {				Color printerColor = (Color)resources.get(color);				if (printOptions.printTextForeground) {					if (printerColor == null) {						printerColor = new Color (printer, color.getRGB());						resources.put(color, printerColor); 					}					style.foreground = printerColor;				} else {					style.foreground = null;				}			}			color = style.background;			if (color != null) {				Color printerColor = (Color)resources.get(color);				if (printOptions.printTextBackground) {					if (printerColor == null) {						printerColor = new Color (printer, color.getRGB());						resources.put(color, printerColor); 					}					style.background = printerColor;				} else {					style.background = null;				}			}			if (!printOptions.printTextFontStyle) {				style.fontStyle = SWT.NORMAL;			}			style.rise = style.rise * printerDPI.y / screenDPI.y;			GlyphMetrics metrics = style.metrics;			if (metrics != null) {				metrics.ascent = metrics.ascent * printerDPI.y / screenDPI.y;				metrics.descent = metrics.descent * printerDPI.y / screenDPI.y;				metrics.width = metrics.width * printerDPI.x / screenDPI.x;			}		}		lineSpacing = styledText.lineSpacing * printerDPI.y / screenDPI.y;	}