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

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


        if (frc == null) {
            throw new NullPointerException(Messages.getString("awt.00")); //$NON-NLS-1$
        }

        FontPeerImpl peer = (FontPeerImpl) this.getPeer();

        final int TRANSFORM_MASK = AffineTransform.TYPE_GENERAL_ROTATION
                | AffineTransform.TYPE_GENERAL_TRANSFORM;
        Rectangle2D bounds;

        AffineTransform transform = getTransform();
        AffineTransform frcTransform = frc.getTransform();

        // XXX: for transforms where an angle between basis vectors is not 90
        // degrees Rectanlge2D class doesn't fit as Logical bounds.
        if ((transform.getType() & TRANSFORM_MASK) == 0) {
            int width = 0;
            for (int i = start; i < end; i++) {
                width += peer.charWidth(chars[i]);
            }
            LineMetrics nlm = peer.getLineMetrics();
            bounds = transform.createTransformedShape(
                    new Rectangle2D.Float(0, -nlm.getAscent(), width, nlm
                            .getHeight())).getBounds2D();
        } else {
            int len = end - start;
View Full Code Here


        if (frc == null){
            // awt.00=FontRenderContext is null
            throw new NullPointerException(Messages.getString("awt.00")); //$NON-NLS-1$
        }

        FontPeerImpl peer = (FontPeerImpl)this.getPeer();

        Rectangle2D bounds = peer.getMaxCharBounds(frc);
        AffineTransform transform = getTransform();
        // !! Documentation doesn't describe meaning of max char bounds
        // for the fonts that have rotate transforms. For all transforms
        // returned bounds are the bounds of transformed maxCharBounds
        // Rectangle2D that corresponds to the font with identity transform.
View Full Code Here

                ",size=" + this.size + "]"; //$NON-NLS-1$ //$NON-NLS-2$
        return result;
    }

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

    public boolean isBold() {
        return (this.style & BOLD) != 0;
    }

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

        return this.size;
    }

    public int getNumGlyphs() {
        if (numGlyphs == -1){
            FontPeerImpl peer = (FontPeerImpl)this.getPeer();
            this.numGlyphs =  peer.getNumGlyphs();
        }
        return this.numGlyphs;
    }
View Full Code Here

        return this.numGlyphs;
    }

    public int getMissingGlyphCode() {
        if (missingGlyphCode == -1){
            FontPeerImpl peer = (FontPeerImpl)this.getPeer();
            this.missingGlyphCode =  peer.getMissingGlyphCode();
        }
        return this.missingGlyphCode;
    }
View Full Code Here

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

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

        DLInfo info;
        GlyphMetrics glMetrics;
        Color col = g.getColor();
        Font font = g.getFont();       
        int length = str.length();
        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 = new Integer(hash.hashCode());
       
        GlyphHashtable glyphHash =
            intHash2glyphHash.containsKey(intHash) ?
                    (GlyphHashtable) intHash2glyphHash.get(intHash) : null;
        if ( glyphHash == null) {
            glyphHash = new GlyphHashtable();
            intHash2glyphHash. put(intHash, glyphHash);
        }
       
        activateVars();       
       
        for (int i = 0; i - length < 0; i ++) {
            ch = new Character(input[i]);
            if (ESCAPE.contains(ch)) continue;
            glyph = peer.getGlyph(input[i]);
           
            if (ch == ' ') {
                glMetrics = glyph.getGlyphPointMetrics();
                gl.glTranslated(
                        glMetrics.getAdvanceX(),
View Full Code Here

        DLInfo info;
        Color col = g.getColor();
        Glyph[] input = ((CommonGlyphVector)gv).vector;       
        Font font = gv.getFont();
        int length = gv.getNumGlyphs();
        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;  
       
        try {
View Full Code Here

        allFamilies = getAllFamilies();       
    }

    @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

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.