1 // 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html#License 3 /* 4 ******************************************************************************* 5 * Copyright (C) 1998-2004, International Business Machines Corporation and * 6 * others. All Rights Reserved. * 7 ******************************************************************************* 8 * 9 * Created on Dec 3, 2003 10 * 11 ******************************************************************************* 12 */ 13 package com.ibm.icu.dev.tool.layout; 14 15 import java.io.PrintStream; 16 17 18 public class GSUBWriter extends OpenTypeTableWriter 19 { 20 private ScriptList scriptList; 21 private FeatureList featureList; 22 private LookupList lookupList; 23 private String scriptName; 24 25 public GSUBWriter(String theScriptName, ScriptList theScriptList, FeatureList theFeatureList, 26 LookupList theLookupList) 27 { 28 super(1024); 29 30 scriptList = theScriptList; 31 featureList = theFeatureList; 32 lookupList = theLookupList; 33 scriptName = theScriptName; 34 } 35 36 public void writeTable(PrintStream output) 37 { 38 System.out.println("writing " + scriptName + " GSUB table..."); 39 40 // 0x00010000 (fixed1) version number 41 writeData(0x0001); 42 writeData(0x0000); 43 44 int listOffset = getOutputIndex(); 45 46 writeData(0); // script list offset (fixed later) 47 writeData(0); // feature list offset (fixed later) 48 writeData(0); // lookup list offset (fixed later) 49 50 fixOffset(listOffset++, 0); 51 scriptList.writeScriptList(this); 52 53 fixOffset(listOffset++, 0); 54 featureList.writeFeaturetList(this); 55 56 fixOffset(listOffset++, 0); 57 lookupList.writeLookupList(this); 58 59 output.print("const le_uint8 "); 60 output.print(scriptName); 61 output.println("Shaping::glyphSubstitutionTable[] = {"); 62 63 dumpTable(output, 8); 64 output.println("};\n"); 65 } 66 }