1 18 package org.apache.batik.svggen.font.table; 19 20 import java.io.IOException ; 21 import java.io.RandomAccessFile ; 22 23 27 public class CmapIndexEntry { 28 29 private int platformId; 30 private int encodingId; 31 private int offset; 32 33 protected CmapIndexEntry(RandomAccessFile raf) throws IOException { 34 platformId = raf.readUnsignedShort(); 35 encodingId = raf.readUnsignedShort(); 36 offset = raf.readInt(); 37 } 38 39 public int getEncodingId() { 40 return encodingId; 41 } 42 43 public int getOffset() { 44 return offset; 45 } 46 47 public int getPlatformId() { 48 return platformId; 49 } 50 51 public String toString() { 52 String platform; 53 String encoding = ""; 54 55 switch (platformId) { 56 case 1: platform = " (Macintosh)"; break; 57 case 3: platform = " (Windows)"; break; 58 default: platform = ""; 59 } 60 if (platformId == 3) { 61 switch (encodingId) { 63 case 0: encoding = " (Symbol)"; break; 64 case 1: encoding = " (Unicode)"; break; 65 case 2: encoding = " (ShiftJIS)"; break; 66 case 3: encoding = " (Big5)"; break; 67 case 4: encoding = " (PRC)"; break; 68 case 5: encoding = " (Wansung)"; break; 69 case 6: encoding = " (Johab)"; break; 70 default: encoding = ""; 71 } 72 } 73 return new StringBuffer () 74 .append( "platform id: " ) 75 .append( platformId ) 76 .append( platform ) 77 .append( ", encoding id: " ) 78 .append( encodingId ) 79 .append( encoding ) 80 .append( ", offset: " ) 81 .append( offset ).toString(); 82 } 83 } 84 | Popular Tags |