KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: TimesRoman.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 TimesRoman extends Font {
56     private final static String JavaDoc fontName = "Times-Roman";
57     private final static String JavaDoc encoding = "WinAnsiEncoding";
58     private final static int capHeight = 662;
59     private final static int xHeight = 450;
60     private final static int ascender = 683;
61     private final static int descender = -217;
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[0x0041] = 722;
69         width[0x00C6] = 889;
70         width[0x00C1] = 722;
71         width[0x00C2] = 722;
72         width[0x00C4] = 722;
73         width[0x00C0] = 722;
74         width[0x00C5] = 722;
75         width[0x00C3] = 722;
76         width[0x0042] = 667;
77         width[0x0043] = 667;
78         width[0x00C7] = 667;
79         width[0x0044] = 722;
80         width[0x0045] = 611;
81         width[0x00C9] = 611;
82         width[0x00CA] = 611;
83         width[0x00CB] = 611;
84         width[0x00C8] = 611;
85         width[0x00D0] = 722;
86         width[0x0046] = 556;
87         width[0x0047] = 722;
88         width[0x0048] = 722;
89         width[0x0049] = 333;
90         width[0x00CD] = 333;
91         width[0x00CE] = 333;
92         width[0x00CF] = 333;
93         width[0x00CC] = 333;
94         width[0x004A] = 389;
95         width[0x004B] = 722;
96         width[0x004C] = 611;
97         width[0x004D] = 889;
98         width[0x004E] = 722;
99         width[0x00D1] = 722;
100         width[0x004F] = 722;
101         width[0x008C] = 889;
102         width[0x00D3] = 722;
103         width[0x00D4] = 722;
104         width[0x00D6] = 722;
105         width[0x00D2] = 722;
106         width[0x00D8] = 722;
107         width[0x00D5] = 722;
108         width[0x0050] = 556;
109         width[0x0051] = 722;
110         width[0x0052] = 667;
111         width[0x0053] = 556;
112         width[0x008A] = 556;
113         width[0x0054] = 611;
114         width[0x00DE] = 556;
115         width[0x0055] = 722;
116         width[0x00DA] = 722;
117         width[0x00DB] = 722;
118         width[0x00DC] = 722;
119         width[0x00D9] = 722;
120         width[0x0056] = 722;
121         width[0x0057] = 944;
122         width[0x0058] = 722;
123         width[0x0059] = 722;
124         width[0x00DD] = 722;
125         width[0x009F] = 722;
126         width[0x005A] = 611;
127         width[0x0061] = 444;
128         width[0x00E1] = 444;
129         width[0x00E2] = 444;
130         width[0x00B4] = 333;
131         width[0x00E4] = 444;
132         width[0x00E6] = 667;
133         width[0x00E0] = 444;
134         width[0x0026] = 778;
135         width[0x00E5] = 444;
136         width[0x005E] = 469;
137         width[0x007E] = 541;
138         width[0x002A] = 500;
139         width[0x0040] = 921;
140         width[0x00E3] = 444;
141         width[0x0062] = 500;
142         width[0x005C] = 278;
143         width[0x007C] = 200;
144         width[0x007B] = 480;
145         width[0x007D] = 480;
146         width[0x005B] = 333;
147         width[0x005D] = 333;
148         width[0x00A6] = 200;
149         width[0x0095] = 350;
150         width[0x0063] = 444;
151         width[0x00E7] = 444;
152         width[0x00B8] = 333;
153         width[0x00A2] = 500;
154         width[0x0088] = 333;
155         width[0x003A] = 278;
156         width[0x002C] = 250;
157         width[0x00A9] = 760;
158         width[0x00A4] = 500;
159         width[0x0064] = 500;
160         width[0x0086] = 500;
161         width[0x0087] = 500;
162         width[0x00B0] = 400;
163         width[0x00A8] = 333;
164         width[0x00F7] = 564;
165         width[0x0024] = 500;
166         width[0x0065] = 444;
167         width[0x00E9] = 444;
168         width[0x00EA] = 444;
169         width[0x00EB] = 444;
170         width[0x00E8] = 444;
171         width[0x0038] = 500;
172         width[0x0085] = 1000;
173         width[0x0097] = 1000;
174         width[0x0096] = 500;
175         width[0x003D] = 564;
176         width[0x00F0] = 500;
177         width[0x0021] = 333;
178         width[0x00A1] = 333;
179         width[0x0066] = 333;
180         width[0x0035] = 500;
181         width[0x0083] = 500;
182         width[0x0034] = 500;
183         width[0xA4] = 167;
184         width[0x0067] = 500;
185         width[0x00DF] = 500;
186         width[0x0060] = 333;
187         width[0x003E] = 564;
188         width[0x00AB] = 500;
189         width[0x00BB] = 500;
190         width[0x008B] = 333;
191         width[0x009B] = 333;
192         width[0x0068] = 500;
193         width[0x002D] = 333;
194         width[0x0069] = 278;
195         width[0x00ED] = 278;
196         width[0x00EE] = 278;
197         width[0x00EF] = 278;
198         width[0x00EC] = 278;
199         width[0x006A] = 278;
200         width[0x006B] = 500;
201         width[0x006C] = 278;
202         width[0x003C] = 564;
203         width[0x00AC] = 564;
204         width[0x006D] = 778;
205         width[0x00AF] = 333;
206         width[0x2D] = 324;
207         width[0x00B5] = 500;
208         width[0x00D7] = 564;
209         width[0x006E] = 500;
210         width[0x0039] = 500;
211         width[0x00F1] = 500;
212         width[0x0023] = 500;
213         width[0x006F] = 500;
214         width[0x00F3] = 500;
215         width[0x00F4] = 500;
216         width[0x00F6] = 500;
217         width[0x009C] = 722;
218         width[0x00F2] = 500;
219         width[0x0031] = 500;
220         width[0x00BD] = 750;
221         width[0x00BC] = 750;
222         width[0x00B9] = 300;
223         width[0x00AA] = 276;
224         width[0x00BA] = 310;
225         width[0x00F8] = 500;
226         width[0x00F5] = 500;
227         width[0x0070] = 500;
228         width[0x00B6] = 453;
229         width[0x0028] = 333;
230         width[0x0029] = 333;
231         width[0x0025] = 833;
232         width[0x002E] = 250;
233         width[0x00B7] = 250;
234         width[0x0089] = 1000;
235         width[0x002B] = 564;
236         width[0x00B1] = 564;
237         width[0x0071] = 500;
238         width[0x003F] = 444;
239         width[0x00BF] = 444;
240         width[0x0022] = 408;
241         width[0x0084] = 444;
242         width[0x0093] = 444;
243         width[0x0094] = 444;
244         width[0x0091] = 333;
245         width[0x0092] = 333;
246         width[0x0082] = 333;
247         width[0x0027] = 180;
248         width[0x0072] = 333;
249         width[0x00AE] = 760;
250         width[0x00B0] = 333;
251         width[0x0073] = 389;
252         width[0x009A] = 389;
253         width[0x00A7] = 500;
254         width[0x003B] = 278;
255         width[0x0037] = 500;
256         width[0x0036] = 500;
257         width[0x002F] = 278;
258         width[0x0020] = 250;
259         width[0x00A0] = 250;
260         width[0x00A3] = 500;
261         width[0x0074] = 278;
262         width[0x00FE] = 500;
263         width[0x0033] = 500;
264         width[0x00BE] = 750;
265         width[0x00B3] = 300;
266         width[0x0098] = 333;
267         width[0x0099] = 980;
268         width[0x0032] = 500;
269         width[0x00B2] = 300;
270         width[0x0075] = 500;
271         width[0x00FA] = 500;
272         width[0x00FB] = 500;
273         width[0x00FC] = 500;
274         width[0x00F9] = 500;
275         width[0x005F] = 500;
276         width[0x0076] = 500;
277         width[0x0077] = 722;
278         width[0x0078] = 500;
279         width[0x0079] = 500;
280         width[0x00FD] = 500;
281         width[0x00FF] = 500;
282         width[0x00A5] = 500;
283         width[0x007A] = 444;
284         width[0x0030] = 500;
285
286     }
287
288     public String JavaDoc encoding() {
289         return encoding;
290     }
291
292     public String JavaDoc fontName() {
293         return fontName;
294     }
295
296     public int getAscender(int size) {
297         return size * ascender;
298     }
299
300     public int getCapHeight(int size) {
301         return size * capHeight;
302     }
303
304     public int getDescender(int size) {
305         return size * descender;
306     }
307
308     public int getXHeight(int size) {
309         return size * xHeight;
310     }
311
312     public int getFirstChar() {
313         return firstChar;
314     }
315
316     public int getLastChar() {
317         return lastChar;
318     }
319
320     public int width(int i, int size) {
321         return size * width[i];
322     }
323
324     public int[] getWidths(int size) {
325         int[] arr = new int[getLastChar() - getFirstChar() + 1];
326         System.arraycopy(width, getFirstChar(), arr, 0,
327                          getLastChar() - getFirstChar() + 1);
328         for (int i = 0; i < arr.length; i++)
329             arr[i] *= size;
330         return arr;
331     }
332
333 }
334
335
Popular Tags