KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > fonts > truetype > TTFMtxEntry


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. 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 /* $Id: TTFMtxEntry.java 426576 2006-07-28 15:44:37Z jeremias $ */
19  
20 package org.apache.fop.fonts.truetype;
21
22 import java.util.List JavaDoc;
23
24 /**
25  * This class represents a TrueType Mtx Entry.
26  */

27 class TTFMtxEntry {
28
29     private int wx;
30     private int lsb;
31     private String JavaDoc name = "";
32     private int index;
33     private List JavaDoc unicodeIndex = new java.util.ArrayList JavaDoc();
34     private int[] boundingBox = new int[4];
35     private long offset;
36     private byte found = 0;
37
38     /**
39      * Returns a String representation of this object.
40      *
41      * @param t TTFFile to use for unit conversion
42      * @return String String representation
43      */

44     public String JavaDoc toString(TTFFile t) {
45         return "Glyph " + name + " index: " + getIndexAsString() + " bbox ["
46              + t.convertTTFUnit2PDFUnit(boundingBox[0]) + " "
47              + t.convertTTFUnit2PDFUnit(boundingBox[1]) + " "
48              + t.convertTTFUnit2PDFUnit(boundingBox[2]) + " "
49              + t.convertTTFUnit2PDFUnit(boundingBox[3]) + "] wx: "
50              + t.convertTTFUnit2PDFUnit(wx);
51     }
52
53     /**
54      * Returns the boundingBox.
55      * @return int[]
56      */

57     public int[] getBoundingBox() {
58         return boundingBox;
59     }
60
61     /**
62      * Sets the boundingBox.
63      * @param boundingBox The boundingBox to set
64      */

65     public void setBoundingBox(int[] boundingBox) {
66         this.boundingBox = boundingBox;
67     }
68
69     /**
70      * Returns the found.
71      * @return byte
72      */

73     public byte getFound() {
74         return found;
75     }
76
77     /**
78      * Returns the index.
79      * @return int
80      */

81     public int getIndex() {
82         return index;
83     }
84         
85     /**
86      * Determines whether this index represents a reserved character.
87      * @return True if it is reserved
88      */

89     public boolean isIndexReserved() {
90         return (getIndex() >= 32768) && (getIndex() <= 65535);
91     }
92     
93     /**
94      * Returns a String representation of the index taking into account if
95      * the index is in the reserved range.
96      * @return index as String
97      */

98     public String JavaDoc getIndexAsString() {
99         if (isIndexReserved()) {
100             return Integer.toString(getIndex()) + " (reserved)";
101         } else {
102             return Integer.toString(getIndex());
103         }
104     }
105
106     /**
107      * Returns the lsb.
108      * @return int
109      */

110     public int getLsb() {
111         return lsb;
112     }
113
114     /**
115      * Returns the name.
116      * @return String
117      */

118     public String JavaDoc getName() {
119         return name;
120     }
121
122     /**
123      * Returns the offset.
124      * @return long
125      */

126     public long getOffset() {
127         return offset;
128     }
129
130     /**
131      * Returns the unicodeIndex.
132      * @return List
133      */

134     public List JavaDoc getUnicodeIndex() {
135         return unicodeIndex;
136     }
137
138     /**
139      * Returns the wx.
140      * @return int
141      */

142     public int getWx() {
143         return wx;
144     }
145
146     /**
147      * Sets the found.
148      * @param found The found to set
149      */

150     public void setFound(byte found) {
151         this.found = found;
152     }
153
154     /**
155      * Sets the index.
156      * @param index The index to set
157      */

158     public void setIndex(int index) {
159         this.index = index;
160     }
161
162     /**
163      * Sets the lsb.
164      * @param lsb The lsb to set
165      */

166     public void setLsb(int lsb) {
167         this.lsb = lsb;
168     }
169
170     /**
171      * Sets the name.
172      * @param name The name to set
173      */

174     public void setName(String JavaDoc name) {
175         this.name = name;
176     }
177
178     /**
179      * Sets the offset.
180      * @param offset The offset to set
181      */

182     public void setOffset(long offset) {
183         this.offset = offset;
184     }
185
186     /**
187      * Sets the wx.
188      * @param wx The wx to set
189      */

190     public void setWx(int wx) {
191         this.wx = wx;
192     }
193
194
195 }
196
Popular Tags