KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: ZapfDingbats.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 ZapfDingbats extends Font {
56     private final static String JavaDoc fontName = "ZapfDingbats";
57     private final static String JavaDoc encoding = "StandardEncoding";
58     private final static int capHeight = 820;
59     private final static int xHeight = 426;
60     private final static int ascender = 820;
61     private final static int descender = -143;
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] = 278;
69         width[0x0021] = 974;
70         width[0x0022] = 961;
71         width[0x0023] = 974;
72         width[0x0024] = 980;
73         width[0x0025] = 719;
74         width[0x0026] = 789;
75         width[0x0027] = 790;
76         width[0x0028] = 791;
77         width[0x0029] = 690;
78         width[0x002A] = 960;
79         width[0x002B] = 939;
80         width[0x002C] = 549;
81         width[0x002D] = 855;
82         width[0x002E] = 911;
83         width[0x002F] = 933;
84         width[0x0030] = 911;
85         width[0x0031] = 945;
86         width[0x0032] = 974;
87         width[0x0033] = 755;
88         width[0x0034] = 846;
89         width[0x0035] = 762;
90         width[0x0036] = 761;
91         width[0x0037] = 571;
92         width[0x0038] = 677;
93         width[0x0039] = 763;
94         width[0x003A] = 760;
95         width[0x003B] = 759;
96         width[0x003C] = 754;
97         width[0x003D] = 494;
98         width[0x003E] = 552;
99         width[0x003F] = 537;
100         width[0x0040] = 577;
101         width[0x0041] = 692;
102         width[0x0042] = 786;
103         width[0x0043] = 788;
104         width[0x0044] = 788;
105         width[0x0045] = 790;
106         width[0x0046] = 793;
107         width[0x0047] = 794;
108         width[0x0048] = 816;
109         width[0x0049] = 823;
110         width[0x004A] = 789;
111         width[0x004B] = 841;
112         width[0x004C] = 823;
113         width[0x004D] = 833;
114         width[0x004E] = 816;
115         width[0x004F] = 831;
116         width[0x0050] = 923;
117         width[0x0051] = 744;
118         width[0x0052] = 723;
119         width[0x0053] = 749;
120         width[0x0054] = 790;
121         width[0x0055] = 792;
122         width[0x0056] = 695;
123         width[0x0057] = 776;
124         width[0x0058] = 768;
125         width[0x0059] = 792;
126         width[0x005A] = 759;
127         width[0x005B] = 707;
128         width[0x005C] = 708;
129         width[0x005D] = 682;
130         width[0x005E] = 701;
131         width[0x005F] = 826;
132         width[0x0060] = 815;
133         width[0x0061] = 789;
134         width[0x0062] = 789;
135         width[0x0063] = 707;
136         width[0x0064] = 687;
137         width[0x0065] = 696;
138         width[0x0066] = 689;
139         width[0x0067] = 786;
140         width[0x0068] = 787;
141         width[0x0069] = 713;
142         width[0x006A] = 791;
143         width[0x006B] = 785;
144         width[0x006C] = 791;
145         width[0x006D] = 873;
146         width[0x006E] = 761;
147         width[0x006F] = 762;
148         width[0x0070] = 762;
149         width[0x0071] = 759;
150         width[0x0072] = 759;
151         width[0x0073] = 892;
152         width[0x0074] = 892;
153         width[0x0075] = 788;
154         width[0x0076] = 784;
155         width[0x0077] = 438;
156         width[0x0078] = 138;
157         width[0x0079] = 277;
158         width[0x007A] = 415;
159         width[0x007B] = 392;
160         width[0x007C] = 392;
161         width[0x007D] = 668;
162         width[0x007E] = 668;
163         width[0x00A1] = 732;
164         width[0x00A2] = 544;
165         width[0x00A3] = 544;
166         width[0x00A4] = 910;
167         width[0x00A5] = 667;
168         width[0x00A6] = 760;
169         width[0x00A7] = 760;
170         width[0x00A8] = 776;
171         width[0x00A9] = 595;
172         width[0x00AA] = 694;
173         width[0x00AB] = 626;
174         width[0x00AC] = 788;
175         width[0x00AD] = 788;
176         width[0x00AE] = 788;
177         width[0x00AF] = 788;
178         width[0x00B0] = 788;
179         width[0x00B1] = 788;
180         width[0x00B2] = 788;
181         width[0x00B3] = 788;
182         width[0x00B4] = 788;
183         width[0x00B5] = 788;
184         width[0x00B6] = 788;
185         width[0x00B7] = 788;
186         width[0x00B8] = 788;
187         width[0x00B9] = 788;
188         width[0x00BA] = 788;
189         width[0x00BB] = 788;
190         width[0x00BC] = 788;
191         width[0x00BD] = 788;
192         width[0x00BE] = 788;
193         width[0x00BF] = 788;
194         width[0x00C0] = 788;
195         width[0x00C1] = 788;
196         width[0x00C2] = 788;
197         width[0x00C3] = 788;
198         width[0x00C4] = 788;
199         width[0x00C5] = 788;
200         width[0x00C6] = 788;
201         width[0x00C7] = 788;
202         width[0x00C8] = 788;
203         width[0x00C9] = 788;
204         width[0x00CA] = 788;
205         width[0x00CB] = 788;
206         width[0x00CC] = 788;
207         width[0x00CD] = 788;
208         width[0x00CE] = 788;
209         width[0x00CF] = 788;
210         width[0x00D0] = 788;
211         width[0x00D1] = 788;
212         width[0x00D2] = 788;
213         width[0x00D3] = 788;
214         width[0x00D4] = 894;
215         width[0x00D5] = 838;
216         width[0x00D6] = 1016;
217         width[0x00D7] = 458;
218         width[0x00D8] = 748;
219         width[0x00D9] = 924;
220         width[0x00DA] = 748;
221         width[0x00DB] = 918;
222         width[0x00DC] = 927;
223         width[0x00DD] = 928;
224         width[0x00DE] = 928;
225         width[0x00DF] = 834;
226         width[0x00E0] = 873;
227         width[0x00E1] = 828;
228         width[0x00E2] = 924;
229         width[0x00E3] = 924;
230         width[0x00E4] = 917;
231         width[0x00E5] = 930;
232         width[0x00E6] = 931;
233         width[0x00E7] = 463;
234         width[0x00E8] = 883;
235         width[0x00E9] = 836;
236         width[0x00EA] = 836;
237         width[0x00EB] = 867;
238         width[0x00EC] = 867;
239         width[0x00ED] = 696;
240         width[0x00EE] = 696;
241         width[0x00EF] = 874;
242         width[0x00F1] = 874;
243         width[0x00F2] = 760;
244         width[0x00F3] = 946;
245         width[0x00F4] = 771;
246         width[0x00F5] = 865;
247         width[0x00F6] = 771;
248         width[0x00F7] = 888;
249         width[0x00F8] = 967;
250         width[0x00F9] = 888;
251         width[0x00FA] = 831;
252         width[0x00FB] = 873;
253         width[0x00FC] = 927;
254         width[0x00FD] = 970;
255         width[0x00FE] = 918;
256         width[0x0089] = 410;
257         width[0x0087] = 509;
258         width[0x008C] = 334;
259         width[0x0086] = 509;
260         width[0x0080] = 390;
261         width[0x008A] = 234;
262         width[0x0084] = 276;
263         width[0x0081] = 390;
264         width[0x0088] = 410;
265         width[0x0083] = 317;
266         width[0x0082] = 317;
267         width[0x0085] = 276;
268         width[0x008D] = 334;
269         width[0x008B] = 234;
270
271     }
272
273     public String JavaDoc encoding() {
274         return encoding;
275     }
276
277     public String JavaDoc fontName() {
278         return fontName;
279     }
280
281     public int getAscender(int size) {
282         return size * ascender;
283     }
284
285     public int getCapHeight(int size) {
286         return size * capHeight;
287     }
288
289     public int getDescender(int size) {
290         return size * descender;
291     }
292
293     public int getXHeight(int size) {
294         return size * xHeight;
295     }
296
297     public int getFirstChar() {
298         return firstChar;
299     }
300
301     public int getLastChar() {
302         return lastChar;
303     }
304
305     public int width(int i, int size) {
306         return size * width[i];
307     }
308
309     public int[] getWidths(int size) {
310         int[] arr = new int[getLastChar() - getFirstChar() + 1];
311         System.arraycopy(width, getFirstChar(), arr, 0,
312                          getLastChar() - getFirstChar() + 1);
313         for (int i = 0; i < arr.length; i++)
314             arr[i] *= size;
315         return arr;
316     }
317
318 }
319
320
Popular Tags