1
2 package org.freehep.graphicsio.ps.test;
3
4 import java.awt.Font;
5 import java.awt.font.FontRenderContext;
6 import java.awt.geom.AffineTransform;
7 import java.io.FileOutputStream;
8 import java.io.PrintStream;
9
10 import org.freehep.graphics2d.font.Lookup;
11 import org.freehep.graphicsio.font.FontEmbedder;
12 import org.freehep.graphicsio.font.FontEmbedderType1;
13
14 public class TestPSFont {
15
16 public static void main(String[] argv) {
17
18 try {
19
20 PrintStream out = new PrintStream(new FileOutputStream(
21 "fonttest.ps"));
22
23 Font font = new Font("Monotype Corsiva", Font.PLAIN, 1000);
24 FontRenderContext context = new FontRenderContext(
25 new AffineTransform(1, 0, 0, -1, 0, 0), true, true);
26 FontEmbedder fe = new FontEmbedderType1(context, out, false);
27 fe.includeFont(font, Lookup.getInstance().getTable("STDLatin"),
28 "ExampleFont");
29 out.println();
30 for (int i = 0; i < 16; i++)
31 out.println("00000000000000000000000000000000");
32 out.println("cleartomark");
33 out.println("/ExampleFont findfont 26 scalefont setfont");
34 out.println("66 72 moveto");
35 out.println("(dede) show");
36 out.println("/ExampleFont findfont 77 scalefont setfont");
37 out.println("56 126 moveto");
38 out.println("([afbycpd]) show");
39
40 out.close();
41
42 } catch (Exception e) {
43 e.printStackTrace();
44 }
45 }
46 }