01: /*
02: *******************************************************************************
03: * Copyright (C) 2002-2004, International Business Machines Corporation and *
04: * others. All Rights Reserved. *
05: *******************************************************************************
06: */
07:
08: package com.ibm.icu.dev.tool.layout;
09:
10: class Feature extends TaggedRecord {
11: private int[] lookupIndices;
12: private int lookupCount;
13: private int featureIndex;
14:
15: public Feature(String theFeatureTag) {
16: super (theFeatureTag);
17:
18: lookupIndices = new int[10];
19: lookupCount = 0;
20: featureIndex = -1;
21: }
22:
23: public void addLookup(int theLookupIndex) {
24: if (lookupCount >= lookupIndices.length) {
25: int[] newLookupIndices = new int[lookupIndices.length + 5];
26:
27: System.arraycopy(lookupIndices, 0, newLookupIndices, 0,
28: lookupIndices.length);
29: lookupIndices = newLookupIndices;
30: }
31:
32: lookupIndices[lookupCount] = theLookupIndex;
33: lookupCount += 1;
34: }
35:
36: public void writeFeature(OpenTypeTableWriter writer) {
37: writer.writeData(0); // featureParams (must be NULL)
38:
39: writer.writeData(lookupCount);
40:
41: for (int i = 0; i < lookupCount; i += 1) {
42: writer.writeData(lookupIndices[i]);
43: }
44: }
45:
46: public int getFeatureIndex() {
47: return featureIndex;
48: }
49:
50: public void setFeatureIndex(int index) {
51: featureIndex = index;
52: }
53: }
|