| 1 |
// Copyright 2001, FreeHEP. |
| 2 |
package org.freehep.graphicsio.emf.gdi; |
| 3 |
|
| 4 |
import java.io.IOException; |
| 5 |
|
| 6 |
import org.freehep.graphicsio.emf.EMFInputStream; |
| 7 |
import org.freehep.graphicsio.emf.EMFOutputStream; |
| 8 |
import org.freehep.graphicsio.emf.EMFTag; |
| 9 |
import org.freehep.graphicsio.emf.EMFRenderer; |
| 10 |
|
| 11 |
/** |
| 12 |
* ExtCreateFontIndirectW TAG. |
| 13 |
* |
| 14 |
* @author Mark Donszelmann |
| 15 |
* @version $Id: freehep-graphicsio-emf/src/main/java/org/freehep/graphicsio/emf/gdi/ExtCreateFontIndirectW.java c0f15e7696d3 2007/01/22 19:26:48 duns $ |
| 16 |
*/ |
| 17 |
public class ExtCreateFontIndirectW extends EMFTag { |
| 18 |
|
| 19 |
private int index; |
| 20 |
|
| 21 |
private ExtLogFontW font; |
| 22 |
|
| 23 |
public ExtCreateFontIndirectW() { |
| 24 |
super(82, 1); |
| 25 |
} |
| 26 |
|
| 27 |
public ExtCreateFontIndirectW(int index, ExtLogFontW font) { |
| 28 |
this(); |
| 29 |
this.index = index; |
| 30 |
this.font = font; |
| 31 |
} |
| 32 |
|
| 33 |
public EMFTag read(int tagID, EMFInputStream emf, int len) |
| 34 |
throws IOException { |
| 35 |
|
| 36 |
return new ExtCreateFontIndirectW( |
| 37 |
emf.readDWORD(), |
| 38 |
new ExtLogFontW(emf)); |
| 39 |
} |
| 40 |
|
| 41 |
public void write(int tagID, EMFOutputStream emf) throws IOException { |
| 42 |
emf.writeDWORD(index); |
| 43 |
font.write(emf); |
| 44 |
} |
| 45 |
|
| 46 |
public String toString() { |
| 47 |
return super.toString() + |
| 48 |
"\n index: 0x" + Integer.toHexString(index) + |
| 49 |
"\n" + font.toString(); |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* displays the tag using the renderer |
| 54 |
* |
| 55 |
* @param renderer EMFRenderer storing the drawing session data |
| 56 |
*/ |
| 57 |
public void render(EMFRenderer renderer) { |
| 58 |
renderer.storeGDIObject(index, font); |
| 59 |
} |
| 60 |
} |