public static SingleSubst read(RandomAccessFileEmulator raf, int offset) throws IOException {
   SingleSubst s = null;
   raf.seek(offset);
   int format = raf.readUnsignedShort();
   if (format == 1) {
     s = new SingleSubstFormat1(raf, offset);
   } else if (format == 2) {
     s = new SingleSubstFormat2(raf, offset);
   }
   return s;
 }
Exemplo n.º 2
0
  protected NameTable(DirectoryEntry de, RandomAccessFileEmulator raf) throws IOException {
    raf.seek(de.getOffset());
    formatSelector = raf.readShort();
    numberOfNameRecords = raf.readShort();
    stringStorageOffset = raf.readShort();
    records = new NameRecord[numberOfNameRecords];

    // Load the records, which contain the encoding information and string offsets
    for (int i = 0; i < numberOfNameRecords; i++) {
      records[i] = new NameRecord(raf);
    }

    // Now load the strings
    for (int i = 0; i < numberOfNameRecords; i++) {
      records[i].loadString(raf, de.getOffset() + stringStorageOffset);
    }
  }
Exemplo n.º 3
0
  protected CmapFormat4(RandomAccessFileEmulator raf) throws IOException {
    super(raf);
    format = 4;
    segCountX2 = raf.readUnsignedShort();
    segCount = segCountX2 / 2;
    endCode = new int[segCount];
    startCode = new int[segCount];
    idDelta = new int[segCount];
    idRangeOffset = new int[segCount];
    searchRange = raf.readUnsignedShort();
    entrySelector = raf.readUnsignedShort();
    rangeShift = raf.readUnsignedShort();
    last = -1;
    for (int i = 0; i < segCount; i++) {
      endCode[i] = raf.readUnsignedShort();
      if (endCode[i] > last) last = endCode[i];
    }
    raf.readUnsignedShort(); // reservePad
    for (int i = 0; i < segCount; i++) {
      startCode[i] = raf.readUnsignedShort();
      if ((i == 0) || (startCode[i] < first)) first = startCode[i];
    }
    for (int i = 0; i < segCount; i++) {
      idDelta[i] = raf.readUnsignedShort();
    }
    for (int i = 0; i < segCount; i++) {
      idRangeOffset[i] = raf.readUnsignedShort();
    }

    // Whatever remains of this header belongs in glyphIdArray
    int count = (length - 16 - (segCount * 8)) / 2;
    glyphIdArray = new int[count];
    for (int i = 0; i < count; i++) {
      glyphIdArray[i] = raf.readUnsignedShort();
    }
  }
Exemplo n.º 4
0
 protected FpgmTable(DirectoryEntry de, RandomAccessFileEmulator raf) throws IOException {
   raf.seek(de.getOffset());
   readInstructions(raf, de.getLength());
 }
Exemplo n.º 5
0
 protected HeadTable(DirectoryEntry de, RandomAccessFileEmulator raf) throws IOException {
   raf.seek(de.getOffset());
   versionNumber = raf.readInt();
   fontRevision = raf.readInt();
   checkSumAdjustment = raf.readInt();
   magicNumber = raf.readInt();
   flags = raf.readShort();
   unitsPerEm = raf.readShort();
   created = raf.readLong();
   modified = raf.readLong();
   xMin = raf.readShort();
   yMin = raf.readShort();
   xMax = raf.readShort();
   yMax = raf.readShort();
   macStyle = raf.readShort();
   lowestRecPPEM = raf.readShort();
   fontDirectionHint = raf.readShort();
   indexToLocFormat = raf.readShort();
   glyphDataFormat = raf.readShort();
 }