1 18 package org.apache.batik.svggen.font.table; 19 20 import java.io.IOException ; 21 import java.io.RandomAccessFile ; 22 23 29 public class CmapFormat0 extends CmapFormat { 30 31 private int[] glyphIdArray = new int[256]; 32 private int first, last; 33 34 protected CmapFormat0(RandomAccessFile raf) throws IOException { 35 super(raf); 36 format = 0; 37 first = -1; 38 for (int i = 0; i < 256; i++) { 39 glyphIdArray[i] = raf.readUnsignedByte(); 40 if (glyphIdArray[i] > 0) { 41 if (first == -1) first = i; 42 last = i; 43 } 44 } 45 } 46 47 public int getFirst() { return first; } 48 public int getLast() { return last; } 49 50 public int mapCharCode(int charCode) { 51 if (0 <= charCode && charCode < 256) { 52 return glyphIdArray[charCode]; 53 } else { 54 return 0; 55 } 56 } 57 } 58 | Popular Tags |