/**
   * Records the starting indexes of final lig/kern program in ligKernTable to auxiliary character
   * information field <code>ligkernstart</code> of <code>AuxCharInfo</code>.
   *
   * @param pos the position of currently processed instruction in original tfm lig/kern table
   *     <code>ligAuxTab</code>.
   * @param start the position of corresponding instruction in final lig/kern table LigKernTable.
   */
  private void setLigStarts(final int pos, final int start) {

    TfmIndexMultimap.Enum lab = labels.forKey(pos);
    while (lab.hasMore()) {
      int c = lab.next();
      if (c == BOUNDARYLABEL) {
        boundaryStart = start;
      } else {
        charinfo.getCharinfoword()[c].setLigkernstart(start);
      }
    }
  }
  /**
   * Builds associative table labels which maps the character codes to lig/kern program starting
   * indexes in ligAuxTab for remapping later. It also marks the starting instructions of lig/kern
   * programs as active (using the <code>activity</code> field of LigKern). TFtoPL[67]
   */
  private void buildLabels() {

    TfmCharInfoWord[] ciw = charinfo.getCharinfoword();

    for (int i = 0; i < ciw.length; i++) {
      if (ciw[i].getTag() == TfmCharInfoWord.LIG_TAG) {
        int start = ligStart(ciw[i].getRemainder());
        if (start < ligkerncommand.length) {
          labels.add(start, i);
          ligkerncommand[start].setActivity(TfmLigKernCommand.ACCESSIBLE);
        } else {
          ciw[i].resetTag();
        }
      }
    }
  }
  /**
   * Tries to find the information about lig/kerns for word boundaries in tfm lig/kern table and
   * checks for errors. TFtoPL[69]
   */
  private void setupBoundary() {

    // first entry
    TfmLigKernCommand lkc = ligkerncommand[0];

    if (lkc.meansBoundary()) {
      boundaryChar = lkc.nextChar();
      lkc.setActivity(TfmLigKernCommand.PASSTHROUGH);
    }

    // last entry
    lkc = ligkerncommand[ligkerncommand.length - 1];
    if (lkc.meansBoundary()) {
      int start = lkc.restartIndex();
      lkc.setActivity(TfmLigKernCommand.PASSTHROUGH);
      if (start < ligkerncommand.length) {
        ligkerncommand[start].setActivity(TfmLigKernCommand.ACCESSIBLE);
        labels.add(start, BOUNDARYLABEL);
      }
    }
  }