KickJava   Java API By Example, From Geeks To Geeks.

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


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 name record in the name table.
37  *
38  * @author Ben Litchfield (ben@csh.rit.edu)
39  * @version $Revision: 1.1 $
40  */

41 public class NameRecord
42 {
43     /**
44      * A constant for the platform.
45      */

46     public static final int PLATFORM_APPLE_UNICODE = 0;
47     /**
48      * A constant for the platform.
49      */

50     public static final int PLATFORM_MACINTOSH = 1;
51     /**
52      * A constant for the platform.
53      */

54     public static final int PLATFORM_ISO = 2;
55     /**
56      * A constant for the platform.
57      */

58     public static final int PLATFORM_WINDOWS = 3;
59     
60     /**
61      * Platform specific encoding.
62      */

63     public static final int PLATFORM_ENCODING_WINDOWS_UNDEFINED = 0;
64     /**
65      * Platform specific encoding.
66      */

67     public static final int PLATFORM_ENCODING_WINDOWS_UNICODE = 1;
68     
69     /**
70      * A name id.
71      */

72     public static final int NAME_COPYRIGHT = 0;
73     /**
74      * A name id.
75      */

76     public static final int NAME_FONT_FAMILY_NAME = 1;
77     /**
78      * A name id.
79      */

80     public static final int NAME_FONT_SUB_FAMILY_NAME = 2;
81     /**
82      * A name id.
83      */

84     public static final int NAME_UNIQUE_FONT_ID = 3;
85     /**
86      * A name id.
87      */

88     public static final int NAME_FULL_FONT_NAME = 4;
89     /**
90      * A name id.
91      */

92     public static final int NAME_VERSION = 5;
93     /**
94      * A name id.
95      */

96     public static final int NAME_POSTSCRIPT_NAME = 6;
97     /**
98      * A name id.
99      */

100     public static final int NAME_TRADEMARK = 7;
101     
102     
103     
104     private int platformId;
105     private int platformEncodingId;
106     private int languageId;
107     private int nameId;
108     private int stringLength;
109     private int stringOffset;
110     private String JavaDoc string;
111     
112     /**
113      * @return Returns the stringLength.
114      */

115     public int getStringLength()
116     {
117         return stringLength;
118     }
119     /**
120      * @param stringLengthValue The stringLength to set.
121      */

122     public void setStringLength(int stringLengthValue)
123     {
124         this.stringLength = stringLengthValue;
125     }
126     /**
127      * @return Returns the stringOffset.
128      */

129     public int getStringOffset()
130     {
131         return stringOffset;
132     }
133     /**
134      * @param stringOffsetValue The stringOffset to set.
135      */

136     public void setStringOffset(int stringOffsetValue)
137     {
138         this.stringOffset = stringOffsetValue;
139     }
140     
141     /**
142      * @return Returns the languageId.
143      */

144     public int getLanguageId()
145     {
146         return languageId;
147     }
148     /**
149      * @param languageIdValue The languageId to set.
150      */

151     public void setLanguageId(int languageIdValue)
152     {
153         this.languageId = languageIdValue;
154     }
155     /**
156      * @return Returns the nameId.
157      */

158     public int getNameId()
159     {
160         return nameId;
161     }
162     /**
163      * @param nameIdValue The nameId to set.
164      */

165     public void setNameId(int nameIdValue)
166     {
167         this.nameId = nameIdValue;
168     }
169     /**
170      * @return Returns the platformEncodingId.
171      */

172     public int getPlatformEncodingId()
173     {
174         return platformEncodingId;
175     }
176     /**
177      * @param platformEncodingIdValue The platformEncodingId to set.
178      */

179     public void setPlatformEncodingId(int platformEncodingIdValue)
180     {
181         this.platformEncodingId = platformEncodingIdValue;
182     }
183     /**
184      * @return Returns the platformId.
185      */

186     public int getPlatformId()
187     {
188         return platformId;
189     }
190     /**
191      * @param platformIdValue The platformId to set.
192      */

193     public void setPlatformId(int platformIdValue)
194     {
195         this.platformId = platformIdValue;
196     }
197     
198     /**
199      * This will read the required data from the stream.
200      *
201      * @param ttf The font that is being read.
202      * @param data The stream to read the data from.
203      * @throws IOException If there is an error reading the data.
204      */

205     public void initData( TrueTypeFont ttf, TTFDataStream data ) throws IOException JavaDoc
206     {
207         platformId = data.readUnsignedShort();
208         platformEncodingId = data.readUnsignedShort();
209         languageId = data.readUnsignedShort();
210         nameId = data.readUnsignedShort();
211         stringLength = data.readUnsignedShort();
212         stringOffset = data.readUnsignedShort();
213     }
214     
215     /**
216      * Return a string representation of this class.
217      *
218      * @return A string for this class.
219      */

220     public String JavaDoc toString()
221     {
222         return
223             "platform=" + platformId +
224             " pEncoding=" + platformEncodingId +
225             " language=" + languageId +
226             " name=" + nameId;
227     }
228     /**
229      * @return Returns the string.
230      */

231     public String JavaDoc getString()
232     {
233         return string;
234     }
235     /**
236      * @param stringValue The string to set.
237      */

238     public void setString(String JavaDoc stringValue)
239     {
240         this.string = stringValue;
241     }
242 }
243
Popular Tags