2 *******************************************************************************
3 * Copyright (C) 1998-2004, International Business Machines Corporation and *
4 * others. All Rights Reserved. *
5 *******************************************************************************
7 * Created on Dec 3, 2003
9 *******************************************************************************
11 package com.ibm.icu.dev.tool.layout;
14 public /*abstract*/ class Lookup
16 private int lookupType;
17 private int lookupFlags;
18 private LookupSubtable[] subtables;
19 private int subtableCount;
22 public final static int LF_ReservedBit = 0x0001;
23 public final static int LF_IgnoreBaseGlyphs = 0x0002;
24 public final static int LF_IgnoreLigatures = 0x0004;
25 public final static int LF_IgnoreMarks = 0x0008;
26 public final static int LF_ReservedMask = 0x00F0;
27 public final static int LF_MarkAttachTypeMask = 0xFF00;
28 public final static int LF_MarkAttachTypeShift = 8;
31 public final static int GSST_Single = 1;
32 public final static int GSST_Multiple = 2;
33 public final static int GSST_Alternate = 3;
34 public final static int GSST_Ligature = 4;
35 public final static int GSST_Context = 5;
36 public final static int GSST_ChainingContext = 6;
39 public final static int GPST_Single = 1;
40 public final static int GPST_Pair = 2;
41 public final static int GPST_Cursive = 3;
42 public final static int GPST_MarkToBase = 4;
43 public final static int GPST_MarkToLigature = 5;
44 public final static int GPST_MarkToMark = 6;
45 public final static int GPST_Context = 7;
46 public final static int GPST_ChainingContext = 8;
48 public Lookup(int theLookupType, int theLookupFlags)
50 lookupType = theLookupType;
51 lookupFlags = theLookupFlags;
53 subtables = new LookupSubtable[10];
57 public void addSubtable(LookupSubtable subtable)
59 if (subtableCount >= subtables.length) {
60 LookupSubtable[] newSubtables = new LookupSubtable[subtables.length + 5];
62 System.arraycopy(subtables, 0, newSubtables, 0, subtables.length);
63 subtables = newSubtables;
66 subtables[subtableCount] = subtable;
70 public void writeLookup(OpenTypeTableWriter writer)
72 int lookupBase = writer.getOutputIndex();
74 writer.writeData(lookupType);
75 writer.writeData(lookupFlags);
76 writer.writeData(subtableCount);
78 int subtableOffset = writer.getOutputIndex();
80 for (int i = 0; i < subtableCount; i += 1) {
84 for (int i = 0; i < subtableCount; i += 1) {
85 writer.fixOffset(subtableOffset++, lookupBase);
86 subtables[i].writeLookupSubtable(writer);