// Path: src/java/org/getopt/pcl5/IPrint.java
// public interface IPrint {
//   /**
//    * Called when new page
//    * 
//    */
//   void newPage();
// 
//   /**
//    * Called when page size changed
//    * 
//    * @param w
//    *          New width of page, in 72 DPI
//    * @param h
//    *          New height of page, in 72 DPI
//    */
//   void pageSize(float w, float h);
// 
//   /**
//    * Called after every margins change and after each new page
//    * 
//    * @param top
//    *          top margin, in 72 DPI
//    * @param bottom
//    *          bottom margin, in 72 DPI
//    * @param left
//    *          left margin, in 72 DPI
//    * @param right
//    *          right margin, in 72 DPI
//    */
//   void newMargins(float top, float bottom, float left, float right);
// 
//   /**
//    * Called on beginning of processing, before any other method from this
//    * interface is called
//    * 
//    */
//   void processingStart();
// 
//   /**
//    * Called on end of processing, after last method from this interface was
//    * called
//    * 
//    */
//   void processingEnd();
// 
//   /**
//    * Called when text should be printed, text is limited to end of line (CR) or
//    * to change in pronter state (ie font)
//    * 
//    * @param x
//    *          Print location X in 72 DPI
//    * @param y
//    *          Print location Y in 72 DPI
//    * @param w
//    *          Width of text (bound box) in 72 DPI
//    * @param h
//    *          Height of text in (bound box) 72 DPI
//    * @param text
//    *          Text to print
//    * @param state
//    *          Interface to query state of printer
//    */
//   void printText(float x, float y, float w, float h, String text,
//           int[] kerning, IPrinterState state);
// 
//   /**
//    * Called when bitmap should be printed, bitmap is always complete method is
//    * called when graphics mode is terminated
//    * 
//    * @param x
//    *          X location of image in 72 DPI
//    * @param y
//    *          Y location of image in 72 DPI
//    * @param w
//    *          Width of bitmap in (bound box) 72 DPI
//    * @param h
//    *          Height of bitmap in (bound box) 72 DPI
//    * @param image
//    *          Image for output
//    * @param state
//    *          Interface to query state of printer
//    */
//   void printBitmap(float x, float y, float w, float h, BufferedImage image,
//           IPrinterState state);
// 
//   /**
//    * Called on condition like command without meaning for interpreter like BEL
//    * 
//    * @param command
//    *          class
//    * @param message
//    *          command name
//    */
//   void trace(Object command, String message);
// 
//   /**
//    * Called when command parameters are incorrect ie out of range
//    * 
//    * @param command
//    *          class that detected problem
//    * @param message
//    *          kind of problem
//    */
//   void assertCondition(Object command, String message);
// 
//   /**
//    * Called when found command that shouldn't be implemented ie CAN Cancel line
//    * 
//    * @param command
//    *          class that detected problem
//    * @param message
//    *          kind of problem
//    */
//   void notImplemented(Object command, String message);
// }
// 
// Path: src/java/org/getopt/pcl5/IPrinterState.java
// public interface IPrinterState {
//   /**
//    * Returns current font used by printer. <b>Do not cache this value.<b>
//    * 
//    * @return current Font class
//    */
//   Font getFont();
// 
//   /**
//    * Returns current font attributes
//    * 
//    * @return current font attribute
//    */
//   Map getFontAttributes();
// 
//   /**
//    * Return current color used by printer <b>Do not cache this value.<b>
//    * 
//    * @return Current color
//    */
//   Color getCurrentColor();
// 
//   /**
//    * Return true is printer has selected condensed font
//    * 
//    * @return condensed printer state
//    */
//   boolean isCondensed();
// 
//   int getUnderliningMode();
// }


import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import org.getopt.pcl5.IPrint;
import org.getopt.pcl5.IPrinterState;

/*
 * Created on 2004-09-12
 *
 */




/**
 * @author Piotrm
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class TextRasterizer implements IPrint  
{
	private PrintWriter writer;
	
	public TextRasterizer(PrintWriter wr)
	{
		writer = wr;
	}

	public void pageSize(float w, float h)
	{
		writer.println("New page size: [" + w + ", " + h + "]");
	}


// Path: src/java/org/getopt/pcl5/IPrint.java
// public interface IPrint {
//   /**
//    * Called when new page
//    * 
//    */
//   void newPage();
// 
//   /**
//    * Called when page size changed
//    * 
//    * @param w
//    *          New width of page, in 72 DPI
//    * @param h
//    *          New height of page, in 72 DPI
//    */
//   void pageSize(float w, float h);
// 
//   /**
//    * Called after every margins change and after each new page
//    * 
//    * @param top
//    *          top margin, in 72 DPI
//    * @param bottom
//    *          bottom margin, in 72 DPI
//    * @param left
//    *          left margin, in 72 DPI
//    * @param right
//    *          right margin, in 72 DPI
//    */
//   void newMargins(float top, float bottom, float left, float right);
// 
//   /**
//    * Called on beginning of processing, before any other method from this
//    * interface is called
//    * 
//    */
//   void processingStart();
// 
//   /**
//    * Called on end of processing, after last method from this interface was
//    * called
//    * 
//    */
//   void processingEnd();
// 
//   /**
//    * Called when text should be printed, text is limited to end of line (CR) or
//    * to change in pronter state (ie font)
//    * 
//    * @param x
//    *          Print location X in 72 DPI
//    * @param y
//    *          Print location Y in 72 DPI
//    * @param w
//    *          Width of text (bound box) in 72 DPI
//    * @param h
//    *          Height of text in (bound box) 72 DPI
//    * @param text
//    *          Text to print
//    * @param state
//    *          Interface to query state of printer
//    */
//   void printText(float x, float y, float w, float h, String text,
//           int[] kerning, IPrinterState state);
// 
//   /**
//    * Called when bitmap should be printed, bitmap is always complete method is
//    * called when graphics mode is terminated
//    * 
//    * @param x
//    *          X location of image in 72 DPI
//    * @param y
//    *          Y location of image in 72 DPI
//    * @param w
//    *          Width of bitmap in (bound box) 72 DPI
//    * @param h
//    *          Height of bitmap in (bound box) 72 DPI
//    * @param image
//    *          Image for output
//    * @param state
//    *          Interface to query state of printer
//    */
//   void printBitmap(float x, float y, float w, float h, BufferedImage image,
//           IPrinterState state);
// 
//   /**
//    * Called on condition like command without meaning for interpreter like BEL
//    * 
//    * @param command
//    *          class
//    * @param message
//    *          command name
//    */
//   void trace(Object command, String message);
// 
//   /**
//    * Called when command parameters are incorrect ie out of range
//    * 
//    * @param command
//    *          class that detected problem
//    * @param message
//    *          kind of problem
//    */
//   void assertCondition(Object command, String message);
// 
//   /**
//    * Called when found command that shouldn't be implemented ie CAN Cancel line
//    * 
//    * @param command
//    *          class that detected problem
//    * @param message
//    *          kind of problem
//    */
//   void notImplemented(Object command, String message);
// }
// 
// Path: src/java/org/getopt/pcl5/IPrinterState.java
// public interface IPrinterState {
//   /**
//    * Returns current font used by printer. <b>Do not cache this value.<b>
//    * 
//    * @return current Font class
//    */
//   Font getFont();
// 
//   /**
//    * Returns current font attributes
//    * 
//    * @return current font attribute
//    */
//   Map getFontAttributes();
// 
//   /**
//    * Return current color used by printer <b>Do not cache this value.<b>
//    * 
//    * @return Current color
//    */
//   Color getCurrentColor();
// 
//   /**
//    * Return true is printer has selected condensed font
//    * 
//    * @return condensed printer state
//    */
//   boolean isCondensed();
// 
//   int getUnderliningMode();
// }


// Path: src/gui/TextRasterizer.java
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import org.getopt.pcl5.IPrint;
import org.getopt.pcl5.IPrinterState;

/*
 * Created on 2004-09-12
 *
 */




/**
 * @author Piotrm
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class TextRasterizer implements IPrint  
{
	private PrintWriter writer;
	
	public TextRasterizer(PrintWriter wr)
	{
		writer = wr;
	}

	public void pageSize(float w, float h)
	{
		writer.println("New page size: [" + w + ", " + h + "]");
	}


	public void printText(float x, float y, float w, float h, String text, int[] kerning, IPrinterState state)
