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 SingleSubstFormat1 extends SingleSubst { 29 30 private int coverageOffset; 31 private short deltaGlyphID; 32 private Coverage coverage; 33 34 35 protected SingleSubstFormat1(RandomAccessFile raf, int offset) throws IOException { 36 coverageOffset = raf.readUnsignedShort(); 37 deltaGlyphID = raf.readShort(); 38 raf.seek(offset + coverageOffset); 39 coverage = Coverage.read(raf); 40 } 41 42 public int getFormat() { 43 return 1; 44 } 45 46 public int substitute(int glyphId) { 47 int i = coverage.findGlyph(glyphId); 48 if (i > -1) { 49 return glyphId + deltaGlyphID; 50 } 51 return glyphId; 52 } 53 54 } 55 56 | Popular Tags |