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

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


        float xPos = 0;    // X position to draw
        int count = 0;

       
        for (int i=0; i < len; i++){
            Glyph gl = wcf.getGlyph(str.charAt(i));

            int advance = (int)(gl.getGlyphPointMetrics().getAdvance());
            if (advance ==0){
                continue;
            }
            char c = gl.getChar();

            fontIndex = wcf.getCharFontIndex(c, 0);
           
            if (fontIndex != charFontIndex) {
                charFontIndex = fontIndex;
               
                at.transform(positions, 0, positions, 0, count);

                int status = NativeFont.gdiPlusDrawDriverChars(graphicsInfo,
                        chars,
                        count,
                        font,
                        positions,
                        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$
                }

                count = 0;
                font = gl.getPFont();
            }
            chars[count] = c;
            positions[count*2] = xPos;
            positions[count*2 + 1] = yPos;

View Full Code Here


        int ascent = wf.getAscent();
        long font = wf.getFontHandle();
        long oldFont = win32.SelectObject(hdc, font);

        for (int i=0; i < gv.getNumGlyphs(); i++){
            Glyph gl = ((CommonGlyphVector)gv).vector[i];
            char chr = gl.getChar();

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

            String sChar = String.valueOf(chr);
View Full Code Here

        int ascent = cf.getAscent();

        long font = 0;

        for (int i=0; i < gv.getNumGlyphs(); i++){
            Glyph gl = ((CommonGlyphVector)gv).vector[i];
            char chr = gl.getChar();

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

            String sChar = String.valueOf(chr);

            long glPFont = gl.getPFont();
            if (font != glPFont){
                font = glPFont;
                win32.SelectObject(hdc, font);
            }
View Full Code Here

         * */
        char[] chars = new char[str.length()];
        int j = 0;
        for (int i=0; i < str.length(); 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)
            if (gl.getGlyphMetrics().getAdvance() != 0){
                chars[j] = gl.getChar();
                j++;
            }
        }
        String out = new String(chars, 0, j);

View Full Code Here

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

            int glWidth = Math.round(gl.getGlyphPointMetrics().getAdvance());
            if (glWidth ==0){
                continue;
            }

            fontIndex = wcf.getCharFontIndex(c, 0);
View Full Code Here

     * doesn't exist in the WindowsFont 
     * @param index the specified character
     */
    @Override
    public Glyph getGlyph(char index) {
        Glyph result = null;
        Integer key = Integer.valueOf(index);
        if (glyphs.containsKey(key)) {
            result = glyphs.get(key);
        } else {
            if (this.addGlyph(index)) {
View Full Code Here

    /**
     * Returns default Glyph object of this WindowsFont.
     */
    @Override
    public Glyph getDefaultGlyph() {
        Glyph result;
        Integer defaultKey = Integer.valueOf(defaultChar);

        if (glyphs.containsKey(defaultKey)) {
            result = glyphs.get(defaultKey);
        } else {
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

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.