Package com.itextpdf.text.pdf.fonts.cmaps

Examples of com.itextpdf.text.pdf.fonts.cmaps.CMap


                    fillEncoding(null);
                else
                    fillEncoding((PdfName)enc);
                PdfArray diffs = encDic.getAsArray(PdfName.DIFFERENCES);
                if (diffs != null) {
                    CMap toUnicode = null;
                    diffmap = new IntHashtable();
                    int currentNumber = 0;
                    for (int k = 0; k < diffs.size(); ++k) {
                        PdfObject obj = diffs.getPdfObject(k);
                        if (obj.isNumber())
                            currentNumber = ((PdfNumber)obj).intValue();
                        else {
                            int c[] = GlyphList.nameToUnicode(PdfName.decodeName(((PdfName)obj).toString()));
                            if (c != null && c.length > 0) {
                                uni2byte.put(c[0], currentNumber);
                                diffmap.put(c[0], currentNumber);
                            }
                            else {
                                if (toUnicode == null) {
                                    toUnicode = processToUnicode();
                                    if (toUnicode == null) {
                                        toUnicode = new CMap();
                                    }
                                }
                                final String unicode = toUnicode.lookup(new byte[]{(byte) currentNumber}, 0, 1);
                                if ((unicode != null) && (unicode.length() == 1)) {
                                    this.uni2byte.put(unicode.charAt(0), currentNumber);
                                    this.diffmap.put(unicode.charAt(0), currentNumber);
                                }
                            }
View Full Code Here


        }
        fillFontDesc(font.getAsDict(PdfName.FONTDESCRIPTOR));
    }

    private CMap processToUnicode() {
        CMap cmapRet = null;
        PdfObject toUni = PdfReader.getPdfObject(this.font.get(PdfName.TOUNICODE));
        if (toUni != null) {
            try {
                byte[] touni = PdfReader.getStreamBytes((PRStream) PdfReader.getPdfObjectRelease(toUni));
                CMapParser cmapParser = new CMapParser();
View Full Code Here

                    fillEncoding(null);
                else
                    fillEncoding((PdfName)enc);
                PdfArray diffs = encDic.getAsArray(PdfName.DIFFERENCES);
                if (diffs != null) {
                    CMap toUnicode = null;
                    diffmap = new IntHashtable();
                    int currentNumber = 0;
                    for (int k = 0; k < diffs.size(); ++k) {
                        PdfObject obj = diffs.getPdfObject(k);
                        if (obj.isNumber())
                            currentNumber = ((PdfNumber)obj).intValue();
                        else {
                            int c[] = GlyphList.nameToUnicode(PdfName.decodeName(((PdfName)obj).toString()));
                            if (c != null && c.length > 0) {
                                uni2byte.put(c[0], currentNumber);
                                diffmap.put(c[0], currentNumber);
                            }
                            else {
                                if (toUnicode == null) {
                                    toUnicode = processToUnicode();
                                    if (toUnicode == null) {
                                        toUnicode = new CMap();
                                    }
                                }
                                final String unicode = toUnicode.lookup(new byte[]{(byte) currentNumber}, 0, 1);
                                if ((unicode != null) && (unicode.length() == 1)) {
                                    this.uni2byte.put(unicode.charAt(0), currentNumber);
                                    this.diffmap.put(unicode.charAt(0), currentNumber);
                                }
                            }
View Full Code Here

        }
        fillFontDesc(font.getAsDict(PdfName.FONTDESCRIPTOR));
    }

    private CMap processToUnicode() {
        CMap cmapRet = null;
        PdfObject toUni = PdfReader.getPdfObjectRelease(this.font.get(PdfName.TOUNICODE));
        if (toUni instanceof PRStream) {
            try {
                byte[] touni = PdfReader.getStreamBytes((PRStream)toUni);
                CMapParser cmapParser = new CMapParser();
View Full Code Here

TOP

Related Classes of com.itextpdf.text.pdf.fonts.cmaps.CMap

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.