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

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


            return (LineMetricsImpl)nlm.clone();
        }
        float[] metrics = NativeFont.getNativeLineMetrics(this.getFontHandle(), this.getSize(), false, false, this.getFontType());
        int _numChars = 0;

        nlm = new LineMetricsImpl(_numChars, metrics, null);
        return (LineMetricsImpl)nlm.clone();
    }
View Full Code Here


     * Returns a LineMetrics object that contains text metrics of this
     * WindowsFont.
     */
    @Override
    public LineMetrics getLineMetrics(String str, FontRenderContext frc, AffineTransform at) {
        LineMetricsImpl lm = getDefaultLineMetrics();
        lm.setNumChars(str.length());

        if ((at != null) && (!at.isIdentity())){
            lm.scale((float)at.getScaleX(), (float)at.getScaleY());
        }

        return lm;
    }
View Full Code Here

        //TODO: frc isn't used now
       
        // Initialize baseline offsets
        nlm.getBaselineOffsets();
       
        LineMetricsImpl lm = (LineMetricsImpl)(this.nlm.clone());
        lm.setNumChars(str.length());

        if ((at != null) && (!at.isIdentity())){
            lm.scale((float)at.getScaleX(), (float)at.getScaleY());
        }

        return lm;
    }
View Full Code Here

            return (LineMetricsImpl)nlm.clone();
        }
        float[] metrics = NativeFont.getNativeLineMetrics(this.getFontHandle(), this.getSize(), false, false, this.getFontType());
        int _numChars = 0;

        nlm = new LineMetricsImpl(_numChars, metrics, null);
        return (LineMetricsImpl)nlm.clone();
    }
View Full Code Here

     * Returns a LineMetrics object that contains text metrics of this
     * WindowsFont.
     */
    @Override
    public LineMetrics getLineMetrics(String str, FontRenderContext frc, AffineTransform at) {
        LineMetricsImpl lm = getDefaultLineMetrics();
        lm.setNumChars(str.length());

        if ((at != null) && (!at.isIdentity())){
            lm.scale((float)at.getScaleX(), (float)at.getScaleY());
        }

        return lm;
    }
View Full Code Here

        //TODO: frc isn't used now
       
        // Initialize baseline offsets
        nlm.getBaselineOffsets();
       
        LineMetricsImpl lm = (LineMetricsImpl)(this.nlm.clone());
        lm.setNumChars(str.length());

        if ((at != null) && (!at.isIdentity())){
            lm.scale((float)at.getScaleX(), (float)at.getScaleY());
        }

        return lm;
    }
View Full Code Here

                float _ascent, float _descent, float _maxCharWidth) {*/

//        System.out.println("LineMetricsImpl");
       
        
        LineMetricsImpl lm;
        if (USE_CONSTANT_METRICS) {
            float height = size;
            float ascent = canDisplay('H') ?
                    getGlyph('H').getHeight() :
                        (height *3) /4;
            float descent = canDisplay('p') ?
                    (float) getGlyph('p').getGlyphMetrics().getBounds2D().getMaxY() :
                        height / 4;
                       
            lm = new LineMetricsImpl(
                    str.length(), //_numChars number of chars
                    0, //_baseLineIndex index of the baseline offset
                    new float[]{0, (-ascent+descent)/2, -ascent}, //_baselineOffsets an array of baseline offsets
                    ascent/13, //_underlineThickness underline thickness
                    -descent/2, //_underlineOffset underline offset
                    ascent/13, //_strikethroughThickness strikethrough thickness
                    ascent/2, //_strikethroughOffset strinkethrough offset
                    height - ascent- descent, //_leading leading of the font
                    height, //_height font height
                    ascent, //_ascent ascent of the font
                    descent, //_descent descent of the font
                    canDisplay('W') ? getGlyph('W').getWidth() : getGlyph(' ').getWidth()); //_maxCharWidth max char width
           
        } else {
            float[] metrics = getLineMetrics(pFont);
            lm = new LineMetricsImpl(
                    str.length(), //_numChars number of chars
                    0, //_baseLineIndex index of the baseline offset
                    new float[]{0, (-metrics[0]+metrics[1])*size/2, -metrics[0]*size}, //_baselineOffsets an array of baseline offsets
                    metrics[3]*size, //_underlineThickness underline thickness
                    metrics[4]*size, //_underlineOffset underline offset
                    metrics[5]*size, //_strikethroughThickness strikethrough thickness
                    metrics[6]*size, //_strikethroughOffset strinkethrough offset
                    metrics[2]*size, //_leading leading of the font
                    (metrics[0] + metrics[1] + metrics[2])*size, //_height font height
                    metrics[0]*size, //_ascent ascent of the font
                    metrics[1]*size, //_descent descent of the font
                    metrics[7]*size); //_maxCharWidth max char width
        }
       
                  
 
        if ((at != null) && (!at.isIdentity())){
            lm.scale((float)at.getScaleX(), (float)at.getScaleY());
        }       
       
        return lm;
    }
View Full Code Here

            return (LineMetricsImpl)nlm.clone();
        }
        float[] metrics = NativeFont.getNativeLineMetrics(this.getFontHandle(), this.getSize(), false, false, this.getFontType());
        int _numChars = 0;

        nlm = new LineMetricsImpl(_numChars, metrics, null);
        return (LineMetricsImpl)nlm.clone();
    }
View Full Code Here

     * WindowsFont.
     */
    @Override
    public LineMetrics getLineMetrics(String str, FontRenderContext frc, AffineTransform at) {
        AffineTransform frcAt = null;
        LineMetricsImpl lm = getDefaultLineMetrics();
        lm.setNumChars(str.length());
       
        if (frc != null)
            frcAt = frc.getTransform();

        if ((at != null) && (!at.isIdentity())){
            if (frcAt != null)
                at.concatenate(frcAt);
            lm.scale((float)at.getScaleX(), (float)at.getScaleY());
        } else if ((frcAt != null) && (!frcAt.isIdentity())){
            lm.scale((float)frcAt.getScaleX(), (float)frcAt.getScaleY());
        }

        return lm;
    }
View Full Code Here

        //TODO: frc isn't used now
       
        // Initialize baseline offsets
        nlm.getBaselineOffsets();
       
        LineMetricsImpl lm = (LineMetricsImpl)(this.nlm.clone());
        lm.setNumChars(str.length());

        if ((at != null) && (!at.isIdentity())){
            lm.scale((float)at.getScaleX(), (float)at.getScaleY());
        }

        return lm;
    }
View Full Code Here

TOP

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

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.