Package org.apache.pdfbox.encoding

Examples of org.apache.pdfbox.encoding.Encoding


        float retval = 0;
        FontMetric metric = getAFM();
        if( metric != null )
        {
            int code = getCodeFromArray( c, offset, length );
            Encoding encoding = getFontEncoding();
            String characterName = encoding.getName( code );
            retval = metric.getCharacterHeight( characterName );
        }
        else
        {
            PDFontDescriptor desc = getFontDescriptor();
View Full Code Here


    protected void determineEncoding()
    {
        String cmapName = null;
        COSName encodingName = null;
        COSBase encoding = getEncoding();
        Encoding fontEncoding = null;
        if (encoding != null)
        {
            if (encoding instanceof COSName)
            {
                if (cmap == null)
View Full Code Here

    }

    private Map<Integer,String> loadEncoding(COSName name) throws IOException
    {
        Map<Integer,String> result = new LinkedHashMap<Integer,String>();
        Encoding encoding = EncodingManager.INSTANCE.getEncoding(name);
        for( Iterator<Map.Entry<Integer,String>> it = (encoding.getCodeToNameMap().entrySet()).iterator();
                    it.hasNext();)
        {
            Map.Entry<Integer,String> entry = it.next();
            result.put(entry.getKey(), (entry.getValue()));
        }
View Full Code Here

    }

    protected void determineEncoding()
    {
        super.determineEncoding();
        Encoding fontEncoding = getFontEncoding();
        if(fontEncoding == null)
        {
            FontMetric metric = getAFM();
            if (metric != null)
            {
View Full Code Here

        int firstchar = 255;
        int lastchar = 0;

        // widths
        List<CharMetric> listmetric = metric.getCharMetrics();
        Encoding encoding = getFontEncoding();
        int maxWidths = 256;
        List<Float> widths = new ArrayList<Float>(maxWidths);
        int zero = 250;
        Iterator<CharMetric> iter = listmetric.iterator();
        for (int i = 0; i < maxWidths; i++)
        {
            widths.add((float)zero);
        }
        while (iter.hasNext())
        {
            CharMetric m = iter.next();
            int n = m.getCharacterCode();
            if (n > 0)
            {
                firstchar = Math.min(firstchar, n);
                lastchar = Math.max(lastchar, n);
                if (m.getWx() > 0)
                {
                    int width = Math.round(m.getWx());
                    widths.set(n, (float)width);
                    // germandbls has 2 character codes !! Don't ask me why .....
                    // StandardEncoding = 0373 = 251
                    // WinANSIEncoding = 0337 = 223
                    if (m.getName().equals("germandbls") && n != 223)
                    {
                        widths.set(0337, (float)width);
                    }
                }
            }
            else
            {
                // my AFMPFB-Fonts has no character-codes for german umlauts
                // so that I've to add them here by hand
                if (m.getName().equals("adieresis"))
                {
                    widths.set(0344, widths.get(encoding.getCode("a")));
                }
                else if (m.getName().equals("odieresis"))
                {
                    widths.set(0366, widths.get(encoding.getCode("o")));
                }
                else if (m.getName().equals("udieresis"))
                {
                    widths.set(0374, widths.get(encoding.getCode("u")));
                }
                else if (m.getName().equals("Adieresis"))
                {
                    widths.set(0304, widths.get(encoding.getCode("A")));
                }
                else if (m.getName().equals("Odieresis"))
                {
                    widths.set(0326, widths.get(encoding.getCode("O")));
                }
                else if (m.getName().equals("Udieresis"))
                {
                    widths.set(0334, widths.get(encoding.getCode("U")));
                }
            }
        }
        setFirstChar(0);
        setLastChar(255);
View Full Code Here

            {
                widths.add((float)defaultWidth);
            }
            // Encoding singleton to have acces to the chglyph name to
            // unicode cpoint point mapping of Adobe's glyphlist.txt
            Encoding glyphlist = WinAnsiEncoding.INSTANCE;

            // A character code is mapped to a glyph name via the provided
            // font encoding. Afterwards, the glyph name is translated to a
            // glyph ID.
            // For details, see PDFReference16.pdf, Section 5.5.5, p.401
            //
            for (Entry<Integer, String> e : codeToName.entrySet())
            {
                String name = e.getValue();
                // pdf code to unicode by glyph list.
                String c = glyphlist.getCharacter(name);
                int charCode = c.codePointAt(0);
                int gid = uniMap.getGlyphId(charCode);
                if (gid != 0)
                {
                    if (isMonospaced)
View Full Code Here

        float retval = 0;
        FontMetric metric = getAFM();
        if( metric != null )
        {
            int code = getCodeFromArray( c, offset, length );
            Encoding encoding = getFontEncoding();
            String characterName = encoding.getName( code );
            retval = metric.getCharacterHeight( characterName );
        }
        else
        {
            PDFontDescriptor desc = getFontDescriptor();
View Full Code Here

    protected void determineEncoding()
    {
        String cmapName = null;
        COSName encodingName = null;
        COSBase encoding = getEncoding();
        Encoding fontEncoding = null;
        if (encoding != null)
        {
            if (encoding instanceof COSName)
            {
                if (cmap == null)
View Full Code Here

    }

    protected void determineEncoding()
    {
        super.determineEncoding();
        Encoding fontEncoding = getFontEncoding();
        if(fontEncoding == null)
        {
            FontMetric metric = getAFM();
            if (metric != null)
            {
View Full Code Here

    }

    protected void determineEncoding()
    {
        super.determineEncoding();
        Encoding fontEncoding = getFontEncoding();
        if(fontEncoding == null)
        {
            FontMetric metric = getAFM();
            if (metric != null)
            {
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.encoding.Encoding

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.