KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > svggen > font > table > HeadTable


1 /*
2
3    Copyright 2001 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.svggen.font.table;
19
20 import java.io.IOException JavaDoc;
21 import java.io.RandomAccessFile JavaDoc;
22
23 /**
24  * @version $Id: HeadTable.java,v 1.3 2004/08/18 07:15:21 vhardy Exp $
25  * @author <a HREF="mailto:david@steadystate.co.uk">David Schweinsberg</a>
26  */

27 public class HeadTable implements Table {
28
29     private int versionNumber;
30     private int fontRevision;
31     private int checkSumAdjustment;
32     private int magicNumber;
33     private short flags;
34     private short unitsPerEm;
35     private long created;
36     private long modified;
37     private short xMin;
38     private short yMin;
39     private short xMax;
40     private short yMax;
41     private short macStyle;
42     private short lowestRecPPEM;
43     private short fontDirectionHint;
44     private short indexToLocFormat;
45     private short glyphDataFormat;
46
47     protected HeadTable(DirectoryEntry de,RandomAccessFile JavaDoc raf) throws IOException JavaDoc {
48         raf.seek(de.getOffset());
49         versionNumber = raf.readInt();
50         fontRevision = raf.readInt();
51         checkSumAdjustment = raf.readInt();
52         magicNumber = raf.readInt();
53         flags = raf.readShort();
54         unitsPerEm = raf.readShort();
55         created = raf.readLong();
56         modified = raf.readLong();
57         xMin = raf.readShort();
58         yMin = raf.readShort();
59         xMax = raf.readShort();
60         yMax = raf.readShort();
61         macStyle = raf.readShort();
62         lowestRecPPEM = raf.readShort();
63         fontDirectionHint = raf.readShort();
64         indexToLocFormat = raf.readShort();
65         glyphDataFormat = raf.readShort();
66     }
67
68     public int getCheckSumAdjustment() {
69         return checkSumAdjustment;
70     }
71
72     public long getCreated() {
73         return created;
74     }
75
76     public short getFlags() {
77         return flags;
78     }
79
80     public short getFontDirectionHint() {
81         return fontDirectionHint;
82     }
83
84     public int getFontRevision(){
85         return fontRevision;
86     }
87
88     public short getGlyphDataFormat() {
89         return glyphDataFormat;
90     }
91
92     public short getIndexToLocFormat() {
93         return indexToLocFormat;
94     }
95
96     public short getLowestRecPPEM() {
97         return lowestRecPPEM;
98     }
99
100     public short getMacStyle() {
101         return macStyle;
102     }
103
104     public long getModified() {
105         return modified;
106     }
107
108     public int getType() {
109         return head;
110     }
111
112     public short getUnitsPerEm() {
113         return unitsPerEm;
114     }
115
116     public int getVersionNumber() {
117         return versionNumber;
118     }
119
120     public short getXMax() {
121         return xMax;
122     }
123
124     public short getXMin() {
125         return xMin;
126     }
127
128     public short getYMax() {
129         return yMax;
130     }
131
132     public short getYMin() {
133         return yMin;
134     }
135
136     public String JavaDoc toString() {
137         return new StringBuffer JavaDoc()
138             .append("head\n\tversionNumber: ").append(versionNumber)
139             .append("\n\tfontRevision: ").append(fontRevision)
140             .append("\n\tcheckSumAdjustment: ").append(checkSumAdjustment)
141             .append("\n\tmagicNumber: ").append(magicNumber)
142             .append("\n\tflags: ").append(flags)
143             .append("\n\tunitsPerEm: ").append(unitsPerEm)
144             .append("\n\tcreated: ").append(created)
145             .append("\n\tmodified: ").append(modified)
146             .append("\n\txMin: ").append(xMin)
147             .append(", yMin: ").append(yMin)
148             .append("\n\txMax: ").append(xMax)
149             .append(", yMax: ").append(yMax)
150             .append("\n\tmacStyle: ").append(macStyle)
151             .append("\n\tlowestRecPPEM: ").append(lowestRecPPEM)
152             .append("\n\tfontDirectionHint: ").append(fontDirectionHint)
153             .append("\n\tindexToLocFormat: ").append(indexToLocFormat)
154             .append("\n\tglyphDataFormat: ").append(glyphDataFormat)
155             .toString();
156     }
157 }
158
Popular Tags