Examples of CMap


Examples of com.google.typography.font.sfntly.table.core.CMap

    return glyph;
  }

  private int lookupGlyphIndex(char ch) {
    CMapTable cmapTable = font.getTable(Tag.cmap);
      CMap cmap = cmapTable.cmap(CMapId.WINDOWS_BMP);
      int glyphId = cmap.glyphId(ch);
    return glyphId;
  }
View Full Code Here

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

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

        }
        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

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

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

        }
        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

Examples of com.sun.pdfview.font.ttf.CMap

            // the mapped character
            char mappedChar = 0;

            for (int i = 0; i < mapIDs.length; i += 2) {
                CMap map = cmapTable.getCMap (mapIDs[i], mapIDs[i + 1]);
                if (map != null) {
                    mappedChar = map.reverseMap (glyphID);

                    // we found a character
                    if (mappedChar != 0) {
                        break;
                    }
View Full Code Here

Examples of com.sun.pdfview.font.ttf.CMap

        GeneralPath gp = new GeneralPath (gv.getGlyphOutline (0));

        // this should be gv.getGlyphMetrics(0).getAdvance(), but that is
        // broken on the Mac, so we need to read the advance from the
        // hmtx table in the font
        CMap map = cmapTable.getCMap (mapIDs[0], mapIDs[1]);
        int glyphID = map.map (src);
        float advance = (float) hmtxTable.getAdvance (glyphID) / (float) unitsPerEm;

        float widthfactor = width / advance;
        gp.transform (AffineTransform.getScaleInstance (widthfactor, -1));
View Full Code Here

Examples of com.sun.pdfview.font.ttf.CMap

    private boolean fixCMapTable (TrueTypeFont ttf, CmapTable cmap) {
        CMapFormat4 fourMap = null;
        CMapFormat0 zeroMap = null;

        for (int i = 0; i < mapIDs.length; i += 2) {
            CMap map = cmapTable.getCMap (mapIDs[i], mapIDs[i + 1]);
            if (map != null) {
                if (fourMap == null && map instanceof CMapFormat4) {
                    fourMap = (CMapFormat4) map;
                } else if (zeroMap == null && map instanceof CMapFormat0) {
                    zeroMap = (CMapFormat0) map;
View Full Code Here

Examples of com.sun.pdfview.font.ttf.CMap

            // the mapped character
            char mappedChar = 0;

            for (int i = 0; i < mapIDs.length; i += 2) {
                CMap map = this.cmapTable.getCMap (mapIDs[i], mapIDs[i + 1]);
                if (map != null) {
                    mappedChar = map.reverseMap (glyphID);

                    // we found a character
                    if (mappedChar != 0) {
                        break;
                    }
View Full Code Here

Examples of com.sun.pdfview.font.ttf.CMap

        GeneralPath gp = new GeneralPath (gv.getGlyphOutline (0));

        // this should be gv.getGlyphMetrics(0).getAdvance(), but that is
        // broken on the Mac, so we need to read the advance from the
        // hmtx table in the font
        CMap map = this.cmapTable.getCMap (mapIDs[0], mapIDs[1]);
        int glyphID = map.map (src);
        float advance = (float) this.hmtxTable.getAdvance (glyphID) / (float) this.unitsPerEm;

        float widthfactor = width / advance;
        gp.transform (AffineTransform.getScaleInstance (widthfactor, -1));
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.