01: /*
02:
03: Licensed to the Apache Software Foundation (ASF) under one or more
04: contributor license agreements. See the NOTICE file distributed with
05: this work for additional information regarding copyright ownership.
06: The ASF licenses this file to You under the Apache License, Version 2.0
07: (the "License"); you may not use this file except in compliance with
08: the License. You may obtain a copy of the License at
09:
10: http://www.apache.org/licenses/LICENSE-2.0
11:
12: Unless required by applicable law or agreed to in writing, software
13: distributed under the License is distributed on an "AS IS" BASIS,
14: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: See the License for the specific language governing permissions and
16: limitations under the License.
17:
18: */
19: package org.apache.batik.svggen.font.table;
20:
21: import java.io.IOException;
22: import java.io.RandomAccessFile;
23:
24: /**
25: *
26: * @author <a href="mailto:david@steadystate.co.uk">David Schweinsberg</a>
27: * @version $Id: KernSubtable.java 475477 2006-11-15 22:44:28Z cam $
28: */
29: public abstract class KernSubtable {
30:
31: /** Creates new KernSubtable */
32: protected KernSubtable() {
33: }
34:
35: public abstract int getKerningPairCount();
36:
37: public abstract KerningPair getKerningPair(int i);
38:
39: public static KernSubtable read(RandomAccessFile raf)
40: throws IOException {
41: KernSubtable table = null;
42: /* int version =*/raf.readUnsignedShort();
43: /* int length =*/raf.readUnsignedShort();
44: int coverage = raf.readUnsignedShort();
45: int format = coverage >> 8;
46:
47: switch (format) {
48: case 0:
49: table = new KernSubtableFormat0(raf);
50: break;
51: case 2:
52: table = new KernSubtableFormat2(raf);
53: break;
54: default:
55: break;
56: }
57: return table;
58: }
59:
60: }
|