Examples of PDFontDescriptor


Examples of org.apache.pdfbox.pdmodel.font.PDFontDescriptor

        protected String push(StringBuilder buffer, char character, TextPosition textPosition)
        {
            boolean bold = false;
            boolean italics = false;

            PDFontDescriptor descriptor = textPosition.getFont().getFontDescriptor();
            if (descriptor != null)
            {
                bold = isBold(descriptor);
                italics = isItalic(descriptor);
            }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.font.PDFontDescriptor

        this.font = font;
    }

    public void validate()
    {
        PDFontDescriptor fd = this.font.getFontDescriptor();
        boolean isStandard14 = false;
        if (this.font instanceof PDFont)
        {
            isStandard14 = ((PDFont)font).isStandard14();
        }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.font.PDFontDescriptor

    @Override
    protected void checkEncoding()
    {
        PDTrueTypeFont ttFont = (PDTrueTypeFont) font;
               
        PDFontDescriptor fd = ttFont.getFontDescriptor();
        if (fd != null)
        {
            /*
             * only MacRomanEncoding or WinAnsiEncoding are allowed for a non symbolic font.
             */
            if (fd.isNonSymbolic())
            {
                Encoding encodingValue = ttFont.getEncoding();
                if (encodingValue == null
                        || !(encodingValue instanceof MacRomanEncoding || encodingValue instanceof WinAnsiEncoding))
                {
                    this.fontContainer.push(new ValidationError(ERROR_FONTS_ENCODING,
                            "The Encoding is invalid for the NonSymbolic TTF"));
                }
            }

            /*
             * For symbolic font, no encoding entry is allowed and only one encoding entry is expected into the FontFile
             * CMap (Check latter when the FontFile stream will be checked)
             */
            if (fd.isSymbolic() && ((COSDictionary) fontDictionary).getItem(COSName.ENCODING) != null)
            {
                this.fontContainer.push(new ValidationError(ERROR_FONTS_ENCODING,
                        "The Encoding should be missing for the Symbolic TTF"));
            }
        }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.font.PDFontDescriptor

            // not appear to be documented anywhere. Through examining a few
            // PDF documents and the value that Acrobat places in there I
            // have determined that the below method of computing the position
            // is correct for certain documents, but maybe not all. It does
            // work f1040ez.pdf and Form_1.pdf
            PDFontDescriptor fd = pdFont.getFontDescriptor();
            float bBoxHeight = boundingBox.getHeight();
            float fontHeight = fd.getFontBoundingBox().getHeight() + 2 * fd.getDescent();
            fontHeight = (fontHeight / 1000) * fontSize;
            verticalOffset = (bBoxHeight - fontHeight) / 2;
        }
        return verticalOffset;
    }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.font.PDFontDescriptor

        protected String push(StringBuilder buffer, char character, TextPosition textPosition)
        {
            boolean bold = false;
            boolean italics = false;

            PDFontDescriptor descriptor = textPosition.getFont().getFontDescriptor();
            if (descriptor != null)
            {
                bold = isBold(descriptor);
                italics = isItalic(descriptor);
            }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.font.PDFontDescriptor

                //not appear to be documented anywhere.  Through examining a few
                //PDF documents and the value that Acrobat places in there I
                //have determined that the below method of computing the position
                //is correct for certain documents, but maybe not all.  It does
                //work f1040ez.pdf and Form_1.pdf
                PDFontDescriptor fd = ((PDSimpleFont)pdFont).getFontDescriptor();
                float bBoxHeight = boundingBox.getHeight();
                float fontHeight = fd.getFontBoundingBox().getHeight() + 2 * fd.getDescent();
                fontHeight = (fontHeight/1000) * fontSize;
                pos = (bBoxHeight - fontHeight)/2;
            }
            else
            {
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.font.PDFontDescriptor

        this.descriptorHelper = new TrueTypeDescriptorHelper(context, font, fontContainer);
    }

    protected void checkEncoding()
    {
        PDFontDescriptor fd = this.font.getFontDescriptor();
        if (fd != null)
        {
            /*
             * only MacRomanEncoding or WinAnsiEncoding are allowed for a non symbolic font.
             */
            if (fd.isNonSymbolic())
            {
                Encoding encodingValue = this.font.getFontEncoding();
                if (encodingValue == null
                        || !(encodingValue instanceof MacRomanEncoding || encodingValue instanceof WinAnsiEncoding))
                {
                    this.fontContainer.push(new ValidationError(ERROR_FONTS_ENCODING,
                            "The Encoding is invalid for the NonSymbolic TTF"));
                }
            }

            /*
             * For symbolic font, no encoding entry is allowed and only one encoding entry is expected into the FontFile
             * CMap (Check latter when the FontFile stream will be checked)
             */
            if (fd.isSymbolic() && ((COSDictionary) this.font.getCOSObject()).getItem(COSName.ENCODING) != null)
            {
                this.fontContainer.push(new ValidationError(ERROR_FONTS_ENCODING,
                        "The Encoding should be missing for the Symbolic TTF"));
            }
        }
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.font.PDFontDescriptor

        this.font = font;
    }

    public void validate()
    {
        PDFontDescriptor fd = this.font.getFontDescriptor();
        // Only a PDFontDescriptorDictionary provides a way to embedded the font program.
        if (fd != null && fd instanceof PDFontDescriptorDictionary)
        {
            fontDescriptor = (PDFontDescriptorDictionary) fd;
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.font.PDFontDescriptor

                //not appear to be documented anywhere.  Through examining a few
                //PDF documents and the value that Acrobat places in there I
                //have determined that the below method of computing the position
                //is correct for certain documents, but maybe not all.  It does
                //work f1040ez.pdf and Form_1.pdf
                PDFontDescriptor fd = ((PDSimpleFont)pdFont).getFontDescriptor();
                float bBoxHeight = boundingBox.getHeight();
                float fontHeight = fd.getFontBoundingBox().getHeight() + 2 * fd.getDescent();
                fontHeight = (fontHeight/1000) * fontSize;
                pos = (bBoxHeight - fontHeight)/2;
            }
            else
            {
View Full Code Here

Examples of org.apache.pdfbox.pdmodel.font.PDFontDescriptor

                //not appear to be documented anywhere.  Through examining a few
                //PDF documents and the value that Acrobat places in there I
                //have determined that the below method of computing the position
                //is correct for certain documents, but maybe not all.  It does
                //work f1040ez.pdf and Form_1.pdf
                PDFontDescriptor fd = ((PDSimpleFont)pdFont).getFontDescriptor();
                float bBoxHeight = boundingBox.getHeight();
                float fontHeight = fd.getFontBoundingBox().getHeight() + 2 * fd.getDescent();
                fontHeight = (fontHeight/1000) * fontSize;
                pos = (bBoxHeight - fontHeight)/2;
            }
            else
            {
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.