Package org.apache.padaf.preflight.font

Examples of org.apache.padaf.preflight.font.AbstractFontContainer


      // ---- Unable to decode the Text without Font
      throwContentStreamException("Text operator can't be process without Font", ERROR_FONTS_UNKNOWN_FONT_REF);
    }

    // FontContainer fontContainer = documentHandler.retrieveFontContainer(font);
    AbstractFontContainer fontContainer = documentHandler.getFont(font.getCOSObject());

    if (fontContainer != null && fontContainer.isValid() == State.INVALID) {
      return;
    }

    if (renderingMode == 3 && (fontContainer == null || !fontContainer.isFontProgramEmbedded())) {
      // font not embedded and rendering mode is 3. Valid case and nothing to check
      return ;
    }

    if (fontContainer == null) {
      // ---- Font Must be embedded if the RenderingMode isn't 3
      throwContentStreamException(font.getBaseFont() + " is unknown wasn't found by the FontHelperValdiator", ERROR_FONTS_UNKNOWN_FONT_REF)
    }

    if (!fontContainer.isFontProgramEmbedded()) {
      throwContentStreamException(font.getBaseFont() + " isn't embedded and the rendering mode isn't 3", ERROR_FONTS_FONT_FILEX_INVALID);
    }

    int codeLength = 1;
    for (int i = 0; i < string.length; i += codeLength) {
      int cid = -1;
      codeLength = 1;
      try {
        cid = font.encodeToCID(string, i, codeLength);
        if (cid == -1 && i + 1 < string.length) {
          // maybe a multibyte encoding
          codeLength++;
          cid = font.encodeToCID(string, i, codeLength);
        }
      } catch (IOException e) {
        throwContentStreamException("Encoding can't interpret the character code", ERROR_FONTS_ENCODING_ERROR);
      }

      try {
        fontContainer.checkCID(cid);
      } catch (GlyphException e) {
        if (renderingMode != 3) {
          throwContentStreamException(e.getMessage(), e.getErrorCode());
        }
      }
View Full Code Here

TOP

Related Classes of org.apache.padaf.preflight.font.AbstractFontContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.