1 18 package org.apache.batik.svggen.font.table; 19 20 import java.io.IOException ; 21 import java.io.RandomAccessFile ; 22 23 27 public class NameTable implements Table { 28 29 private short formatSelector; 30 private short numberOfNameRecords; 31 private short stringStorageOffset; 32 private NameRecord[] records; 33 34 protected NameTable(DirectoryEntry de,RandomAccessFile raf) throws IOException { 35 raf.seek(de.getOffset()); 36 formatSelector = raf.readShort(); 37 numberOfNameRecords = raf.readShort(); 38 stringStorageOffset = raf.readShort(); 39 records = new NameRecord[numberOfNameRecords]; 40 41 for (int i = 0; i < numberOfNameRecords; i++) { 43 records[i] = new NameRecord(raf); 44 } 45 46 for (int i = 0; i < numberOfNameRecords; i++) { 48 records[i].loadString(raf, de.getOffset() + stringStorageOffset); 49 } 50 } 51 52 public String getRecord(short nameId) { 53 54 for (int i = 0; i < numberOfNameRecords; i++) { 56 if (records[i].getNameId() == nameId) { 57 return records[i].getRecordString(); 58 } 59 } 60 return ""; 61 } 62 63 public int getType() { 64 return name; 65 } 66 } 67 | Popular Tags |