KickJava   Java API By Example, From Geeks To Geeks.

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


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
35 /**
36  * A table in a true type font.
37  *
38  * @author Ben Litchfield (ben@csh.rit.edu)
39  * @version $Revision: 1.1 $
40  */

41 public class HorizontalHeaderTable extends TTFTable
42 {
43     /**
44      * A tag that identifies this table type.
45      */

46     public static final String JavaDoc TAG = "hhea";
47     
48     private float version;
49     private short ascender;
50     private short descender;
51     private short lineGap;
52     private int advanceWidthMax;
53     private short minLeftSideBearing;
54     private short minRightSideBearing;
55     private short xMaxExtent;
56     private short caretSlopeRise;
57     private short caretSlopeRun;
58     private short reserved1;
59     private short reserved2;
60     private short reserved3;
61     private short reserved4;
62     private short reserved5;
63     private short metricDataFormat;
64     private int numberOfHMetrics;
65     
66     /**
67      * This will read the required data from the stream.
68      *
69      * @param ttf The font that is being read.
70      * @param data The stream to read the data from.
71      * @throws IOException If there is an error reading the data.
72      */

73     public void initData( TrueTypeFont ttf, TTFDataStream data ) throws IOException JavaDoc
74     {
75         version = data.read32Fixed();
76         ascender = data.readSignedShort();
77         descender = data.readSignedShort();
78         lineGap = data.readSignedShort();
79         advanceWidthMax = data.readUnsignedShort();
80         minLeftSideBearing = data.readSignedShort();
81         minRightSideBearing = data.readSignedShort();
82         xMaxExtent = data.readSignedShort();
83         caretSlopeRise = data.readSignedShort();
84         caretSlopeRun = data.readSignedShort();
85         reserved1 = data.readSignedShort();
86         reserved2 = data.readSignedShort();
87         reserved3 = data.readSignedShort();
88         reserved4 = data.readSignedShort();
89         reserved5 = data.readSignedShort();
90         metricDataFormat = data.readSignedShort();
91         numberOfHMetrics = data.readUnsignedShort();
92     }
93     
94     /**
95      * @return Returns the advanceWidthMax.
96      */

97     public int getAdvanceWidthMax()
98     {
99         return advanceWidthMax;
100     }
101     /**
102      * @param advanceWidthMaxValue The advanceWidthMax to set.
103      */

104     public void setAdvanceWidthMax(int advanceWidthMaxValue)
105     {
106         this.advanceWidthMax = advanceWidthMaxValue;
107     }
108     /**
109      * @return Returns the ascender.
110      */

111     public short getAscender()
112     {
113         return ascender;
114     }
115     /**
116      * @param ascenderValue The ascender to set.
117      */

118     public void setAscender(short ascenderValue)
119     {
120         this.ascender = ascenderValue;
121     }
122     /**
123      * @return Returns the caretSlopeRise.
124      */

125     public short getCaretSlopeRise()
126     {
127         return caretSlopeRise;
128     }
129     /**
130      * @param caretSlopeRiseValue The caretSlopeRise to set.
131      */

132     public void setCaretSlopeRise(short caretSlopeRiseValue)
133     {
134         this.caretSlopeRise = caretSlopeRiseValue;
135     }
136     /**
137      * @return Returns the caretSlopeRun.
138      */

139     public short getCaretSlopeRun()
140     {
141         return caretSlopeRun;
142     }
143     /**
144      * @param caretSlopeRunValue The caretSlopeRun to set.
145      */

146     public void setCaretSlopeRun(short caretSlopeRunValue)
147     {
148         this.caretSlopeRun = caretSlopeRunValue;
149     }
150     /**
151      * @return Returns the descender.
152      */

153     public short getDescender()
154     {
155         return descender;
156     }
157     /**
158      * @param descenderValue The descender to set.
159      */

160     public void setDescender(short descenderValue)
161     {
162         this.descender = descenderValue;
163     }
164     /**
165      * @return Returns the lineGap.
166      */

167     public short getLineGap()
168     {
169         return lineGap;
170     }
171     /**
172      * @param lineGapValue The lineGap to set.
173      */

174     public void setLineGap(short lineGapValue)
175     {
176         this.lineGap = lineGapValue;
177     }
178     /**
179      * @return Returns the metricDataFormat.
180      */

181     public short getMetricDataFormat()
182     {
183         return metricDataFormat;
184     }
185     /**
186      * @param metricDataFormatValue The metricDataFormat to set.
187      */

188     public void setMetricDataFormat(short metricDataFormatValue)
189     {
190         this.metricDataFormat = metricDataFormatValue;
191     }
192     /**
193      * @return Returns the minLeftSideBearing.
194      */

195     public short getMinLeftSideBearing()
196     {
197         return minLeftSideBearing;
198     }
199     /**
200      * @param minLeftSideBearingValue The minLeftSideBearing to set.
201      */

202     public void setMinLeftSideBearing(short minLeftSideBearingValue)
203     {
204         this.minLeftSideBearing = minLeftSideBearingValue;
205     }
206     /**
207      * @return Returns the minRightSideBearing.
208      */

209     public short getMinRightSideBearing()
210     {
211         return minRightSideBearing;
212     }
213     /**
214      * @param minRightSideBearingValue The minRightSideBearing to set.
215      */

216     public void setMinRightSideBearing(short minRightSideBearingValue)
217     {
218         this.minRightSideBearing = minRightSideBearingValue;
219     }
220     /**
221      * @return Returns the numberOfHMetrics.
222      */

223     public int getNumberOfHMetrics()
224     {
225         return numberOfHMetrics;
226     }
227     /**
228      * @param numberOfHMetricsValue The numberOfHMetrics to set.
229      */

230     public void setNumberOfHMetrics(int numberOfHMetricsValue)
231     {
232         this.numberOfHMetrics = numberOfHMetricsValue;
233     }
234     /**
235      * @return Returns the reserved1.
236      */

237     public short getReserved1()
238     {
239         return reserved1;
240     }
241     /**
242      * @param reserved1Value The reserved1 to set.
243      */

244     public void setReserved1(short reserved1Value)
245     {
246         this.reserved1 = reserved1Value;
247     }
248     /**
249      * @return Returns the reserved2.
250      */

251     public short getReserved2()
252     {
253         return reserved2;
254     }
255     /**
256      * @param reserved2Value The reserved2 to set.
257      */

258     public void setReserved2(short reserved2Value)
259     {
260         this.reserved2 = reserved2Value;
261     }
262     /**
263      * @return Returns the reserved3.
264      */

265     public short getReserved3()
266     {
267         return reserved3;
268     }
269     /**
270      * @param reserved3Value The reserved3 to set.
271      */

272     public void setReserved3(short reserved3Value)
273     {
274         this.reserved3 = reserved3Value;
275     }
276     /**
277      * @return Returns the reserved4.
278      */

279     public short getReserved4()
280     {
281         return reserved4;
282     }
283     /**
284      * @param reserved4Value The reserved4 to set.
285      */

286     public void setReserved4(short reserved4Value)
287     {
288         this.reserved4 = reserved4Value;
289     }
290     /**
291      * @return Returns the reserved5.
292      */

293     public short getReserved5()
294     {
295         return reserved5;
296     }
297     /**
298      * @param reserved5Value The reserved5 to set.
299      */

300     public void setReserved5(short reserved5Value)
301     {
302         this.reserved5 = reserved5Value;
303     }
304     /**
305      * @return Returns the version.
306      */

307     public float getVersion()
308     {
309         return version;
310     }
311     /**
312      * @param versionValue The version to set.
313      */

314     public void setVersion(float versionValue)
315     {
316         this.version = versionValue;
317     }
318     /**
319      * @return Returns the xMaxExtent.
320      */

321     public short getXMaxExtent()
322     {
323         return xMaxExtent;
324     }
325     /**
326      * @param maxExtentValue The xMaxExtent to set.
327      */

328     public void setXMaxExtent(short maxExtentValue)
329     {
330         xMaxExtent = maxExtentValue;
331     }
332 }
333
Popular Tags