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: HheaTable.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 HheaTable implements Table {
029:
030: private int version;
031: private short ascender;
032: private short descender;
033: private short lineGap;
034: private short advanceWidthMax;
035: private short minLeftSideBearing;
036: private short minRightSideBearing;
037: private short xMaxExtent;
038: private short caretSlopeRise;
039: private short caretSlopeRun;
040: private short metricDataFormat;
041: private int numberOfHMetrics;
042:
043: protected HheaTable(DirectoryEntry de, RandomAccessFile raf)
044: throws IOException {
045: raf.seek(de.getOffset());
046: version = raf.readInt();
047: ascender = raf.readShort();
048: descender = raf.readShort();
049: lineGap = raf.readShort();
050: advanceWidthMax = raf.readShort();
051: minLeftSideBearing = raf.readShort();
052: minRightSideBearing = raf.readShort();
053: xMaxExtent = raf.readShort();
054: caretSlopeRise = raf.readShort();
055: caretSlopeRun = raf.readShort();
056: for (int i = 0; i < 5; i++) {
057: raf.readShort();
058: }
059: metricDataFormat = raf.readShort();
060: numberOfHMetrics = raf.readUnsignedShort();
061: }
062:
063: public short getAdvanceWidthMax() {
064: return advanceWidthMax;
065: }
066:
067: public short getAscender() {
068: return ascender;
069: }
070:
071: public short getCaretSlopeRise() {
072: return caretSlopeRise;
073: }
074:
075: public short getCaretSlopeRun() {
076: return caretSlopeRun;
077: }
078:
079: public short getDescender() {
080: return descender;
081: }
082:
083: public short getLineGap() {
084: return lineGap;
085: }
086:
087: public short getMetricDataFormat() {
088: return metricDataFormat;
089: }
090:
091: public short getMinLeftSideBearing() {
092: return minLeftSideBearing;
093: }
094:
095: public short getMinRightSideBearing() {
096: return minRightSideBearing;
097: }
098:
099: public int getNumberOfHMetrics() {
100: return numberOfHMetrics;
101: }
102:
103: public int getType() {
104: return hhea;
105: }
106:
107: public short getXMaxExtent() {
108: return xMaxExtent;
109: }
110: }
|