001: /*
002:
003: Licensed to the Apache Software Foundation (ASF) under one or more
004: contributor license agreements. See the NOTICE file distributed with
005: this work for additional information regarding copyright ownership.
006: The ASF licenses this file to You under the Apache License, Version 2.0
007: (the "License"); you may not use this file except in compliance with
008: the License. You may obtain a copy of the License at
009:
010: http://www.apache.org/licenses/LICENSE-2.0
011:
012: Unless required by applicable law or agreed to in writing, software
013: distributed under the License is distributed on an "AS IS" BASIS,
014: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: See the License for the specific language governing permissions and
016: limitations under the License.
017:
018: */
019: package org.apache.batik.svggen.font.table;
020:
021: import java.io.IOException;
022: import java.io.RandomAccessFile;
023:
024: /**
025: * @version $Id: Os2Table.java 475477 2006-11-15 22:44:28Z cam $
026: * @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a>
027: */
028: public class Os2Table implements Table {
029:
030: private int version;
031: private short xAvgCharWidth;
032: private int usWeightClass;
033: private int usWidthClass;
034: private short fsType;
035: private short ySubscriptXSize;
036: private short ySubscriptYSize;
037: private short ySubscriptXOffset;
038: private short ySubscriptYOffset;
039: private short ySuperscriptXSize;
040: private short ySuperscriptYSize;
041: private short ySuperscriptXOffset;
042: private short ySuperscriptYOffset;
043: private short yStrikeoutSize;
044: private short yStrikeoutPosition;
045: private short sFamilyClass;
046: private Panose panose;
047: private int ulUnicodeRange1;
048: private int ulUnicodeRange2;
049: private int ulUnicodeRange3;
050: private int ulUnicodeRange4;
051: private int achVendorID;
052: private short fsSelection;
053: private int usFirstCharIndex;
054: private int usLastCharIndex;
055: private short sTypoAscender;
056: private short sTypoDescender;
057: private short sTypoLineGap;
058: private int usWinAscent;
059: private int usWinDescent;
060: private int ulCodePageRange1;
061: private int ulCodePageRange2;
062:
063: protected Os2Table(DirectoryEntry de, RandomAccessFile raf)
064: throws IOException {
065: raf.seek(de.getOffset());
066: version = raf.readUnsignedShort();
067: xAvgCharWidth = raf.readShort();
068: usWeightClass = raf.readUnsignedShort();
069: usWidthClass = raf.readUnsignedShort();
070: fsType = raf.readShort();
071: ySubscriptXSize = raf.readShort();
072: ySubscriptYSize = raf.readShort();
073: ySubscriptXOffset = raf.readShort();
074: ySubscriptYOffset = raf.readShort();
075: ySuperscriptXSize = raf.readShort();
076: ySuperscriptYSize = raf.readShort();
077: ySuperscriptXOffset = raf.readShort();
078: ySuperscriptYOffset = raf.readShort();
079: yStrikeoutSize = raf.readShort();
080: yStrikeoutPosition = raf.readShort();
081: sFamilyClass = raf.readShort();
082: byte[] buf = new byte[10];
083: raf.read(buf);
084: panose = new Panose(buf);
085: ulUnicodeRange1 = raf.readInt();
086: ulUnicodeRange2 = raf.readInt();
087: ulUnicodeRange3 = raf.readInt();
088: ulUnicodeRange4 = raf.readInt();
089: achVendorID = raf.readInt();
090: fsSelection = raf.readShort();
091: usFirstCharIndex = raf.readUnsignedShort();
092: usLastCharIndex = raf.readUnsignedShort();
093: sTypoAscender = raf.readShort();
094: sTypoDescender = raf.readShort();
095: sTypoLineGap = raf.readShort();
096: usWinAscent = raf.readUnsignedShort();
097: usWinDescent = raf.readUnsignedShort();
098: ulCodePageRange1 = raf.readInt();
099: ulCodePageRange2 = raf.readInt();
100: }
101:
102: public int getVersion() {
103: return version;
104: }
105:
106: public short getAvgCharWidth() {
107: return xAvgCharWidth;
108: }
109:
110: public int getWeightClass() {
111: return usWeightClass;
112: }
113:
114: public int getWidthClass() {
115: return usWidthClass;
116: }
117:
118: public short getLicenseType() {
119: return fsType;
120: }
121:
122: public short getSubscriptXSize() {
123: return ySubscriptXSize;
124: }
125:
126: public short getSubscriptYSize() {
127: return ySubscriptYSize;
128: }
129:
130: public short getSubscriptXOffset() {
131: return ySubscriptXOffset;
132: }
133:
134: public short getSubscriptYOffset() {
135: return ySubscriptYOffset;
136: }
137:
138: public short getSuperscriptXSize() {
139: return ySuperscriptXSize;
140: }
141:
142: public short getSuperscriptYSize() {
143: return ySuperscriptYSize;
144: }
145:
146: public short getSuperscriptXOffset() {
147: return ySuperscriptXOffset;
148: }
149:
150: public short getSuperscriptYOffset() {
151: return ySuperscriptYOffset;
152: }
153:
154: public short getStrikeoutSize() {
155: return yStrikeoutSize;
156: }
157:
158: public short getStrikeoutPosition() {
159: return yStrikeoutPosition;
160: }
161:
162: public short getFamilyClass() {
163: return sFamilyClass;
164: }
165:
166: public Panose getPanose() {
167: return panose;
168: }
169:
170: public int getUnicodeRange1() {
171: return ulUnicodeRange1;
172: }
173:
174: public int getUnicodeRange2() {
175: return ulUnicodeRange2;
176: }
177:
178: public int getUnicodeRange3() {
179: return ulUnicodeRange3;
180: }
181:
182: public int getUnicodeRange4() {
183: return ulUnicodeRange4;
184: }
185:
186: public int getVendorID() {
187: return achVendorID;
188: }
189:
190: public short getSelection() {
191: return fsSelection;
192: }
193:
194: public int getFirstCharIndex() {
195: return usFirstCharIndex;
196: }
197:
198: public int getLastCharIndex() {
199: return usLastCharIndex;
200: }
201:
202: public short getTypoAscender() {
203: return sTypoAscender;
204: }
205:
206: public short getTypoDescender() {
207: return sTypoDescender;
208: }
209:
210: public short getTypoLineGap() {
211: return sTypoLineGap;
212: }
213:
214: public int getWinAscent() {
215: return usWinAscent;
216: }
217:
218: public int getWinDescent() {
219: return usWinDescent;
220: }
221:
222: public int getCodePageRange1() {
223: return ulCodePageRange1;
224: }
225:
226: public int getCodePageRange2() {
227: return ulCodePageRange2;
228: }
229:
230: public int getType() {
231: return OS_2;
232: }
233: }
|