mWriter.println("2 index neg fjy add fsize mul");
mWriter.println("3 -1 roll neg fjy add fsize mul");
	private void writePostScriptHeader(double width, double height,		int resolution, ArrayList fontList)		throws IOException, MapyrusException	{		long widthInPoints = Math.round(width / Constants.MM_PER_INCH *			Constants.POINTS_PER_INCH);		long heightInPoints = Math.round(height / Constants.MM_PER_INCH *			Constants.POINTS_PER_INCH);		mWriter.print("%!PS-Adobe-3.0");		if (mFormatName.equals("eps"))			mWriter.print(" EPSF-3.0");		mWriter.println("");		mWriter.println("%%BoundingBox: 0 0 " + widthInPoints + " " + heightInPoints);		mWriter.println("%%DocumentData: Clean7Bit");		mWriter.println("%%LanguageLevel: 2");		mWriter.println("%%Creator: (" + Constants.PROGRAM_NAME +			" " + Constants.getVersion() + ")");		mWriter.println("%%OperatorMessage: (Printing map...)");		Date now = new Date();		mWriter.println("%%CreationDate: (" + now.toString() + ")");		String username = System.getProperty("user.name");		if (username != null)			mWriter.println("%%For: (" + username + ")");		/*		 * List fonts included in this PostScript file.		 */		mWriter.println("%%DocumentRequiredResources: (atend)");		if (fontList.size() > 0)		{			mWriter.print("%%DocumentSuppliedResources: font");			Iterator it = fontList.iterator();			while (it.hasNext())			{				PostScriptFont psFont = (PostScriptFont)(it.next());				mWriter.print(" " + psFont.getName());				mSuppliedFontResources.add(psFont.getName());			}			mWriter.println("");		}		mWriter.println("%%EndComments");		mWriter.println("");		mWriter.println("% Resolution " + resolution + " DPI");		/*		 * Inline font definitions.		 */		mWriter.println("%%BeginSetup");		Iterator it = fontList.iterator();		while (it.hasNext())		{			PostScriptFont psFont = (PostScriptFont)(it.next());			mWriter.println("%%BeginResource: font " + psFont.getName());			String fontDefinition = psFont.getFontDefinition();			mWriter.println(fontDefinition);			mWriter.println("%%EndResource");					}		mWriter.println("%%EndSetup");		/*		 * Set color and linestyle to reasonable default values.		 * Taken from 'initgraphics' operator example in PostScript Language		 * Reference Manual.		 */		mWriter.println("1 setlinewidth 0 setlinecap 0 setlinejoin");		mWriter.println("[] 0 setdash 0 setgray 10 setmiterlimit");		/*		 * Prevent anything being displayed outside bounding box we've just defined.		 */		mWriter.println("0 0 " + widthInPoints + " " + heightInPoints + " rectclip");		/*		 * Set plotting units to millimetres.		 */		mWriter.println(Constants.POINTS_PER_INCH + " " + Constants.MM_PER_INCH +			" div dup scale");		/*		 * Define shorter names for most commonly used operations.		 * Bind all operators names to improve performance (see 3.11 of		 * PostScript Language Reference Manual).		 */		mWriter.println("/m { moveto } bind def /l { lineto } bind def");		mWriter.println("/s { stroke } bind def /f { fill } bind def");		mWriter.println("/j { /fjy exch def /fjx exch def } bind def");		/*		 * Define font and dictionary entries for font size and justification.		 * Don't bind these as font loading operators may be overridden in interpreter.		 */		mWriter.println("/font { /frot exch radtodeg def");		mWriter.println("/fsize exch def findfont fsize scalefont setfont } def");		mWriter.println("/radtodeg { 180 mul 3.1415629 div } bind def");		/*		 * Draw text string, after setting correct position, rotation,		 * justifying it horizontally and vertically for current font size		 * and shifting it down a number of lines if it is part of a multi-line		 * string.		 *		 * Line number (starting at 0) and string to show are passed to this procedure.		 */		mWriter.println("/t { gsave currentpoint translate frot rotate");		mWriter.println("dup stringwidth pop fjx mul");		mWriter.println("2 index neg fjy add fsize mul");		mWriter.println("rmoveto show grestore newpath } bind def");		mWriter.println("/rgb { setrgbcolor } bind def");		mWriter.println("/sl { setmiterlimit setlinejoin setlinecap");		mWriter.println("setlinewidth } bind def");		/*		 * Use new dictionary in saved state so that variables we define		 * do not overwrite variables in parent state.		 */		mWriter.println("/gs { gsave 4 dict begin } bind def");		mWriter.println("/gr { end grestore } bind def");		mWriter.println("");	}