Package com.sun.pdfview.font.ttf

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


        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

    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

            // 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

        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

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

        for (int i = 0; i < mapIDs.length; i += 2) {
            CMap map = this.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

        if (cmap == null) {
            return null;
        }

        // try maps in required order of (3, 1), (1, 0)
        CMap map = cmap.getCMap ((short) 3, (short) 1);
        if (map == null) {
            map = cmap.getCMap ((short) 1, (short) 0);
        }
        int idx = map.map (val);
        if (idx != 0) {
            return getOutline (idx, width);
        }

        return null;
View Full Code Here

TOP

Related Classes of com.sun.pdfview.font.ttf.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.