KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > pdfbox > encoding > StandardEncoding


1 /**
2  * Copyright (c) 2003-2004, www.pdfbox.org
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * 3. Neither the name of pdfbox; nor the names of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * http://www.pdfbox.org
29  *
30  */

31 package org.pdfbox.encoding;
32
33 import org.pdfbox.cos.COSBase;
34 import org.pdfbox.cos.COSName;
35
36 /**
37  * This is an interface to a text encoder.
38  *
39  * @author <a HREF="mailto:ben@benlitchfield.com">Ben Litchfield</a>
40  * @version $Revision: 1.10 $
41  */

42 public class StandardEncoding extends Encoding
43 {
44     /**
45      * Constructor.
46      */

47     public StandardEncoding()
48     {
49         addCharacterEncoding( 0101, COSName.getPDFName( "A" ) );
50         addCharacterEncoding( 0341, COSName.getPDFName( "AE" ) );
51         addCharacterEncoding( 0102, COSName.getPDFName( "B" ) );
52         addCharacterEncoding( 0103, COSName.getPDFName( "C" ) );
53         addCharacterEncoding( 0104, COSName.getPDFName( "D" ) );
54         addCharacterEncoding( 0105, COSName.getPDFName( "E" ) );
55         addCharacterEncoding( 0106, COSName.getPDFName( "F" ) );
56         addCharacterEncoding( 0107, COSName.getPDFName( "G" ) );
57         addCharacterEncoding( 0110, COSName.getPDFName( "H" ) );
58         addCharacterEncoding( 0111, COSName.getPDFName( "I" ) );
59         addCharacterEncoding( 0112, COSName.getPDFName( "J" ) );
60         addCharacterEncoding( 0113, COSName.getPDFName( "K" ) );
61         addCharacterEncoding( 0114, COSName.getPDFName( "L" ) );
62         addCharacterEncoding( 0350, COSName.getPDFName( "Lslash" ) );
63         addCharacterEncoding( 0115, COSName.getPDFName( "M" ) );
64         addCharacterEncoding( 0116, COSName.getPDFName( "N" ) );
65         addCharacterEncoding( 0117, COSName.getPDFName( "O" ) );
66         addCharacterEncoding( 0352, COSName.getPDFName( "OE" ) );
67         addCharacterEncoding( 0351, COSName.getPDFName( "Oslash" ) );
68         addCharacterEncoding( 0120, COSName.getPDFName( "P" ) );
69         addCharacterEncoding( 0121, COSName.getPDFName( "Q" ) );
70         addCharacterEncoding( 0122, COSName.getPDFName( "R" ) );
71         addCharacterEncoding( 0123, COSName.getPDFName( "S" ) );
72         addCharacterEncoding( 0124, COSName.getPDFName( "T" ) );
73         addCharacterEncoding( 0125, COSName.getPDFName( "U" ) );
74         addCharacterEncoding( 0126, COSName.getPDFName( "V" ) );
75         addCharacterEncoding( 0127, COSName.getPDFName( "W" ) );
76         addCharacterEncoding( 0130, COSName.getPDFName( "X" ) );
77         addCharacterEncoding( 0131, COSName.getPDFName( "Y" ) );
78         addCharacterEncoding( 0132, COSName.getPDFName( "Z" ) );
79         addCharacterEncoding( 0141, COSName.getPDFName( "a" ) );
80         addCharacterEncoding( 0302, COSName.getPDFName( "acute" ) );
81         addCharacterEncoding( 0361, COSName.getPDFName( "ae" ) );
82         addCharacterEncoding( 0046, COSName.getPDFName( "ampersand" ) );
83         addCharacterEncoding( 0136, COSName.getPDFName( "asciicircum" ) );
84         addCharacterEncoding( 0176, COSName.getPDFName( "asciitilde" ) );
85         addCharacterEncoding( 0052, COSName.getPDFName( "asterisk" ) );
86         addCharacterEncoding( 0100, COSName.getPDFName( "at" ) );
87         addCharacterEncoding( 0142, COSName.getPDFName( "b" ) );
88         addCharacterEncoding( 0134, COSName.getPDFName( "backslash" ) );
89         addCharacterEncoding( 0174, COSName.getPDFName( "bar" ) );
90         addCharacterEncoding( 0173, COSName.getPDFName( "braceleft" ) );
91         addCharacterEncoding( 0175, COSName.getPDFName( "braceright" ) );
92         addCharacterEncoding( 0133, COSName.getPDFName( "bracketleft" ) );
93         addCharacterEncoding( 0135, COSName.getPDFName( "bracketright" ) );
94         addCharacterEncoding( 0306, COSName.getPDFName( "breve" ) );
95         addCharacterEncoding( 0267, COSName.getPDFName( "bullet" ) );
96         addCharacterEncoding( 0143, COSName.getPDFName( "c" ) );
97         addCharacterEncoding( 0317, COSName.getPDFName( "caron" ) );
98         addCharacterEncoding( 0313, COSName.getPDFName( "cedilla" ) );
99         addCharacterEncoding( 0242, COSName.getPDFName( "cent" ) );
100         addCharacterEncoding( 0303, COSName.getPDFName( "circumflex" ) );
101         addCharacterEncoding( 0072, COSName.getPDFName( "colon" ) );
102         addCharacterEncoding( 0054, COSName.getPDFName( "comma" ) );
103         addCharacterEncoding( 0250, COSName.getPDFName( "currency1" ) );
104         addCharacterEncoding( 0144, COSName.getPDFName( "d" ) );
105         addCharacterEncoding( 0262, COSName.getPDFName( "dagger" ) );
106         addCharacterEncoding( 0263, COSName.getPDFName( "daggerdbl" ) );
107         addCharacterEncoding( 0310, COSName.getPDFName( "dieresis" ) );
108         addCharacterEncoding( 0044, COSName.getPDFName( "dollar" ) );
109         addCharacterEncoding( 0307, COSName.getPDFName( "dotaccent" ) );
110         addCharacterEncoding( 0365, COSName.getPDFName( "dotlessi" ) );
111         addCharacterEncoding( 0145, COSName.getPDFName( "e" ) );
112         addCharacterEncoding( 0070, COSName.getPDFName( "eight" ) );
113         addCharacterEncoding( 0274, COSName.getPDFName( "ellipsis" ) );
114         addCharacterEncoding( 0320, COSName.getPDFName( "emdash" ) );
115         addCharacterEncoding( 0261, COSName.getPDFName( "endash" ) );
116         addCharacterEncoding( 0075, COSName.getPDFName( "equal" ) );
117         addCharacterEncoding( 0041, COSName.getPDFName( "exclam" ) );
118         addCharacterEncoding( 0241, COSName.getPDFName( "exclamdown" ) );
119         addCharacterEncoding( 0146, COSName.getPDFName( "f" ) );
120         addCharacterEncoding( 0256, COSName.getPDFName( "fi" ) );
121         addCharacterEncoding( 0065, COSName.getPDFName( "five" ) );
122         addCharacterEncoding( 0257, COSName.getPDFName( "fl" ) );
123         addCharacterEncoding( 0246, COSName.getPDFName( "florin" ) );
124         addCharacterEncoding( 0064, COSName.getPDFName( "four" ) );
125         addCharacterEncoding( 0244, COSName.getPDFName( "fraction" ) );
126         addCharacterEncoding( 0147, COSName.getPDFName( "g" ) );
127         addCharacterEncoding( 0373, COSName.getPDFName( "germandbls" ) );
128         addCharacterEncoding( 0301, COSName.getPDFName( "grave" ) );
129         addCharacterEncoding( 0076, COSName.getPDFName( "greater" ) );
130         addCharacterEncoding( 0253, COSName.getPDFName( "guillemotleft" ) );
131         addCharacterEncoding( 0273, COSName.getPDFName( "guillemotright" ) );
132         addCharacterEncoding( 0254, COSName.getPDFName( "guilsinglleft" ) );
133         addCharacterEncoding( 0255, COSName.getPDFName( "guilsinglright" ) );
134         addCharacterEncoding( 0150, COSName.getPDFName( "h" ) );
135         addCharacterEncoding( 0315, COSName.getPDFName( "hungarumlaut" ) );
136         addCharacterEncoding( 0055, COSName.getPDFName( "hyphen" ) );
137         addCharacterEncoding( 0151, COSName.getPDFName( "i" ) );
138         addCharacterEncoding( 0152, COSName.getPDFName( "j" ) );
139         addCharacterEncoding( 0153, COSName.getPDFName( "k" ) );
140         addCharacterEncoding( 0154, COSName.getPDFName( "l" ) );
141         addCharacterEncoding( 0074, COSName.getPDFName( "less" ) );
142         addCharacterEncoding( 0370, COSName.getPDFName( "lslash" ) );
143         addCharacterEncoding( 0155, COSName.getPDFName( "m" ) );
144         addCharacterEncoding( 0305, COSName.getPDFName( "macron" ) );
145         addCharacterEncoding( 0156, COSName.getPDFName( "n" ) );
146         addCharacterEncoding( 0071, COSName.getPDFName( "nine" ) );
147         addCharacterEncoding( 0043, COSName.getPDFName( "numbersign" ) );
148         addCharacterEncoding( 0157, COSName.getPDFName( "o" ) );
149         addCharacterEncoding( 0372, COSName.getPDFName( "oe" ) );
150         addCharacterEncoding( 0316, COSName.getPDFName( "ogonek" ) );
151         addCharacterEncoding( 0061, COSName.getPDFName( "one" ) );
152         addCharacterEncoding( 0343, COSName.getPDFName( "ordfeminine" ) );
153         addCharacterEncoding( 0353, COSName.getPDFName( "ordmasculine" ) );
154         addCharacterEncoding( 0371, COSName.getPDFName( "oslash" ) );
155         addCharacterEncoding( 0160, COSName.getPDFName( "p" ) );
156         addCharacterEncoding( 0266, COSName.getPDFName( "paragraph" ) );
157         addCharacterEncoding( 0050, COSName.getPDFName( "parenleft" ) );
158         addCharacterEncoding( 0051, COSName.getPDFName( "parenright" ) );
159         addCharacterEncoding( 0045, COSName.getPDFName( "percent" ) );
160         addCharacterEncoding( 0056, COSName.getPDFName( "period" ) );
161         addCharacterEncoding( 0264, COSName.getPDFName( "periodcentered" ) );
162         addCharacterEncoding( 0275, COSName.getPDFName( "perthousand" ) );
163         addCharacterEncoding( 0053, COSName.getPDFName( "plus" ) );
164         addCharacterEncoding( 0161, COSName.getPDFName( "q" ) );
165         addCharacterEncoding( 0077, COSName.getPDFName( "question" ) );
166         addCharacterEncoding( 0277, COSName.getPDFName( "questiondown" ) );
167         addCharacterEncoding( 0042, COSName.getPDFName( "quotedbl" ) );
168         addCharacterEncoding( 0271, COSName.getPDFName( "quotedblbase" ) );
169         addCharacterEncoding( 0252, COSName.getPDFName( "quotedblleft" ) );
170         addCharacterEncoding( 0272, COSName.getPDFName( "quotedblright" ) );
171         addCharacterEncoding( 0140, COSName.getPDFName( "quoteleft" ) );
172         addCharacterEncoding( 0047, COSName.getPDFName( "quoteright" ) );
173         addCharacterEncoding( 0270, COSName.getPDFName( "quotesinglbase" ) );
174         addCharacterEncoding( 0251, COSName.getPDFName( "quotesingle" ) );
175         addCharacterEncoding( 0162, COSName.getPDFName( "r" ) );
176         addCharacterEncoding( 0312, COSName.getPDFName( "ring" ) );
177         addCharacterEncoding( 0163, COSName.getPDFName( "s" ) );
178         addCharacterEncoding( 0247, COSName.getPDFName( "section" ) );
179         addCharacterEncoding( 0073, COSName.getPDFName( "semicolon" ) );
180         addCharacterEncoding( 0067, COSName.getPDFName( "seven" ) );
181         addCharacterEncoding( 0066, COSName.getPDFName( "six" ) );
182         addCharacterEncoding( 0057, COSName.getPDFName( "slash" ) );
183         addCharacterEncoding( 0040, COSName.getPDFName( "space" ) );
184         addCharacterEncoding( 0243, COSName.getPDFName( "sterling" ) );
185         addCharacterEncoding( 0164, COSName.getPDFName( "t" ) );
186         addCharacterEncoding( 0063, COSName.getPDFName( "three" ) );
187         addCharacterEncoding( 0304, COSName.getPDFName( "tilde" ) );
188         addCharacterEncoding( 0062, COSName.getPDFName( "two" ) );
189         addCharacterEncoding( 0165, COSName.getPDFName( "u" ) );
190         addCharacterEncoding( 0137, COSName.getPDFName( "underscore" ) );
191         addCharacterEncoding( 0166, COSName.getPDFName( "v" ) );
192         addCharacterEncoding( 0167, COSName.getPDFName( "w" ) );
193         addCharacterEncoding( 0170, COSName.getPDFName( "x" ) );
194         addCharacterEncoding( 0171, COSName.getPDFName( "y" ) );
195         addCharacterEncoding( 0245, COSName.getPDFName( "yen" ) );
196         addCharacterEncoding( 0172, COSName.getPDFName( "z" ) );
197         addCharacterEncoding( 0060, COSName.getPDFName( "zero" ) );
198     }
199     
200     /**
201      * Convert this standard java object to a COS object.
202      *
203      * @return The cos object that matches this Java object.
204      */

205     public COSBase getCOSObject()
206     {
207         return COSName.STANDARD_ENCODING;
208     }
209 }
Popular Tags