// Copyright 2001, FreeHEP.
package org.freehep.graphicsio.emf.gdi;
import java.io.IOException;
import org.freehep.graphicsio.emf.EMFInputStream;
import org.freehep.graphicsio.emf.EMFOutputStream;
import org.freehep.graphicsio.emf.EMFTag;
import org.freehep.graphicsio.emf.EMFRenderer;
/**
* ExtCreateFontIndirectW TAG.
*
* @author Mark Donszelmann
* @version $Id: freehep-graphicsio-emf/src/main/java/org/freehep/graphicsio/emf/gdi/ExtCreateFontIndirectW.java c0f15e7696d3 2007/01/22 19:26:48 duns $
*/
public class ExtCreateFontIndirectW extends EMFTag {
private int index;
private ExtLogFontW font;
public ExtCreateFontIndirectW() {
super(82, 1);
}
public ExtCreateFontIndirectW(int index, ExtLogFontW font) {
this();
this.index = index;
this.font = font;
}
public EMFTag read(int tagID, EMFInputStream emf, int len)
throws IOException {
return new ExtCreateFontIndirectW(
emf.readDWORD(),
new ExtLogFontW(emf));
}
public void write(int tagID, EMFOutputStream emf) throws IOException {
emf.writeDWORD(index);
font.write(emf);
}
public String toString() {
return super.toString() +
"\n index: 0x" + Integer.toHexString(index) +
"\n" + font.toString();
}
/**
* displays the tag using the renderer
*
* @param renderer EMFRenderer storing the drawing session data
*/
public void render(EMFRenderer renderer) {
renderer.storeGDIObject(index, font);
}
}