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 CoverageFormat1 extends Coverage { 29 30 private int glyphCount; 31 private int[] glyphIds; 32 33 34 protected CoverageFormat1(RandomAccessFile raf) throws IOException { 35 glyphCount = raf.readUnsignedShort(); 36 glyphIds = new int[glyphCount]; 37 for (int i = 0; i < glyphCount; i++) { 38 glyphIds[i] = raf.readUnsignedShort(); 39 } 40 } 41 42 public int getFormat() { 43 return 1; 44 } 45 46 public int findGlyph(int glyphId) { 47 for (int i = 0; i < glyphCount; i++) { 48 if (glyphIds[i] == glyphId) { 49 return i; 50 } 51 } 52 return -1; 53 } 54 55 } 56 | Popular Tags |