Package org.apache.harmony.awt.gl.font

Examples of org.apache.harmony.awt.gl.font.Glyph


            throw new NullPointerException(Messages.getString("awt.296"));
        }       
            
        double texSize = getFactor(g.getTransform());
       
        Glyph newGlyph = ((FontPeerImpl)(font.deriveFont(
                (float)(font.getSize2D() * texSize))).getPeer())
                .getGlyph(ch.charValue());
       
        byte[] pixels = newGlyph.getBitmap();
       
        BufferedImage bim = getBufImg(
                pixels,
                newGlyph.getPointWidth(),
                newGlyph.getPointHeight(),
                col
                );
       
        Rectangle.Double rect = new Rectangle.Double(
                Math.round(glyph.getGlyphPointMetrics().getLSB()),
View Full Code Here


        int offs = 0;       // width of substring with the same font header
        String sChars = new String();
        char chars[];
        for (int i=0; i < str.length(); i++){
            char c = str.charAt(i);
            Glyph gl = wcf.getGlyph(c);
            if (font == 0){
                font = gl.getPFont();
            }
            int glWidth = Math.round(gl.getGlyphPointMetrics().getAdvance());
            if (glWidth ==0){
                continue;
            }
            long glPFont = gl.getPFont();
            if (font != glPFont){
                chars = sChars.toCharArray();
                LinuxNativeFont.drawStringNative(xg2d.xftDraw, display,
                        colormap, font, xOffset, yOffset, chars,
                        sChars.length(), xcolorPtr);

                xOffset += offs;
                offs = 0;
                sChars = String.valueOf(gl.getChar());
                font = glPFont;
            } else {
                sChars += String.valueOf(gl.getChar());
            }
            offs += glWidth;
        }
        chars = sChars.toCharArray();
        if (chars.length != 0){
View Full Code Here

        X11.XColor xcolor = getXColor(g.getColor());
        long xcolorPtr = xcolor.lock();

        for (int i = 0; i < glyphVector.getNumGlyphs(); i++) {

            Glyph gl = ((CommonGlyphVector)glyphVector).vector[i];
            if (gl.getPointWidth() == 0){
                continue;
            }

            Point2D pos = glyphVector.getGlyphPosition(i);

            int xBaseLine = (int)Math.round(x + pos.getX());
            int yBaseLine = (int)Math.round(y + pos.getY());
            char chars[] = {gl.getChar()};

            LinuxNativeFont.drawStringNative(xg2d.xftDraw, display, colormap,
                    peer.getFontHandle(), xBaseLine, yBaseLine, chars, 1,
                    xcolorPtr);
        }
View Full Code Here

        X11.XColor xcolor = getXColor(g.getColor());
        long xcolorPtr = xcolor.lock();

        for (int i = 0; i < glyphVector.getNumGlyphs(); i++) {

            Glyph gl = ((CommonGlyphVector)glyphVector).vector[i];
            if (gl.getPointWidth() == 0){
                continue;
            }

            Point2D pos = glyphVector.getGlyphPosition(i);

            int xBaseLine = (int)Math.round(x + pos.getX());
            int yBaseLine = (int)Math.round(y + pos.getY());
            char chars[] = {gl.getChar()};

            LinuxNativeFont.drawStringNative(xg2d.xftDraw, display, colormap,
                    gl.getPFont(), xBaseLine, yBaseLine, chars, 1,
                    xcolorPtr);
        }
        xcolor.unlock();

    }
View Full Code Here

    public int getMissingGlyphCode() {
        return getDefaultGlyph().getGlyphCode();
    }

    public Glyph getGlyph(char index) {
        Glyph result = null;

        Object key = new Integer(index);
        if (glyphs.containsKey(key)) {
            result = (Glyph) glyphs.get(key);
        } else {
View Full Code Here

        return result;
    }

    public Glyph getDefaultGlyph() {
        Glyph result;
        Object key = new Integer(defaultChar);
        if (glyphs.containsKey(key)) {
            result = (Glyph) glyphs.get(key);
        } else {
            if (this.fontType == FontManager.FONT_TYPE_T1){
View Full Code Here

        if (((gv.getLayoutFlags() & GlyphVector.FLAG_HAS_TRANSFORMS) != 0)){

            for (int i=0; i < gv.getNumGlyphs(); i++){

                Glyph gl = ((CommonGlyphVector)gv).vector[i];

                if (gl.getPointWidth()==0) {
                    continue;
                }

                char chr = gl.getChar();

                AffineTransform glyphAT = gv.getGlyphTransform(i);
                if ((glyphAT == null) || glyphAT.isIdentity()){
                    chars[count] = chr;
                    int index = i * 2;
                    int ind = count * 2;
                    positions[ind] = ((CommonGlyphVector)gv).visualPositions[index];
                    positions[ind + 1] = ((CommonGlyphVector)gv).visualPositions[index+1];
                    count++;
                    continue;
                }
               
                if (glyphAT.getType() == AffineTransform.TYPE_TRANSLATION){
                    chars[count] = chr;
                    int index = i * 2;
                    int ind = count * 2;
                    positions[ind] = ((CommonGlyphVector)gv).visualPositions[index] +
                                glyphAT.getTranslateX();
                    positions[ind + 1] = ((CommonGlyphVector)gv).visualPositions[index+1] +
                                glyphAT.getTranslateY();
                    count++;
                    continue;
                }
               
                at.transform(positions, 0, positions, 0, count);
               
                status = NativeFont.gdiPlusDrawDriverChars(graphicsInfo,
                        chars,
                        count,
                        font,
                        positions,
                        NativeFont.DriverStringOptionsCmapLookup,
                        fontMatrix);
                if (status != 0 && debugOutput){
                    // awt.err.02=GDIPlus DrawDriverString error status = {0}
                    System.err.println(Messages.getString("awt.err.02", status))//$NON-NLS-1$
                }

                count = 0;
               
                AffineTransform at1 = new AffineTransform(glyphAT);

                at1.concatenate(fontAT);
                at1.getMatrix(matrix);

                Point2D pos = gv.getGlyphPosition(i);
               
                status = NativeFont.gdiPlusDrawDriverChar(graphicsInfo,
                        chr,
                        font,
                        (float)(x + pos.getX()),
                        (float)(y + pos.getY()),
                        NativeFont.DriverStringOptionsCmapLookup,
                        matrix);
                if (status != 0 && debugOutput){
                    // awt.err.02=GDIPlus DrawDriverString error status = {0}
                    System.err.println(Messages.getString("awt.err.02", status)); //$NON-NLS-1$
                }

            }
            if (count != 0){
               
                at.transform(positions, 0, positions, 0, count);

                status = NativeFont.gdiPlusDrawDriverChars(graphicsInfo,
                        chars,
                        count,
                        font,
                        positions,
                        NativeFont.DriverStringOptionsCmapLookup,
                        fontMatrix);
                if (status != 0 && debugOutput){
                    // awt.err.02=GDIPlus DrawDriverString error status = {0}
                    System.err.println(Messages.getString("awt.err.02", status))//$NON-NLS-1$
                }

            }
        } else {
            for (int i=0; i < len ; i++){
                Glyph gl = ((CommonGlyphVector)gv).vector[i];
               
                if (gl.getPointWidth()==0) {
                    continue;
                }

                chars[count] = gl.getChar();
                int index = i * 2;
                int ind = count * 2;
                positions[ind] = ((CommonGlyphVector)gv).visualPositions[index];
                positions[ind + 1] = ((CommonGlyphVector)gv).visualPositions[index+1];
                count++;
View Full Code Here

        AffineTransform at = new AffineTransform(fontAT);
        at.getMatrix(fontMatrix);
        at.preConcatenate(AffineTransform.getTranslateInstance(x, y));
       
        for (int i=0; i < len; i++){
            Glyph gl = ((CommonGlyphVector)gv).vector[i];

            if (gl.getPointWidth() ==0){
                continue;
            }
           
            char c = gl.getChar();
            AffineTransform glyphAT = gv.getGlyphTransform(i);
            Point2D pos = gv.getGlyphPosition(i);
           
            fontIndex = wcf.getCharFontIndex(c, 0);

            if ((glyphAT == null) ||
                    glyphAT.isIdentity() ||
                    glyphAT.getType() == AffineTransform.TYPE_TRANSLATION){
                if (fontIndex != charFontIndex) {
                    charFontIndex = fontIndex;

                    at.transform(positions, 0, positions, 0, count);

                    status = NativeFont.gdiPlusDrawDriverChars(graphicsInfo,
                            chars,
                            count,
                            font,
                            positions,
                            NativeFont.DriverStringOptionsCmapLookup,
                            fontMatrix);
                    if (status != 0 && debugOutput){
                        // awt.err.03=gdipDrawCompositeGlyphVector: GDIPlus DrawDriverString error status = {0}
                        System.err.println(Messages.getString("awt.err.03", status))//$NON-NLS-1$
                    }

                    count = 0;
                    font = gl.getPFont();
                    physFont = (WindowsFont)wcf.fPhysicalFonts[charFontIndex];
                }else {
                    chars[count] = c;
                    int ind = count * 2;
                    positions[ind] = pos.getX();
                    positions[ind + 1] = pos.getY();
                    count++;
                }
                continue;
            }

            charFontIndex = fontIndex;
            if (count > 0){

                at.transform(positions, 0, positions, 0, count);

                status = NativeFont.gdiPlusDrawDriverChars(graphicsInfo,
                        chars,
                        count,
                        font,
                        positions,
                        NativeFont.DriverStringOptionsCmapLookup,
                        fontMatrix);
                if (status != 0 && debugOutput){
                    // awt.err.04=gdipDrawCompositeGlyphVector: GDIPlus DrawDriverString error status = {0}
                    System.err.println(Messages.getString("awt.err.04", status)); //$NON-NLS-1$
                }
                count = 0;
            }
           
            font = gl.getPFont();

            AffineTransform at1 = new AffineTransform(glyphAT);
            at1.concatenate(fontAT);
            at1.getMatrix(matrix);

View Full Code Here

        float yPos = 0;
      
        int count = 0;
        for (int i=0; i < len; i++){
            char c = str.charAt(i);
            Glyph gl = wf.getGlyph(c);

            // We compare Advances because Width
            // of a char can be 0 (e.g. "Space" char)
            float advance = gl.getGlyphPointMetrics().getAdvance();
            if ( advance != 0){
                chars[count] = gl.getChar();
                positions[count * 2] = xPos;
                positions[count * 2 + 1] = yPos;
                xPos += advance;
                count++;
            }
View Full Code Here

        float yPos = 0;
      
        int count = 0;
        for (int i=0; i < len; i++){
            char c = str[i];
            Glyph gl = wf.getGlyph(c);

            // We compare advances because width
            // of a char can be 0 (e.g. "Space" char)
            float advance = gl.getGlyphPointMetrics().getAdvance();
            if ( advance != 0){
                chars[count] = gl.getChar();

                positions[count * 2] = xPos;
                positions[count * 2 + 1] = yPos;

                xPos += advance;
View Full Code Here

TOP

Related Classes of org.apache.harmony.awt.gl.font.Glyph

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.