1 18 package org.apache.batik.svggen.font.table; 19 20 import java.io.IOException ; 21 import java.io.RandomAccessFile ; 22 23 28 public class CoverageFormat2 extends Coverage { 29 30 private int rangeCount; 31 private RangeRecord[] rangeRecords; 32 33 34 protected CoverageFormat2(RandomAccessFile raf) throws IOException { 35 rangeCount = raf.readUnsignedShort(); 36 rangeRecords = new RangeRecord[rangeCount]; 37 for (int i = 0; i < rangeCount; i++) { 38 rangeRecords[i] = new RangeRecord(raf); 39 } 40 } 41 42 public int getFormat() { 43 return 2; 44 } 45 46 public int findGlyph(int glyphId) { 47 for (int i = 0; i < rangeCount; i++) { 48 int n = rangeRecords[i].getCoverageIndex(glyphId); 49 if (n > -1) { 50 return n; 51 } 52 } 53 return -1; 54 } 55 56 } 57 | Popular Tags |