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

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


        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


            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(),
                        glMetrics.getAdvanceY(),
                        0
                );
                continue;
            }
           
            final DLInfo info = glyphHash.containsKey(ch) ? (DLInfo)glyphHash.get(ch) : null;
           
            if (info == null || !info.isValid()) {
                createColorGlyphDL(g, glyph, glyphHash, font, ch, col, isAntialias);
            } else {
                gl.glCallList(info.getDL());
            }           
           
            glMetrics = glyph.getGlyphPointMetrics();
            gl.glTranslated(glMetrics.getAdvanceX(), glMetrics.getAdvanceY(), 0);
        }
        deactivateVars();
        cleanLists();
    }
View Full Code Here

            throw new NullPointerException(Messages.getString("awt.296"));
        }       
            
        double texSize = getFactor(g.getTransform());
       
        @SuppressWarnings("deprecation")
        final 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(isAntialiasingHintSet(g)), 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

        int xSrcSurf, ySrcSurf; // Start point in String rectangle
        int xDstSurf, yDstSurf; // Start point in Surface rectangle
        int clWidth, clHeight;

        for (int i = 0; i < glyphVector.getNumGlyphs(); i++) {
            Glyph gl = ((CommonGlyphVector) glyphVector).vector[i];

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

            byte[] data = gl.getBitmap();
            if (data != null) {
                Point2D pos = glyphVector.getGlyphPosition(i);

                xSrcSurf = 0;//gl.bmp_left;
                ySrcSurf = 0;//gl.bmp_rows - gl.bmp_top;

                xDstSurf = x + (int)pos.getX() + (int) gl.getGlyphPointMetrics().getLSB();// + gl.bmp_left;
                yDstSurf = y - gl.bmp_top/*getPointHeight()*/  + (int) pos.getY();// - (gl.bmp_rows-gl.bmp_top);

                int textWidth = gl.bmp_width;
                int textHeight = gl.getPointHeight();

                // if Regions don't intersect
                if ((xDstSurf > cMaxX) || (yDstSurf > cMaxY) || (xDstSurf + textWidth < cMinX)
                        || (yDstSurf + textHeight < cMinY)) {
                    // Nothing to do
View Full Code Here

        int xBaseLine = x;
        int yBaseLine = y;

        for (char element : chars) {
            Glyph gl = font.getGlyph(element);
            GlyphMetrics pointMetrics = gl.getGlyphPointMetrics();
            if (gl.getWidth() == 0) {
                xBaseLine += pointMetrics.getAdvanceX();
                continue;
            }

            byte[] data = gl.getBitmap();
            if (data == null) {
                xBaseLine += pointMetrics.getAdvanceX();
            } else {

                xSrcSurf = 0;
                ySrcSurf = 0;

                xDstSurf = Math.round(xBaseLine + gl.getGlyphPointMetrics().getLSB());
                yDstSurf = yBaseLine - gl.bmp_top;

                int textWidth = gl.bmp_width;
                int textHeight = gl.getPointHeight();

                // if Regions don't intersect
                if ((xDstSurf > cMaxX) || (yDstSurf > cMaxY) || (xDstSurf + textWidth < cMinX)
                        || (yDstSurf + textHeight < cMinY)) {
                    // Nothing to do
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

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.