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: HeadTable.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 HeadTable implements Table {
029:
030: private int versionNumber;
031: private int fontRevision;
032: private int checkSumAdjustment;
033: private int magicNumber;
034: private short flags;
035: private short unitsPerEm;
036: private long created;
037: private long modified;
038: private short xMin;
039: private short yMin;
040: private short xMax;
041: private short yMax;
042: private short macStyle;
043: private short lowestRecPPEM;
044: private short fontDirectionHint;
045: private short indexToLocFormat;
046: private short glyphDataFormat;
047:
048: protected HeadTable(DirectoryEntry de, RandomAccessFile raf)
049: throws IOException {
050: raf.seek(de.getOffset());
051: versionNumber = raf.readInt();
052: fontRevision = raf.readInt();
053: checkSumAdjustment = raf.readInt();
054: magicNumber = raf.readInt();
055: flags = raf.readShort();
056: unitsPerEm = raf.readShort();
057: created = raf.readLong();
058: modified = raf.readLong();
059: xMin = raf.readShort();
060: yMin = raf.readShort();
061: xMax = raf.readShort();
062: yMax = raf.readShort();
063: macStyle = raf.readShort();
064: lowestRecPPEM = raf.readShort();
065: fontDirectionHint = raf.readShort();
066: indexToLocFormat = raf.readShort();
067: glyphDataFormat = raf.readShort();
068: }
069:
070: public int getCheckSumAdjustment() {
071: return checkSumAdjustment;
072: }
073:
074: public long getCreated() {
075: return created;
076: }
077:
078: public short getFlags() {
079: return flags;
080: }
081:
082: public short getFontDirectionHint() {
083: return fontDirectionHint;
084: }
085:
086: public int getFontRevision() {
087: return fontRevision;
088: }
089:
090: public short getGlyphDataFormat() {
091: return glyphDataFormat;
092: }
093:
094: public short getIndexToLocFormat() {
095: return indexToLocFormat;
096: }
097:
098: public short getLowestRecPPEM() {
099: return lowestRecPPEM;
100: }
101:
102: public short getMacStyle() {
103: return macStyle;
104: }
105:
106: public long getModified() {
107: return modified;
108: }
109:
110: public int getType() {
111: return head;
112: }
113:
114: public short getUnitsPerEm() {
115: return unitsPerEm;
116: }
117:
118: public int getVersionNumber() {
119: return versionNumber;
120: }
121:
122: public short getXMax() {
123: return xMax;
124: }
125:
126: public short getXMin() {
127: return xMin;
128: }
129:
130: public short getYMax() {
131: return yMax;
132: }
133:
134: public short getYMin() {
135: return yMin;
136: }
137:
138: public String toString() {
139: return new StringBuffer().append("head\n\tversionNumber: ")
140: .append(versionNumber).append("\n\tfontRevision: ")
141: .append(fontRevision)
142: .append("\n\tcheckSumAdjustment: ").append(
143: checkSumAdjustment).append("\n\tmagicNumber: ")
144: .append(magicNumber).append("\n\tflags: ")
145: .append(flags).append("\n\tunitsPerEm: ").append(
146: unitsPerEm).append("\n\tcreated: ").append(
147: created).append("\n\tmodified: ").append(
148: modified).append("\n\txMin: ").append(xMin)
149: .append(", yMin: ").append(yMin).append("\n\txMax: ")
150: .append(xMax).append(", yMax: ").append(yMax).append(
151: "\n\tmacStyle: ").append(macStyle).append(
152: "\n\tlowestRecPPEM: ").append(lowestRecPPEM)
153: .append("\n\tfontDirectionHint: ").append(
154: fontDirectionHint).append(
155: "\n\tindexToLocFormat: ").append(
156: indexToLocFormat).append(
157: "\n\tglyphDataFormat: ")
158: .append(glyphDataFormat).toString();
159: }
160: }
|