KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > svggen > font > table > Lookup


1 /*
2
3    Copyright 2001 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.svggen.font.table;
19
20 import java.io.IOException JavaDoc;
21 import java.io.RandomAccessFile JavaDoc;
22
23 /**
24  *
25  * @author <a HREF="mailto:david@steadystate.co.uk">David Schweinsberg</a>
26  * @version $Id: Lookup.java,v 1.3 2004/08/18 07:15:21 vhardy Exp $
27  */

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