1 18 package org.apache.batik.svggen.font.table; 19 20 import java.io.IOException ; 21 import java.io.RandomAccessFile ; 22 23 27 public abstract class CmapFormat { 28 29 protected int format; 30 protected int length; 31 protected int version; 32 33 protected CmapFormat(RandomAccessFile raf) throws IOException { 34 length = raf.readUnsignedShort(); 35 version = raf.readUnsignedShort(); 36 } 37 38 protected static CmapFormat create(int format, RandomAccessFile raf) 39 throws IOException { 40 switch(format) { 41 case 0: 42 return new CmapFormat0(raf); 43 case 2: 44 return new CmapFormat2(raf); 45 case 4: 46 return new CmapFormat4(raf); 47 case 6: 48 return new CmapFormat6(raf); 49 } 50 return null; 51 } 52 53 public int getFormat() { 54 return format; 55 } 56 57 public int getLength() { 58 return length; 59 } 60 61 public int getVersion() { 62 return version; 63 } 64 65 public abstract int mapCharCode(int charCode); 66 67 public abstract int getFirst(); 68 public abstract int getLast(); 69 70 public String toString() { 71 return new StringBuffer () 72 .append("format: ") 73 .append(format) 74 .append(", length: ") 75 .append(length) 76 .append(", version: ") 77 .append(version).toString(); 78 } 79 } 80 | Popular Tags |