01: /*
02: *******************************************************************************
03: * Copyright (C) 1998-2005, International Business Machines Corporation and *
04: * others. All Rights Reserved. *
05: *******************************************************************************
06: *
07: * Created on Dec 3, 2003
08: *
09: *******************************************************************************
10: */
11: package com.ibm.icu.dev.tool.layout;
12:
13: import java.io.PrintStream;
14:
15: class GDEFWriter extends OpenTypeTableWriter {
16: ClassTable classTable;
17: ClassTable markClassTable;
18: String scriptName;
19:
20: public GDEFWriter(String scriptName, ClassTable classTable,
21: ClassTable markClassTable) {
22: super (1024);
23: this .classTable = classTable;
24: this .markClassTable = markClassTable;
25: this .scriptName = scriptName;
26: }
27:
28: public void writeTable(PrintStream output) {
29: System.out.println("Writing " + scriptName + " GDEF table...");
30:
31: // 0x0001000 (fixed1) version number
32: writeData(0x0001);
33: writeData(0x0000);
34:
35: int classDefOffset = getOutputIndex();
36: writeData(0); // glyphClassDefOffset (will fix later);
37: writeData(0); // attachListOffset
38: writeData(0); // ligCaretListOffset
39: writeData(0); // markAttachClassDefOffset
40:
41: fixOffset(classDefOffset++, 0);
42:
43: System.out.println("Writing glyph class definition table...");
44: classTable.writeClassTable(this );
45:
46: // skip over attachListOffset, ligCaretListOffset
47: classDefOffset += 2;
48:
49: if (markClassTable != null) {
50: fixOffset(classDefOffset, 0);
51:
52: System.out
53: .println("Writing mark attach class definition table...");
54: markClassTable.writeClassTable(this );
55: }
56:
57: output.print("const le_uint8 ");
58: output.print(scriptName);
59: output.println("Shaping::glyphDefinitionTable[] = {");
60:
61: dumpTable(output, 8);
62: output.println("};\n");
63: }
64: }
|