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 RangeRecord { 30 31 private int start; 32 private int end; 33 private int startCoverageIndex; 34 35 36 public RangeRecord(RandomAccessFile raf) throws IOException { 37 start = raf.readUnsignedShort(); 38 end = raf.readUnsignedShort(); 39 startCoverageIndex = raf.readUnsignedShort(); 40 } 41 42 public boolean isInRange(int glyphId) { 43 return (start <= glyphId && glyphId <= end); 44 } 45 46 public int getCoverageIndex(int glyphId) { 47 if (isInRange(glyphId)) { 48 return startCoverageIndex + glyphId - start; 49 } 50 return -1; 51 } 52 53 } 54 55 | Popular Tags |