KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > faceless > pdf > StandardFont


1 // $Id: StandardFont.java,v 1.5 2003/11/04 17:16:01 mike Exp $
2

3 package org.faceless.pdf;
4
5 import java.util.*;
6
7 /**
8  * <p>
9  * A concrete subclass of {@link PDFSimpleFont} representing the standard 14 fonts
10  * guaranteed to exist in all PDF readers.
11  * </p>
12  * @version $Revision: 1.5 $
13  */

14 public class StandardFont extends PDFFont
15 {
16     /**
17      * Represents the "Courier-Bold" font
18      */

19     public static final int COURIERBOLD=0;
20
21     /**
22      * Represents the "Courier-BoldOblique" font
23      */

24     public static final int COURIERBOLDOBLIQUE=1;
25
26     /**
27      * Represents the "Courier-Oblique" font
28      */

29     public static final int COURIEROBLIQUE=2;
30
31     /**
32      * Represents the "Courier" font
33      */

34     public static final int COURIER=3;
35
36     /**
37      * Represents the "Helvetica-Bold" font
38      */

39     public static final int HELVETICABOLD=4;
40
41     /**
42      * Represents the "Helvetica-BoldOblique" font
43      */

44     public static final int HELVETICABOLDOBLIQUE=5;
45
46     /**
47      * Represents the "Helvetica-Oblique" font
48      */

49     public static final int HELVETICAOBLIQUE=6;
50
51     /**
52      * Represents the "Helvetica" font
53      */

54     public static final int HELVETICA=7;
55
56     /**
57      * Represents the "Symbol" font
58      */

59     public static final int SYMBOL=8;
60
61     /**
62      * Represents the "Times-Bold" font
63      */

64     public static final int TIMESBOLD=9;
65
66     /**
67      * Represents the "Times-BoldItalic" font
68      */

69     public static final int TIMESBOLDITALIC=10;
70
71     /**
72      * Represents the "Times-Italic" font
73      */

74     public static final int TIMESITALIC=11;
75
76     /**
77      * Represents the "Times-Roman" font
78      */

79     public static final int TIMES=12;
80
81     /**
82      * Represents the "ZapfDingbats" font. Note that the characters in the
83      * font are defined by the correct Unicode codepoints, rather than just
84      * numbers 1 to 255. See the file <code>docs/map-zapf.pdf</code> that
85      * came with the distribution to see what these codepoints are.
86      */

87     public static final int ZAPFDINGBATS=13;
88
89     private static final int[] map = { 9, 11, 10, 8, 5, 7, 6, 4, 12, 1, 3, 2, 0, 13 };
90
91     public StandardFont(int type)
92     {
93     super(new org.faceless.pdf2.StandardFont(map[type]));
94     }
95
96     /**
97      * Return an <i>italic</i> version of this font if it exists, or
98      * the current font if it doesn't.
99      * @since 1.1
100      */

101     public PDFFont versionItalic()
102     {
103     return (PDFFont)PeeredObject.getPeer(((org.faceless.pdf2.StandardFont)font).versionItalic());
104     }
105
106     /**
107      * Return a <b>bold</b> version of this font if it exists, or
108      * the current font if it doesn't.
109      * @since 1.1
110      */

111     public PDFFont versionBold()
112     {
113     return (PDFFont)PeeredObject.getPeer(((org.faceless.pdf2.StandardFont)font).versionBold());
114     }
115
116     /**
117      * Return a regular (non-bold, non-italic) version of this font
118      * if it exists, or the current font if it doesn't.
119      * @since 1.1
120      */

121     public PDFFont versionRegular()
122     {
123     return (PDFFont)PeeredObject.getPeer(((org.faceless.pdf2.StandardFont)font).versionRegular());
124     }
125 }
126
Popular Tags