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: Lookup.java 475477 2006-11-15 22:44:28Z cam $
28: */
29: public class Lookup {
30:
31: // LookupFlag bit enumeration
32: public static final int IGNORE_BASE_GLYPHS = 0x0002;
33: public static final int IGNORE_BASE_LIGATURES = 0x0004;
34: public static final int IGNORE_BASE_MARKS = 0x0008;
35: public static final int MARK_ATTACHMENT_TYPE = 0xFF00;
36:
37: private int type;
38: private int flag;
39: private int subTableCount;
40: private int[] subTableOffsets;
41: private LookupSubtable[] subTables;
42:
43: /** Creates new Lookup */
44: public Lookup(LookupSubtableFactory factory, RandomAccessFile raf,
45: int offset) throws IOException {
46: raf.seek(offset);
47: type = raf.readUnsignedShort();
48: flag = raf.readUnsignedShort();
49: subTableCount = raf.readUnsignedShort();
50: subTableOffsets = new int[subTableCount];
51: subTables = new LookupSubtable[subTableCount];
52: for (int i = 0; i < subTableCount; i++) {
53: subTableOffsets[i] = raf.readUnsignedShort();
54: }
55: for (int i = 0; i < subTableCount; i++) {
56: subTables[i] = factory.read(type, raf, offset
57: + subTableOffsets[i]);
58: }
59: }
60:
61: public int getType() {
62: return type;
63: }
64:
65: public int getSubtableCount() {
66: return subTableCount;
67: }
68:
69: public LookupSubtable getSubtable(int i) {
70: return subTables[i];
71: }
72:
73: }
|