KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > render > mif > fonts > Symbol


1 /*
2  * $Id: Symbol.java,v 1.2.2.1 2003/02/25 14:39:49 jeremias Exp $
3  * ============================================================================
4  * The Apache Software License, Version 1.1
5  * ============================================================================
6  *
7  * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without modifica-
10  * tion, are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * 3. The end-user documentation included with the redistribution, if any, must
20  * include the following acknowledgment: "This product includes software
21  * developed by the Apache Software Foundation (http://www.apache.org/)."
22  * Alternately, this acknowledgment may appear in the software itself, if
23  * and wherever such third-party acknowledgments normally appear.
24  *
25  * 4. The names "FOP" and "Apache Software Foundation" must not be used to
26  * endorse or promote products derived from this software without prior
27  * written permission. For written permission, please contact
28  * apache@apache.org.
29  *
30  * 5. Products derived from this software may not be called "Apache", nor may
31  * "Apache" appear in their name, without prior written permission of the
32  * Apache Software Foundation.
33  *
34  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
35  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
36  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
37  * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
38  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
39  * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
40  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
41  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
43  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
44  * ============================================================================
45  *
46  * This software consists of voluntary contributions made by many individuals
47  * on behalf of the Apache Software Foundation and was originally created by
48  * James Tauber <jtauber@jtauber.com>. For more information on the Apache
49  * Software Foundation, please see <http://www.apache.org/>.
50  */

51 package org.apache.fop.render.mif.fonts;
52
53 import org.apache.fop.render.mif.Font;
54
55 public class Symbol extends Font {
56     private final static String JavaDoc fontName = "Symbol";
57     private final static String JavaDoc encoding = "StandardEncoding";
58     private final static int capHeight = 1010;
59     private final static int xHeight = 520;
60     private final static int ascender = 1010;
61     private final static int descender = -293;
62     private final static int firstChar = 32;
63     private final static int lastChar = 255;
64     private final static int[] width;
65
66     static {
67         width = new int[256];
68         width[0x0020] = 250;
69         width[0x0021] = 333;
70         width[0x22] = 713;
71         width[0x0023] = 500;
72         width[0x24] = 549;
73         width[0x0025] = 833;
74         width[0x0026] = 778;
75         width[0x27] = 439;
76         width[0x0028] = 333;
77         width[0x0029] = 333;
78         width[0x2A] = 500;
79         width[0x002B] = 549;
80         width[0x002C] = 250;
81         width[0x2D] = 549;
82         width[0x002E] = 250;
83         width[0x002F] = 278;
84         width[0x0030] = 500;
85         width[0x0031] = 500;
86         width[0x0032] = 500;
87         width[0x0033] = 500;
88         width[0x0034] = 500;
89         width[0x0035] = 500;
90         width[0x0036] = 500;
91         width[0x0037] = 500;
92         width[0x0038] = 500;
93         width[0x0039] = 500;
94         width[0x003A] = 278;
95         width[0x003B] = 278;
96         width[0x003C] = 549;
97         width[0x003D] = 549;
98         width[0x003E] = 549;
99         width[0x003F] = 444;
100         width[0x40] = 549;
101         width[0x41] = 722;
102         width[0x42] = 667;
103         width[0x43] = 722;
104         width[0x44] = 612;
105         width[0x45] = 611;
106         width[0x46] = 763;
107         width[0x47] = 603;
108         width[0x48] = 722;
109         width[0x49] = 333;
110         width[0x4A] = 631;
111         width[0x4B] = 722;
112         width[0x4C] = 686;
113         width[0x4D] = 889;
114         width[0x4E] = 722;
115         width[0x4F] = 722;
116         width[0x50] = 768;
117         width[0x51] = 741;
118         width[0x52] = 556;
119         width[0x53] = 592;
120         width[0x54] = 611;
121         width[0x55] = 690;
122         width[0x56] = 439;
123         width[0x57] = 768;
124         width[0x58] = 645;
125         width[0x59] = 795;
126         width[0x5A] = 611;
127         width[0x005B] = 333;
128         width[0x5C] = 863;
129         width[0x005D] = 333;
130         width[0x5E] = 658;
131         width[0x005F] = 500;
132         width[0x60] = 500;
133         width[0x61] = 631;
134         width[0x62] = 549;
135         width[0x63] = 549;
136         width[0x64] = 494;
137         width[0x65] = 439;
138         width[0x66] = 521;
139         width[0x67] = 411;
140         width[0x68] = 603;
141         width[0x69] = 329;
142         width[0x6A] = 603;
143         width[0x6B] = 549;
144         width[0x6C] = 549;
145         width[0x006D] = 576;
146         width[0x00B5] = 576;
147         width[0x6E] = 521;
148         width[0x6F] = 549;
149         width[0x70] = 549;
150         width[0x71] = 521;
151         width[0x72] = 549;
152         width[0x73] = 603;
153         width[0x74] = 439;
154         width[0x75] = 576;
155         width[0x76] = 713;
156         width[0x77] = 686;
157         width[0x78] = 493;
158         width[0x79] = 686;
159         width[0x7A] = 494;
160         width[0x007B] = 480;
161         width[0x007C] = 200;
162         width[0x007D] = 480;
163         width[0x7E] = 549;
164         width[0xA1] = 620;
165         width[0xA2] = 247;
166         width[0xA3] = 549;
167         width[0xA4] = 167;
168         width[0xA5] = 713;
169         width[0x0083] = 500;
170         width[0xA7] = 753;
171         width[0xA8] = 753;
172         width[0xA9] = 753;
173         width[0xAA] = 753;
174         width[0xAB] = 1042;
175         width[0xAC] = 987;
176         width[0xAD] = 603;
177         width[0xAE] = 987;
178         width[0xAF] = 603;
179         width[0x00B0] = 400;
180         width[0x00B1] = 549;
181         width[0xB2] = 411;
182         width[0xB3] = 549;
183         width[0x00D7] = 549;
184         width[0xB5] = 713;
185         width[0xB6] = 494;
186         width[0x0095] = 460;
187         width[0x00F7] = 549;
188         width[0xB9] = 549;
189         width[0xBA] = 549;
190         width[0xBB] = 549;
191         width[0x0085] = 1000;
192         width[0xBD] = 603;
193         width[0xBE] = 1000;
194         width[0xBF] = 658;
195         width[0xC0] = 823;
196         width[0xC1] = 686;
197         width[0xC2] = 795;
198         width[0xC3] = 987;
199         width[0xC4] = 768;
200         width[0xC5] = 768;
201         width[0xC6] = 823;
202         width[0xC7] = 768;
203         width[0xC8] = 768;
204         width[0xC9] = 713;
205         width[0xCA] = 713;
206         width[0xCB] = 713;
207         width[0xCC] = 713;
208         width[0xCD] = 713;
209         width[0xCE] = 713;
210         width[0xCF] = 713;
211         width[0xD0] = 768;
212         width[0xD1] = 713;
213         width[0xD2] = 790;
214         width[0xD3] = 790;
215         width[0xD4] = 890;
216         width[0xD5] = 823;
217         width[0xD6] = 549;
218         width[0xD7] = 250;
219         width[0x00AC] = 713;
220         width[0xD9] = 603;
221         width[0xDA] = 603;
222         width[0xDB] = 1042;
223         width[0xDC] = 987;
224         width[0xDD] = 603;
225         width[0xDE] = 987;
226         width[0xDF] = 603;
227         width[0xE0] = 494;
228         width[0xE1] = 329;
229         width[0xE2] = 790;
230         width[0xE3] = 790;
231         width[0xE4] = 786;
232         width[0xE5] = 713;
233         width[0xE6] = 384;
234         width[0xE7] = 384;
235         width[0xE8] = 384;
236         width[0xE9] = 384;
237         width[0xEA] = 384;
238         width[0xEB] = 384;
239         width[0xEC] = 494;
240         width[0xED] = 494;
241         width[0xEE] = 494;
242         width[0xEF] = 494;
243         width[0xF1] = 329;
244         width[0xF2] = 274;
245         width[0xF3] = 686;
246         width[0xF4] = 686;
247         width[0xF5] = 686;
248         width[0xF6] = 384;
249         width[0xF7] = 384;
250         width[0xF8] = 384;
251         width[0xF9] = 384;
252         width[0xFA] = 384;
253         width[0xFB] = 384;
254         width[0xFC] = 494;
255         width[0xFD] = 494;
256         width[0xFE] = 494;
257
258     }
259
260     public String JavaDoc encoding() {
261         return encoding;
262     }
263
264     public String JavaDoc fontName() {
265         return fontName;
266     }
267
268     public int getAscender(int size) {
269         return size * ascender;
270     }
271
272     public int getCapHeight(int size) {
273         return size * capHeight;
274     }
275
276     public int getDescender(int size) {
277         return size * descender;
278     }
279
280     public int getXHeight(int size) {
281         return size * xHeight;
282     }
283
284     public int getFirstChar() {
285         return firstChar;
286     }
287
288     public int getLastChar() {
289         return lastChar;
290     }
291
292     public int width(int i, int size) {
293         return size * width[i];
294     }
295
296     public int[] getWidths(int size) {
297         int[] arr = new int[getLastChar() - getFirstChar() + 1];
298         System.arraycopy(width, getFirstChar(), arr, 0,
299                          getLastChar() - getFirstChar() + 1);
300         for (int i = 0; i < arr.length; i++)
301             arr[i] *= size;
302         return arr;
303     }
304
305 }
306
307
Popular Tags