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 package com.ibm.icu.dev.tool.layout; 10 11 /** 12 * @author emader 13 * 14 */ 15 public class OpenTypeTagBuilder 16 { 17 private static String[] tableTags = { 18 "acnt", 19 "avar", 20 "BASE", 21 "bdat", 22 "bhed", 23 "bloc", 24 "bsln", 25 "CFF ", 26 "cmap", 27 "cvar", 28 "cvt ", 29 "DSIG", 30 "EBDT", 31 "EBLC", 32 "EBSC", 33 "fdsc", 34 "feat", 35 "fmtx", 36 "fpgm", 37 "fvar", 38 "gasp", 39 "GDEF", 40 "glyf", 41 "GPOS", 42 "GSUB", 43 "gvar", 44 "hdmx", 45 "head", 46 "hhea", 47 "hmtx", 48 "hsty", 49 "just", 50 "JSTF", 51 "kern", 52 "lcar", 53 "loca", 54 "LTSH", 55 "maxp", 56 "mort", 57 "morx", 58 "name", 59 "opbd", 60 "OS/2", 61 "PCLT", 62 "post", 63 "prep", 64 "prop", 65 "trak", 66 "VDMX", 67 "vhea", 68 "vmtx", 69 "VORG", 70 "Zapf" 71 }; 72 73 private static String[] featureTags = { 74 "aalt", 75 "abvf", 76 "abvm", 77 "abvs", 78 "afrc", 79 "akhn", 80 "blwf", 81 "blwm", 82 "blws", 83 "calt", 84 "case", 85 "ccmp", 86 "clig", 87 "cpsp", 88 "cswh", 89 "curs", 90 "c2sc", 91 "c2pc", 92 "dist", 93 "dlig", 94 "dnom", 95 "expt", 96 "falt", 97 "fin2", 98 "fin3", 99 "fina", 100 "frac", 101 "fwid", 102 "half", 103 "haln", 104 "halt", 105 "hist", 106 "hkna", 107 "hlig", 108 "hngl", 109 "hwid", 110 "init", 111 "isol", 112 "ital", 113 "jalt", 114 "jp78", 115 "jp83", 116 "jp90", 117 "kern", 118 "lfbd", 119 "liga", 120 "ljmo", 121 "lnum", 122 "locl", 123 "mark", 124 "med2", 125 "medi", 126 "mgrk", 127 "mkmk", 128 "mset", 129 "nalt", 130 "nlck", 131 "nukt", 132 "numr", 133 "onum", 134 "opbd", 135 "ordn", 136 "ornm", 137 "palt", 138 "pcap", 139 "pnum", 140 "pref", 141 "pres", 142 "pstf", 143 "psts", 144 "pwid", 145 "qwid", 146 "rand", 147 "rlig", 148 "rphf", 149 "rtbd", 150 "rtla", 151 "ruby", 152 "salt", 153 "sinf", 154 "size", 155 "smcp", 156 "smpl", 157 "ss01", 158 "ss02", 159 "ss03", 160 "ss04", 161 "ss05", 162 "ss06", 163 "ss07", 164 "ss08", 165 "ss09", 166 "ss10", 167 "ss11", 168 "ss12", 169 "ss13", 170 "ss14", 171 "ss15", 172 "ss16", 173 "ss17", 174 "ss18", 175 "ss19", 176 "ss20", 177 "subs", 178 "sups", 179 "swsh", 180 "titl", 181 "tjmo", 182 "tnam", 183 "tnum", 184 "trad", 185 "twid", 186 "unic", 187 "valt", 188 "vatu", 189 "vert", 190 "vhal", 191 "vjmo", 192 "vkna", 193 "vkrn", 194 "vpal", 195 "vrt2", 196 "zero" 197 }; 198 199 private static String tagLabel(String tag) 200 { 201 StringBuffer result = new StringBuffer(); 202 String upperTag = tag.toUpperCase(); 203 204 for (int i = 0; i < upperTag.length(); i += 1) { 205 char ch = upperTag.charAt(i); 206 207 if ((ch < 'A' || ch > 'Z') && (ch < '0' || ch > '9')) { 208 ch = '_'; 209 } 210 211 result.append(ch); 212 } 213 214 return result.toString(); 215 } 216 217 private static void dumpTags(String enumName, String[] tags) 218 { 219 System.out.println("enum LE" + enumName + "Tags {"); 220 221 for (int i = 0; i < tags.length; i += 1) { 222 String tag = tags[i]; 223 224 System.out.println(" LE_" + tagLabel(tag) + "_" + enumName.toUpperCase() + 225 "_TAG = " + TagUtilities.makeTag(tag) + "UL" + 226 (i == tags.length - 1? " " : ",") + " /* '" + tag + "' */"); 227 } 228 229 System.out.println("};"); 230 } 231 232 public static void main(String[] args) 233 { 234 dumpTags("Table", tableTags); 235 dumpTags("Feature", featureTags); 236 } 237 } 238