KickJava   Java API By Example, From Geeks To Geeks.

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


1 /**
2  * Copyright (c) 2003, 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 the win ansi encoding.
38  *
39  * @author <a HREF="mailto:ben@benlitchfield.com">Ben Litchfield</a>
40  * @version $Revision: 1.10 $
41  */

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

47     public WinAnsiEncoding()
48     {
49         addCharacterEncoding( 0101, COSName.getPDFName( "A" ) );
50         addCharacterEncoding( 0306, COSName.getPDFName( "AE" ) );
51         addCharacterEncoding( 0301, COSName.getPDFName( "Aacute" ) );
52         addCharacterEncoding( 0302, COSName.getPDFName( "Acircumflex" ) );
53         addCharacterEncoding( 0304, COSName.getPDFName( "Adieresis" ) );
54         addCharacterEncoding( 0300, COSName.getPDFName( "Agrave" ) );
55         addCharacterEncoding( 0305, COSName.getPDFName( "Aring" ) );
56         addCharacterEncoding( 0303, COSName.getPDFName( "Atilde" ) );
57         addCharacterEncoding( 0102, COSName.getPDFName( "B" ) );
58         addCharacterEncoding( 0103, COSName.getPDFName( "C" ) );
59         addCharacterEncoding( 0307, COSName.getPDFName( "Ccedilla" ) );
60         addCharacterEncoding( 0104, COSName.getPDFName( "D" ) );
61         addCharacterEncoding( 0105, COSName.getPDFName( "E" ) );
62         addCharacterEncoding( 0311, COSName.getPDFName( "Eacute" ) );
63         addCharacterEncoding( 0312, COSName.getPDFName( "Ecircumflex" ) );
64         addCharacterEncoding( 0313, COSName.getPDFName( "Edieresis" ) );
65         addCharacterEncoding( 0310, COSName.getPDFName( "Egrave" ) );
66         addCharacterEncoding( 0320, COSName.getPDFName( "Eth" ) );
67         addCharacterEncoding( 0200, COSName.getPDFName( "Euro" ) );
68         addCharacterEncoding( 0106, COSName.getPDFName( "F" ) );
69         addCharacterEncoding( 0107, COSName.getPDFName( "G" ) );
70         addCharacterEncoding( 0110, COSName.getPDFName( "H" ) );
71         addCharacterEncoding( 0111, COSName.getPDFName( "I" ) );
72         addCharacterEncoding( 0315, COSName.getPDFName( "Iacute" ) );
73         addCharacterEncoding( 0316, COSName.getPDFName( "Icircumflex" ) );
74         addCharacterEncoding( 0317, COSName.getPDFName( "Idieresis" ) );
75         addCharacterEncoding( 0314, COSName.getPDFName( "Igrave" ) );
76         addCharacterEncoding( 0112, COSName.getPDFName( "J" ) );
77         addCharacterEncoding( 0113, COSName.getPDFName( "K" ) );
78         addCharacterEncoding( 0114, COSName.getPDFName( "L" ) );
79         addCharacterEncoding( 0115, COSName.getPDFName( "M" ) );
80         addCharacterEncoding( 0116, COSName.getPDFName( "N" ) );
81         addCharacterEncoding( 0321, COSName.getPDFName( "Ntilde" ) );
82         addCharacterEncoding( 0117, COSName.getPDFName( "O" ) );
83         addCharacterEncoding( 0214, COSName.getPDFName( "OE" ) );
84         addCharacterEncoding( 0323, COSName.getPDFName( "Oacute" ) );
85         addCharacterEncoding( 0324, COSName.getPDFName( "Ocircumflex" ) );
86         addCharacterEncoding( 0326, COSName.getPDFName( "Odieresis" ) );
87         addCharacterEncoding( 0322, COSName.getPDFName( "Ograve" ) );
88         addCharacterEncoding( 0330, COSName.getPDFName( "Oslash" ) );
89         addCharacterEncoding( 0325, COSName.getPDFName( "Otilde" ) );
90         addCharacterEncoding( 0120, COSName.getPDFName( "P" ) );
91         addCharacterEncoding( 0121, COSName.getPDFName( "Q" ) );
92         addCharacterEncoding( 0122, COSName.getPDFName( "R" ) );
93         addCharacterEncoding( 0123, COSName.getPDFName( "S" ) );
94         addCharacterEncoding( 0212, COSName.getPDFName( "Scaron" ) );
95         addCharacterEncoding( 0124, COSName.getPDFName( "T" ) );
96         addCharacterEncoding( 0336, COSName.getPDFName( "Thorn" ) );
97         addCharacterEncoding( 0125, COSName.getPDFName( "U" ) );
98         addCharacterEncoding( 0332, COSName.getPDFName( "Uacute" ) );
99         addCharacterEncoding( 0333, COSName.getPDFName( "Ucircumflex" ) );
100         addCharacterEncoding( 0334, COSName.getPDFName( "Udieresis" ) );
101         addCharacterEncoding( 0331, COSName.getPDFName( "Ugrave" ) );
102         addCharacterEncoding( 0126, COSName.getPDFName( "V" ) );
103         addCharacterEncoding( 0127, COSName.getPDFName( "W" ) );
104         addCharacterEncoding( 0130, COSName.getPDFName( "X" ) );
105         addCharacterEncoding( 0131, COSName.getPDFName( "Y" ) );
106         addCharacterEncoding( 0335, COSName.getPDFName( "Yacute" ) );
107         addCharacterEncoding( 0237, COSName.getPDFName( "Ydieresis" ) );
108         addCharacterEncoding( 0132, COSName.getPDFName( "Z" ) );
109         addCharacterEncoding( 0216, COSName.getPDFName( "Zcaron" ) );
110         addCharacterEncoding( 0141, COSName.getPDFName( "a" ) );
111         addCharacterEncoding( 0341, COSName.getPDFName( "aacute" ) );
112         addCharacterEncoding( 0342, COSName.getPDFName( "acircumflex" ) );
113         addCharacterEncoding( 0264, COSName.getPDFName( "acute" ) );
114         addCharacterEncoding( 0344, COSName.getPDFName( "adieresis" ) );
115         addCharacterEncoding( 0346, COSName.getPDFName( "ae" ) );
116         addCharacterEncoding( 0340, COSName.getPDFName( "agrave" ) );
117         addCharacterEncoding( 046, COSName.getPDFName( "ampersand" ) );
118         addCharacterEncoding( 0345, COSName.getPDFName( "aring" ) );
119         addCharacterEncoding( 0136, COSName.getPDFName( "asciicircum" ) );
120         addCharacterEncoding( 0176, COSName.getPDFName( "asciitilde" ) );
121         addCharacterEncoding( 052, COSName.getPDFName( "asterisk" ) );
122         addCharacterEncoding( 0100, COSName.getPDFName( "at" ) );
123         addCharacterEncoding( 0343, COSName.getPDFName( "atilde" ) );
124         addCharacterEncoding( 0142, COSName.getPDFName( "b" ) );
125         addCharacterEncoding( 0134, COSName.getPDFName( "backslash" ) );
126         addCharacterEncoding( 0174, COSName.getPDFName( "bar" ) );
127         addCharacterEncoding( 0173, COSName.getPDFName( "braceleft" ) );
128         addCharacterEncoding( 0175, COSName.getPDFName( "braceright" ) );
129         addCharacterEncoding( 0133, COSName.getPDFName( "bracketleft" ) );
130         addCharacterEncoding( 0135, COSName.getPDFName( "bracketright" ) );
131         addCharacterEncoding( 0246, COSName.getPDFName( "brokenbar" ) );
132         addCharacterEncoding( 0225, COSName.getPDFName( "bullet" ) );
133         addCharacterEncoding( 0143, COSName.getPDFName( "c" ) );
134         addCharacterEncoding( 0347, COSName.getPDFName( "ccedilla" ) );
135         addCharacterEncoding( 0270, COSName.getPDFName( "cedilla" ) );
136         addCharacterEncoding( 0242, COSName.getPDFName( "cent" ) );
137         addCharacterEncoding( 0210, COSName.getPDFName( "circumflex" ) );
138         addCharacterEncoding( 072, COSName.getPDFName( "colon" ) );
139         addCharacterEncoding( 054, COSName.getPDFName( "comma" ) );
140         addCharacterEncoding( 0251, COSName.getPDFName( "copyright" ) );
141
142         /**
143          * Added because cweb.pdf uses circlecopyrt
144          */

145         addCharacterEncoding( 0251, COSName.getPDFName( "circlecopyrt" ) );
146         addCharacterEncoding( 0244, COSName.getPDFName( "currency" ) );
147         addCharacterEncoding( 0144, COSName.getPDFName( "d" ) );
148         addCharacterEncoding( 0206, COSName.getPDFName( "dagger" ) );
149         addCharacterEncoding( 0207, COSName.getPDFName( "daggerdbl" ) );
150         addCharacterEncoding( 0260, COSName.getPDFName( "degree" ) );
151         addCharacterEncoding( 0250, COSName.getPDFName( "dieresis" ) );
152         addCharacterEncoding( 0367, COSName.getPDFName( "divide" ) );
153         addCharacterEncoding( 044, COSName.getPDFName( "dollar" ) );
154         addCharacterEncoding( 0145, COSName.getPDFName( "e" ) );
155         addCharacterEncoding( 0351, COSName.getPDFName( "eacute" ) );
156         addCharacterEncoding( 0352, COSName.getPDFName( "ecircumflex" ) );
157         addCharacterEncoding( 0353, COSName.getPDFName( "edieresis" ) );
158         addCharacterEncoding( 0350, COSName.getPDFName( "egrave" ) );
159         addCharacterEncoding( 070, COSName.getPDFName( "eight" ) );
160         addCharacterEncoding( 0205, COSName.getPDFName( "ellipsis" ) );
161         addCharacterEncoding( 0227, COSName.getPDFName( "emdash" ) );
162         addCharacterEncoding( 0226, COSName.getPDFName( "endash" ) );
163         addCharacterEncoding( 075, COSName.getPDFName( "equal" ) );
164         addCharacterEncoding( 0360, COSName.getPDFName( "eth" ) );
165         addCharacterEncoding( 041, COSName.getPDFName( "exclam" ) );
166         addCharacterEncoding( 0241, COSName.getPDFName( "exclamdown" ) );
167         addCharacterEncoding( 0146, COSName.getPDFName( "f" ) );
168         addCharacterEncoding( 065, COSName.getPDFName( "five" ) );
169         addCharacterEncoding( 0203, COSName.getPDFName( "florin" ) );
170         addCharacterEncoding( 064, COSName.getPDFName( "four" ) );
171         addCharacterEncoding( 0147, COSName.getPDFName( "g" ) );
172         addCharacterEncoding( 0337, COSName.getPDFName( "germandbls" ) );
173         addCharacterEncoding( 0140, COSName.getPDFName( "grave" ) );
174         addCharacterEncoding( 076, COSName.getPDFName( "greater" ) );
175         addCharacterEncoding( 0253, COSName.getPDFName( "guillemotleft" ) );
176         addCharacterEncoding( 0273, COSName.getPDFName( "guillemotright" ) );
177         addCharacterEncoding( 0213, COSName.getPDFName( "guilsinglleft" ) );
178         addCharacterEncoding( 0233, COSName.getPDFName( "guilsinglright" ) );
179         addCharacterEncoding( 0150, COSName.getPDFName( "h" ) );
180         addCharacterEncoding( 055, COSName.getPDFName( "hyphen" ) );
181         addCharacterEncoding( 0151, COSName.getPDFName( "i" ) );
182         addCharacterEncoding( 0355, COSName.getPDFName( "iacute" ) );
183         addCharacterEncoding( 0356, COSName.getPDFName( "icircumflex" ) );
184         addCharacterEncoding( 0357, COSName.getPDFName( "idieresis" ) );
185         addCharacterEncoding( 0354, COSName.getPDFName( "igrave" ) );
186         addCharacterEncoding( 0152, COSName.getPDFName( "j" ) );
187         addCharacterEncoding( 0153, COSName.getPDFName( "k" ) );
188         addCharacterEncoding( 0154, COSName.getPDFName( "l" ) );
189         addCharacterEncoding( 074, COSName.getPDFName( "less" ) );
190         addCharacterEncoding( 0254, COSName.getPDFName( "logicalnot" ) );
191         addCharacterEncoding( 0155, COSName.getPDFName( "m" ) );
192         addCharacterEncoding( 0257, COSName.getPDFName( "macron" ) );
193         addCharacterEncoding( 0265, COSName.getPDFName( "mu" ) );
194         addCharacterEncoding( 0327, COSName.getPDFName( "multiply" ) );
195         addCharacterEncoding( 0156, COSName.getPDFName( "n" ) );
196         addCharacterEncoding( 071, COSName.getPDFName( "nine" ) );
197         addCharacterEncoding( 0361, COSName.getPDFName( "ntilde" ) );
198         addCharacterEncoding( 043, COSName.getPDFName( "numbersign" ) );
199         addCharacterEncoding( 0157, COSName.getPDFName( "o" ) );
200         addCharacterEncoding( 0363, COSName.getPDFName( "oacute" ) );
201         addCharacterEncoding( 0364, COSName.getPDFName( "ocircumflex" ) );
202         addCharacterEncoding( 0366, COSName.getPDFName( "odieresis" ) );
203         addCharacterEncoding( 0234, COSName.getPDFName( "oe" ) );
204         addCharacterEncoding( 0362, COSName.getPDFName( "ograve" ) );
205         addCharacterEncoding( 061, COSName.getPDFName( "one" ) );
206         addCharacterEncoding( 0275, COSName.getPDFName( "onehalf" ) );
207         addCharacterEncoding( 0274, COSName.getPDFName( "onequarter" ) );
208         addCharacterEncoding( 0271, COSName.getPDFName( "onesuperior" ) );
209         addCharacterEncoding( 0252, COSName.getPDFName( "ordfeminine" ) );
210         addCharacterEncoding( 0272, COSName.getPDFName( "ordmasculine" ) );
211         addCharacterEncoding( 0370, COSName.getPDFName( "oslash" ) );
212         addCharacterEncoding( 0365, COSName.getPDFName( "otilde" ) );
213         addCharacterEncoding( 0160, COSName.getPDFName( "p" ) );
214         addCharacterEncoding( 0266, COSName.getPDFName( "paragraph" ) );
215         addCharacterEncoding( 050, COSName.getPDFName( "parenleft" ) );
216         addCharacterEncoding( 051, COSName.getPDFName( "parenright" ) );
217         addCharacterEncoding( 045, COSName.getPDFName( "percent" ) );
218         addCharacterEncoding( 056, COSName.getPDFName( "period" ) );
219         addCharacterEncoding( 0267, COSName.getPDFName( "periodcentered" ) );
220         addCharacterEncoding( 0211, COSName.getPDFName( "perthousand" ) );
221         addCharacterEncoding( 053, COSName.getPDFName( "plus" ) );
222         addCharacterEncoding( 0261, COSName.getPDFName( "plusminus" ) );
223         addCharacterEncoding( 0161, COSName.getPDFName( "q" ) );
224         addCharacterEncoding( 077, COSName.getPDFName( "question" ) );
225         addCharacterEncoding( 0277, COSName.getPDFName( "questiondown" ) );
226         addCharacterEncoding( 042, COSName.getPDFName( "quotedbl" ) );
227         addCharacterEncoding( 0204, COSName.getPDFName( "quotedblbase" ) );
228         addCharacterEncoding( 0223, COSName.getPDFName( "quotedblleft" ) );
229         addCharacterEncoding( 0224, COSName.getPDFName( "quotedblright" ) );
230         addCharacterEncoding( 0221, COSName.getPDFName( "quoteleft" ) );
231         addCharacterEncoding( 0222, COSName.getPDFName( "quoteright" ) );
232         addCharacterEncoding( 0202, COSName.getPDFName( "quotesinglbase" ) );
233         addCharacterEncoding( 047, COSName.getPDFName( "quotesingle" ) );
234         addCharacterEncoding( 0162, COSName.getPDFName( "r" ) );
235         addCharacterEncoding( 0256, COSName.getPDFName( "registered" ) );
236         addCharacterEncoding( 0163, COSName.getPDFName( "s" ) );
237         addCharacterEncoding( 0232, COSName.getPDFName( "scaron" ) );
238         addCharacterEncoding( 0247, COSName.getPDFName( "section" ) );
239         addCharacterEncoding( 073, COSName.getPDFName( "semicolon" ) );
240         addCharacterEncoding( 067, COSName.getPDFName( "seven" ) );
241         addCharacterEncoding( 066, COSName.getPDFName( "six" ) );
242         addCharacterEncoding( 057, COSName.getPDFName( "slash" ) );
243         addCharacterEncoding( 040, COSName.getPDFName( "space" ) );
244         addCharacterEncoding( 0243, COSName.getPDFName( "sterling" ) );
245         addCharacterEncoding( 0164, COSName.getPDFName( "t" ) );
246         addCharacterEncoding( 0376, COSName.getPDFName( "thorn" ) );
247         addCharacterEncoding( 063, COSName.getPDFName( "three" ) );
248         addCharacterEncoding( 0276, COSName.getPDFName( "threequarters" ) );
249         addCharacterEncoding( 0263, COSName.getPDFName( "threesuperior" ) );
250         addCharacterEncoding( 0230, COSName.getPDFName( "tilde" ) );
251         addCharacterEncoding( 0231, COSName.getPDFName( "trademark" ) );
252         addCharacterEncoding( 062, COSName.getPDFName( "two" ) );
253         addCharacterEncoding( 0262, COSName.getPDFName( "twosuperior" ) );
254         addCharacterEncoding( 0165, COSName.getPDFName( "u" ) );
255         addCharacterEncoding( 0372, COSName.getPDFName( "uacute" ) );
256         addCharacterEncoding( 0373, COSName.getPDFName( "ucircumflex" ) );
257         addCharacterEncoding( 0374, COSName.getPDFName( "udieresis" ) );
258         addCharacterEncoding( 0371, COSName.getPDFName( "ugrave" ) );
259         addCharacterEncoding( 0137, COSName.getPDFName( "underscore" ) );
260         addCharacterEncoding( 0166, COSName.getPDFName( "v" ) );
261         addCharacterEncoding( 0167, COSName.getPDFName( "w" ) );
262         addCharacterEncoding( 0170, COSName.getPDFName( "x" ) );
263         addCharacterEncoding( 0171, COSName.getPDFName( "y" ) );
264         addCharacterEncoding( 0375, COSName.getPDFName( "yacute" ) );
265         addCharacterEncoding( 0377, COSName.getPDFName( "ydieresis" ) );
266         addCharacterEncoding( 0245, COSName.getPDFName( "yen" ) );
267         addCharacterEncoding( 0172, COSName.getPDFName( "z" ) );
268         addCharacterEncoding( 0236, COSName.getPDFName( "zcaron" ) );
269         addCharacterEncoding( 060, COSName.getPDFName( "zero" ) );
270     }
271     
272     /**
273      * Convert this standard java object to a COS object.
274      *
275      * @return The cos object that matches this Java object.
276      */

277     public COSBase getCOSObject()
278     {
279         return COSName.WIN_ANSI_ENCODING;
280     }
281 }
Popular Tags