KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > pdfbox > ttf > HeaderTable


1 /**
2  * Copyright (c) 2004, 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.ttf;
32
33 import java.io.IOException JavaDoc;
34 import java.util.Calendar JavaDoc;
35
36 /**
37  * A table in a true type font.
38  *
39  * @author Ben Litchfield (ben@csh.rit.edu)
40  * @version $Revision: 1.1 $
41  */

42 public class HeaderTable extends TTFTable
43 {
44     /**
45      * Tag to identify this table.
46      */

47     public static final String JavaDoc TAG = "head";
48     
49     private float version;
50     private float fontRevision;
51     private long checkSumAdjustment;
52     private long magicNumber;
53     private int flags;
54     private int unitsPerEm;
55     private Calendar JavaDoc created;
56     private Calendar JavaDoc modified;
57     private short xMin;
58     private short yMin;
59     private short xMax;
60     private short yMax;
61     private int macStyle;
62     private int lowestRecPPEM;
63     private short fontDirectionHint;
64     private short indexToLocFormat;
65     private short glyphDataFormat;
66     
67     /**
68      * This will read the required data from the stream.
69      *
70      * @param ttf The font that is being read.
71      * @param data The stream to read the data from.
72      * @throws IOException If there is an error reading the data.
73      */

74     public void initData( TrueTypeFont ttf, TTFDataStream data ) throws IOException JavaDoc
75     {
76         version = data.read32Fixed();
77         fontRevision = data.read32Fixed();
78         checkSumAdjustment = data.readUnsignedInt();
79         magicNumber = data.readUnsignedInt();
80         flags = data.readUnsignedShort();
81         unitsPerEm = data.readUnsignedShort();
82         created = data.readInternationalDate();
83         modified = data.readInternationalDate();
84         xMin = data.readSignedShort();
85         yMin = data.readSignedShort();
86         xMax = data.readSignedShort();
87         yMax = data.readSignedShort();
88         macStyle = data.readUnsignedShort();
89         lowestRecPPEM = data.readUnsignedShort();
90         fontDirectionHint = data.readSignedShort();
91         indexToLocFormat = data.readSignedShort();
92         glyphDataFormat = data.readSignedShort();
93     }
94     /**
95      * @return Returns the checkSumAdjustment.
96      */

97     public long getCheckSumAdjustment()
98     {
99         return checkSumAdjustment;
100     }
101     /**
102      * @param checkSumAdjustmentValue The checkSumAdjustment to set.
103      */

104     public void setCheckSumAdjustment(long checkSumAdjustmentValue)
105     {
106         this.checkSumAdjustment = checkSumAdjustmentValue;
107     }
108     /**
109      * @return Returns the created.
110      */

111     public Calendar JavaDoc getCreated()
112     {
113         return created;
114     }
115     /**
116      * @param createdValue The created to set.
117      */

118     public void setCreated(Calendar JavaDoc createdValue)
119     {
120         this.created = createdValue;
121     }
122     /**
123      * @return Returns the flags.
124      */

125     public int getFlags()
126     {
127         return flags;
128     }
129     /**
130      * @param flagsValue The flags to set.
131      */

132     public void setFlags(int flagsValue)
133     {
134         this.flags = flagsValue;
135     }
136     /**
137      * @return Returns the fontDirectionHint.
138      */

139     public short getFontDirectionHint()
140     {
141         return fontDirectionHint;
142     }
143     /**
144      * @param fontDirectionHintValue The fontDirectionHint to set.
145      */

146     public void setFontDirectionHint(short fontDirectionHintValue)
147     {
148         this.fontDirectionHint = fontDirectionHintValue;
149     }
150     /**
151      * @return Returns the fontRevision.
152      */

153     public float getFontRevision()
154     {
155         return fontRevision;
156     }
157     /**
158      * @param fontRevisionValue The fontRevision to set.
159      */

160     public void setFontRevision(float fontRevisionValue)
161     {
162         this.fontRevision = fontRevisionValue;
163     }
164     /**
165      * @return Returns the glyphDataFormat.
166      */

167     public short getGlyphDataFormat()
168     {
169         return glyphDataFormat;
170     }
171     /**
172      * @param glyphDataFormatValue The glyphDataFormat to set.
173      */

174     public void setGlyphDataFormat(short glyphDataFormatValue)
175     {
176         this.glyphDataFormat = glyphDataFormatValue;
177     }
178     /**
179      * @return Returns the indexToLocFormat.
180      */

181     public short getIndexToLocFormat()
182     {
183         return indexToLocFormat;
184     }
185     /**
186      * @param indexToLocFormatValue The indexToLocFormat to set.
187      */

188     public void setIndexToLocFormat(short indexToLocFormatValue)
189     {
190         this.indexToLocFormat = indexToLocFormatValue;
191     }
192     /**
193      * @return Returns the lowestRecPPEM.
194      */

195     public int getLowestRecPPEM()
196     {
197         return lowestRecPPEM;
198     }
199     /**
200      * @param lowestRecPPEMValue The lowestRecPPEM to set.
201      */

202     public void setLowestRecPPEM(int lowestRecPPEMValue)
203     {
204         this.lowestRecPPEM = lowestRecPPEMValue;
205     }
206     /**
207      * @return Returns the macStyle.
208      */

209     public int getMacStyle()
210     {
211         return macStyle;
212     }
213     /**
214      * @param macStyleValue The macStyle to set.
215      */

216     public void setMacStyle(int macStyleValue)
217     {
218         this.macStyle = macStyleValue;
219     }
220     /**
221      * @return Returns the magicNumber.
222      */

223     public long getMagicNumber()
224     {
225         return magicNumber;
226     }
227     /**
228      * @param magicNumberValue The magicNumber to set.
229      */

230     public void setMagicNumber(long magicNumberValue)
231     {
232         this.magicNumber = magicNumberValue;
233     }
234     /**
235      * @return Returns the modified.
236      */

237     public Calendar JavaDoc getModified()
238     {
239         return modified;
240     }
241     /**
242      * @param modifiedValue The modified to set.
243      */

244     public void setModified(Calendar JavaDoc modifiedValue)
245     {
246         this.modified = modifiedValue;
247     }
248     /**
249      * @return Returns the unitsPerEm.
250      */

251     public int getUnitsPerEm()
252     {
253         return unitsPerEm;
254     }
255     /**
256      * @param unitsPerEmValue The unitsPerEm to set.
257      */

258     public void setUnitsPerEm(int unitsPerEmValue)
259     {
260         this.unitsPerEm = unitsPerEmValue;
261     }
262     /**
263      * @return Returns the version.
264      */

265     public float getVersion()
266     {
267         return version;
268     }
269     /**
270      * @param versionValue The version to set.
271      */

272     public void setVersion(float versionValue)
273     {
274         this.version = versionValue;
275     }
276     /**
277      * @return Returns the xMax.
278      */

279     public short getXMax()
280     {
281         return xMax;
282     }
283     /**
284      * @param maxValue The xMax to set.
285      */

286     public void setXMax(short maxValue)
287     {
288         xMax = maxValue;
289     }
290     /**
291      * @return Returns the xMin.
292      */

293     public short getXMin()
294     {
295         return xMin;
296     }
297     /**
298      * @param minValue The xMin to set.
299      */

300     public void setXMin(short minValue)
301     {
302         xMin = minValue;
303     }
304     /**
305      * @return Returns the yMax.
306      */

307     public short getYMax()
308     {
309         return yMax;
310     }
311     /**
312      * @param maxValue The yMax to set.
313      */

314     public void setYMax(short maxValue)
315     {
316         yMax = maxValue;
317     }
318     /**
319      * @return Returns the yMin.
320      */

321     public short getYMin()
322     {
323         return yMin;
324     }
325     /**
326      * @param minValue The yMin to set.
327      */

328     public void setYMin(short minValue)
329     {
330         yMin = minValue;
331     }
332 }
333
Popular Tags