Examples of GlyphException


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

    GlyphDescription glyph = this.labelToMetric.get(label);
    if (glyph != null) {
      return glyph.getGlyphWidth();
    }

    throw new GlyphException(ValidationConstants.ERROR_FONTS_GLYPH_MISSING,
                  cid,
                  "Missing glyph for the CID " + cid);
  }
View Full Code Here

Examples of org.apache.pdfbox.preflight.font.util.GlyphException

        try
        {
            // check for missing glyphs
            if (!hasGlyph(code))
            {
                GlyphException e = new GlyphException(PreflightConstants.ERROR_FONTS_GLYPH_MISSING, code, "The character \""
                        + code + "\" in the font program \"" + font.getName()
                        + "\" is missing from the Character Encoding.");
                markAsInvalid(code, e);
                throw e;
            }

            // check widths
            float expectedWidth = font.getWidth(code);
            float foundWidth = font.getWidthFromFont(code);
            checkWidthsConsistency(code, expectedWidth, foundWidth);
        }
        catch (IOException e)
        {
            throw new GlyphException(PreflightConstants.ERROR_FONTS_GLYPH, code,
                    "Unexpected error during the width validation for the character code " + code +
                    " : " + e.getMessage());
        }
    }
View Full Code Here

Examples of org.apache.pdfbox.preflight.font.util.GlyphException

    private void checkWidthsConsistency(int code, float expectedWidth, float foundWidth) throws GlyphException
    {
        // consistent is defined to be a difference of no more than 1/1000 unit.
        if (Math.abs(foundWidth - expectedWidth) > 1)
        {
            GlyphException e = new GlyphException(PreflightConstants.ERROR_FONTS_METRICS, code,
                    "Width (" + foundWidth + ") of the character \"" + code + "\" in the font program \"" + this.font.getName()
                            + "\" is inconsistent with the width (" + expectedWidth + ") in the PDF dictionary.");
            markAsInvalid(code, e);
            throw e;
        }
View Full Code Here

Examples of org.apache.pdfbox.preflight.font.util.GlyphException

                        // Glyph is OK, we keep the CID.
                        this.fontContainer.markAsValid(code);
                    }
                    else
                    {
                        GlyphException glyphEx = new GlyphException(ERROR_FONTS_METRICS, code,
                                "The character with CID\"" + code + "\" should have a width equals to " + width);
                        this.fontContainer.markAsInvalid(code, glyphEx);
                    }
                }
                catch (ContentStreamException e)
View Full Code Here

Examples of org.apache.pdfbox.preflight.font.util.GlyphException

        PDType3CharProc charProc = font.getCharProc(code);
        if (charProc == null)
        {
            // There are no character description, we declare the Glyph as Invalid. If the character
            // is used in a Stream, the GlyphDetail will throw an exception.
            GlyphException glyphEx = new GlyphException(ERROR_FONTS_METRICS, code,
                    "The CharProcs \"" + font.getEncoding().getName(code+ "\" doesn't exist");
            this.fontContainer.markAsInvalid(code, glyphEx);
        }
        return charProc;
    }
View Full Code Here

Examples of org.apache.pdfbox.preflight.font.util.GlyphException

                        // Glyph is OK, we keep the CID.
                        this.fontContainer.markCIDAsValid(cid);
                    }
                    else
                    {
                        GlyphException glyphEx = new GlyphException(ERROR_FONTS_METRICS, cid,
                                "The character with CID\"" + cid + "\" should have a width equals to " + width);
                        this.fontContainer.markCIDAsInvalid(cid, glyphEx);
                    }
                }
                catch (ContentStreamException e)
View Full Code Here

Examples of org.apache.pdfbox.preflight.font.util.GlyphException

        {
            /*
             * There are no character description, we declare the Glyph as Invalid. If the character is used in a
             * Stream, the GlyphDetail will throw an exception.
             */
            GlyphException glyphEx = new GlyphException(ERROR_FONTS_METRICS, cid, "The CharProcs \"" + charName
                    + "\" doesn't exist");
            this.fontContainer.markCIDAsInvalid(cid, glyphEx);
        }
        return charStream;
    }
View Full Code Here

Examples of org.apache.pdfbox.preflight.font.util.GlyphException

     */
    protected void checkWidthsConsistency(int cid, float expectedWidth, float foundWidth) throws GlyphException
    {
        if (foundWidth < 0)
        {
            GlyphException e = new GlyphException(PreflightConstants.ERROR_FONTS_GLYPH_MISSING, cid, "The character \""
                    + cid + "\" in the font program \"" + this.font.getBaseFont()
                    + "\"is missing from the Charater Encoding.");
            markCIDAsInvalid(cid, e);
            throw e;
        }

        // consistent is defined to be a difference of no more than 1/1000 unit.
        if (Math.abs(foundWidth - expectedWidth) > 1)
        {
            GlyphException e = new GlyphException(PreflightConstants.ERROR_FONTS_METRICS, cid,
                    "Width of the character \"" + cid + "\" in the font program \"" + this.font.getBaseFont()
                            + "\"is inconsistent with the width in the PDF dictionary.");
            markCIDAsInvalid(cid, e);
            throw e;
        }
View Full Code Here

Examples of org.apache.pdfbox.preflight.font.util.GlyphException

                        // Glyph is OK, we keep the CID.
                        this.fontContainer.markCIDAsValid(cid);
                    }
                    else
                    {
                        GlyphException glyphEx = new GlyphException(ERROR_FONTS_METRICS, cid,
                                "The character with CID\"" + cid + "\" should have a width equals to " + width);
                        this.fontContainer.markCIDAsInvalid(cid, glyphEx);
                    }
                }
                catch (ContentStreamException e)
View Full Code Here

Examples of org.apache.pdfbox.preflight.font.util.GlyphException

        {
            /*
             * There are no character description, we declare the Glyph as Invalid. If the character is used in a
             * Stream, the GlyphDetail will throw an exception.
             */
            GlyphException glyphEx = new GlyphException(ERROR_FONTS_METRICS, cid, "The CharProcs \"" + charName
                    + "\" doesn't exist");
            this.fontContainer.markCIDAsInvalid(cid, glyphEx);
        }
        return charStream;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.