@Override
  public boolean removeCharacter(char character) {
    ensureFontInfo();
    if (fontInfoTag == null) {
      return false;
    }

    int code = (int) character;
    int pos = -1;
    List<Integer> codeTable = fontInfoTag.getCodeTable();
    for (int i = 0; i < codeTable.size(); i++) {
      if (codeTable.get(i) >= code) {
        if (codeTable.get(i) == code) {
          pos = i;
          break;
        }

        return false;
      }
    }

    if (pos == -1) {
      return false;
    }

    glyphShapeTable.remove(pos);
    fontInfoTag.removeFontCharacter(pos);

    shiftGlyphIndices(fontId, pos + 1, false);

    setModified(true);
    getSwf().clearImageCache();
    return true;
  }
 @Override
 public int charToGlyph(char c) {
   ensureFontInfo();
   if (fontInfoTag != null) {
     return fontInfoTag.getCodeTable().indexOf((int) c);
   }
   return -1;
 }
 @Override
 public int getCharacterCount() {
   ensureFontInfo();
   if (fontInfoTag != null) {
     List<Integer> codeTable = fontInfoTag.getCodeTable();
     return codeTable.size();
   }
   return 0;
 }
 @Override
 public char glyphToChar(int glyphIndex) {
   ensureFontInfo();
   if (fontInfoTag != null) {
     return (char) (int) fontInfoTag.getCodeTable().get(glyphIndex);
   } else {
     return '?';
   }
 }
 @Override
 public String getCharacters() {
   ensureFontInfo();
   if (fontInfoTag != null) {
     List<Integer> codeTable = fontInfoTag.getCodeTable();
     StringBuilder ret = new StringBuilder(codeTable.size());
     for (int i : codeTable) {
       ret.append((char) i);
     }
     return ret.toString();
   }
   return "";
 }
  @Override
  public void addCharacter(char character, Font font) {
    SHAPE shp =
        SHAPERECORD.fontCharacterToSHAPE(font, (int) Math.round(getDivider() * 1024), character);
    ensureFontInfo();
    int code = (int) character;
    int pos = -1;
    boolean exists = false;
    if (fontInfoTag != null) {
      List<Integer> codeTable = fontInfoTag.getCodeTable();
      for (int i = 0; i < codeTable.size(); i++) {
        if (codeTable.get(i) >= code) {
          if (codeTable.get(i) == code) {
            exists = true;
          }

          pos = i;
          break;
        }
      }

      if (pos == -1) {
        pos = codeTable.size();
      }
    } else {
      pos = 0;
    }

    if (!exists) {
      shiftGlyphIndices(fontId, pos, true);
      glyphShapeTable.add(pos, shp);
      if (fontInfoTag != null) {
        fontInfoTag.addFontCharacter(pos, (int) character);
      }
    } else {
      glyphShapeTable.set(pos, shp);
    }

    setModified(true);
    getSwf().clearImageCache();
  }