KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2
3    Copyright 2001,2003 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: GsubTable.java,v 1.4 2004/08/18 07:15:21 vhardy Exp $
27  */

28 public class GsubTable implements Table, LookupSubtableFactory {
29
30     private ScriptList scriptList;
31     private FeatureList featureList;
32     private LookupList lookupList;
33     
34     protected GsubTable(DirectoryEntry de, RandomAccessFile JavaDoc raf) throws IOException JavaDoc {
35         raf.seek(de.getOffset());
36
37         // GSUB Header
38
/* int version = */ raf.readInt();
39         int scriptListOffset = raf.readUnsignedShort();
40         int featureListOffset = raf.readUnsignedShort();
41         int lookupListOffset = raf.readUnsignedShort();
42
43         // Script List
44
scriptList = new ScriptList(raf, de.getOffset() + scriptListOffset);
45
46         // Feature List
47
featureList = new FeatureList(raf, de.getOffset() + featureListOffset);
48         
49         // Lookup List
50
lookupList = new LookupList(raf, de.getOffset() + lookupListOffset, this);
51     }
52
53     /**
54      * 1 - Single - Replace one glyph with one glyph
55      * 2 - Multiple - Replace one glyph with more than one glyph
56      * 3 - Alternate - Replace one glyph with one of many glyphs
57      * 4 - Ligature - Replace multiple glyphs with one glyph
58      * 5 - Context - Replace one or more glyphs in context
59      * 6 - Chaining - Context Replace one or more glyphs in chained context
60      */

61     public LookupSubtable read(int type, RandomAccessFile JavaDoc raf, int offset)
62     throws IOException JavaDoc {
63         LookupSubtable s = null;
64         switch (type) {
65         case 1:
66             s = SingleSubst.read(raf, offset);
67             break;
68         case 2:
69 // s = MultipleSubst.read(raf, offset);
70
break;
71         case 3:
72 // s = AlternateSubst.read(raf, offset);
73
break;
74         case 4:
75             s = LigatureSubst.read(raf, offset);
76             break;
77         case 5:
78 // s = ContextSubst.read(raf, offset);
79
break;
80         case 6:
81 // s = ChainingSubst.read(raf, offset);
82
break;
83         }
84         return s;
85     }
86
87     /** Get the table type, as a table directory value.
88      * @return The table type
89      */

90     public int getType() {
91         return GSUB;
92     }
93
94     public ScriptList getScriptList() {
95         return scriptList;
96     }
97
98     public FeatureList getFeatureList() {
99         return featureList;
100     }
101
102     public LookupList getLookupList() {
103         return lookupList;
104     }
105
106     public String JavaDoc toString() {
107         return "GSUB";
108     }
109
110 }
111
Popular Tags