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

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


    public float getSize2D() {
        return this.pointSize;
    }

    public float getItalicAngle() {
        FontPeerImpl peer = (FontPeerImpl)this.getPeer();
        return peer.getItalicAngle();
    }
View Full Code Here


    @SuppressWarnings("deprecation")
    @Override
    public void drawGlyphVector(Graphics2D g, GlyphVector gv, float x,
            float y) {
        FontPeerImpl fnt = (FontPeerImpl)gv.getFont().getPeer();
        if (fnt.getClass() == CompositeFont.class){
            gdipDrawCompositeGlyphVector(g, gv, x, y);
        } else {
            gdipDrawNormalGlyphVector(g, gv, x, y);
        }
    }
View Full Code Here

        int len = str.length();
        if (len == 0){
            return;
        }

        FontPeerImpl fnt = (FontPeerImpl)g.getFont().getPeer();
        if (fnt.getClass() == CompositeFont.class){
            gdipDrawCompositeString(g, str, x, y);
        } else {
            gdipDrawNormalChars(g, g.getFont(), str.toCharArray(), len, x, y);
        }
    }
View Full Code Here

    @SuppressWarnings("deprecation")
    @Override
    public void drawGlyphVector(Graphics2D g, GlyphVector gv, float x,
            float y) {
        FontPeerImpl fnt = (FontPeerImpl)gv.getFont().getPeer();
        if (fnt.getClass() == CompositeFont.class){
            drawCompositeGlyphVector(g, gv, x, y);
        } else {
            drawNormalGlyphVector(g, gv, x, y);
        }
    }
View Full Code Here

    }

    @SuppressWarnings("deprecation")
    @Override
    public void drawString(Graphics2D g, String str, float x, float y) {
        FontPeerImpl fnt = (FontPeerImpl)g.getFont().getPeer();
        if (fnt.getClass() == CompositeFont.class){
            drawCompositeString(g, str, Math.round(x), Math.round(y));
        } else {
            drawNormalString(g, str, Math.round(x), Math.round(y));
        }
    }
View Full Code Here

        final char[] input = str.toCharArray();
        GlyphMetrics glMetrics;
        Color col = g.getColor();
        Font font = g.getFont();       
        int length = str.length();
        @SuppressWarnings("deprecation")
        final FontPeerImpl peer = ((FontPeerImpl)font.getPeer());
        AffineTransform fontAT = (AffineTransform)font.getTransform().clone();
        Point.Float pos = new Point.Float();
        Paint paint = g.getPaint();
        boolean isAntialias = g.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING) == RenderingHints.VALUE_TEXT_ANTIALIAS_ON;
       
        try {
            fontAT.inverseTransform(new Point.Double(x + fontAT.getTranslateX(), y + fontAT.getTranslateY()), pos);
        } catch (NoninvertibleTransformException e) {  
//          TODO determinant equals 0 => point or line
            g.fill(font.createGlyphVector(g.getFontRenderContext(), str).getOutline(x, y));
            return;
        }
       
        fontAT.translate(pos.x,pos.y);
        g.transform(fontAT);
       
        HashCode hash = new HashCode();
        hash.append(peer);
        hash.append(getFactor(g.getTransform()));
        hash.append(paint);
        hash.append(isAntialias);
        Integer intHash = Integer.valueOf(hash.hashCode());
       
        GlyphHashtable glyphHash =
            (GlyphHashtable) (intHash2glyphHash.containsKey(intHash) ?
                intHash2glyphHash.get(intHash) : null);
        if ( glyphHash == null) {
            glyphHash = new GlyphHashtable();
            intHash2glyphHash.put(intHash, glyphHash);
        }
       
        activateVars();
       
        for (int i = 0; i - length < 0; i ++) {
            final char c = input[i];
            final Character ch = Character.valueOf(c);
            if (ESCAPE.contains(ch)) {
                continue;
            }
            final Glyph glyph = peer.getGlyph(input[i]);
           
            if (c == ' ') {
                glMetrics = glyph.getGlyphPointMetrics();
                gl.glTranslated(
                        glMetrics.getAdvanceX(),
View Full Code Here

    public void drawGlyphVector(Graphics2D g, GlyphVector gv, float x, float y) {
        Color col = g.getColor();
        Glyph[] input = ((CommonGlyphVector)gv).vector;       
        Font font = gv.getFont();
        int length = gv.getNumGlyphs();
        @SuppressWarnings("deprecation")
        final FontPeerImpl peer = ((FontPeerImpl)font.getPeer());
        AffineTransform fontAT = (AffineTransform)font.getTransform().clone();
        Point.Float pos = new Point.Float();
        boolean isAntialias = g.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING) == RenderingHints.VALUE_TEXT_ANTIALIAS_ON;  
       
View Full Code Here

        }
    }

    @Override
    public FontPeer createPhysicalFontPeer(String name, int style, int size) {
        FontPeerImpl peer = null;       
       
        if (isFontExistInList(name, style)){        
            try {
                peer = new FLFontPeer(name, style, size);
               
                peer.setFamily(name);
            } catch(NullPointerException e) {
                peer = new FLFontPeer(DEFAULT_NAME, style, size);
               
                peer.setFamily(DEFAULT_NAME);
            }
        } else {
            peer = new FLFontPeer(DEFAULT_NAME, style, size);
           
            peer.setFamily(DEFAULT_NAME);
        }
       
        return peer;
    }
View Full Code Here

                Enumeration<String> kEnum = fontsTable.keys();

                while(kEnum.hasMoreElements()){
                    Object key = kEnum.nextElement();
                    HashMapReference hmr = fontsTable.get(key);
                    FontPeerImpl delPeer = (FontPeerImpl)hmr.get();
                   
                    if ((delPeer != null) && (delPeer.getClass() != CompositeFont.class)){
                        // there's nothing to dispose in CompositeFont objects
                       
                        delPeer.dispose();
                    }
                }
               
                dispose();
               
View Full Code Here

        CommonGraphics2D g = (CommonGraphics2D)ga;
        AffineTransform trans = g.getTransform();
        double xOffset = x + trans.getTranslateX();
        double yOffset = y + trans.getTranslateY();

        FontPeerImpl fnt = (FontPeerImpl)g.getFont().getPeer();

        if (fnt.getClass() == CompositeFont.class){
            drawCompositeString(g, str, xOffset, yOffset);
        } else {
            drawNormalString(g, str, xOffset, yOffset);
        }
View Full Code Here

TOP

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

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.