Package com.google.code.appengine.awt.font

Examples of com.google.code.appengine.awt.font.LineMetrics


        Object val = fonts.get(new Integer(0));

        if (val instanceof Font) {
            Font firstFont = (Font) val;
            LineMetrics lm = firstFont.getLineMetrics(breaker.text, 0, 1, breaker.frc);
            baselineOffsets = lm.getBaselineOffsets();
            baselineIndex = lm.getBaselineIndex();
        } else if (val instanceof GraphicAttribute) {
            // Get first graphic attribute and use it
            GraphicAttribute ga = (GraphicAttribute) val;

            int align = ga.getAlignment();
View Full Code Here


     *
     * @param str specified String
     * @param frc specified FontRenderContext
     */
    private void setDefaultLineMetrics(String str, FontRenderContext frc){
        LineMetrics lm = fPhysicalFonts[0].getLineMetrics(str, frc, null);
        float maxCharWidth = (float)fPhysicalFonts[0].getMaxCharBounds(frc).getWidth();

        if (numFonts == 1) {
            this.nlm = (LineMetricsImpl)lm;
            return;
        }

        float[] baselineOffsets = lm.getBaselineOffsets();
        int numChars = str.length();

        // XXX: default value - common for all Fonts
        int baseLineIndex = lm.getBaselineIndex();

        float maxUnderlineThickness = lm.getUnderlineThickness();
        float maxUnderlineOffset = lm.getUnderlineOffset();
        float maxStrikethroughThickness = lm.getStrikethroughThickness();
        float minStrikethroughOffset = lm.getStrikethroughOffset();
        float maxLeading = lm.getLeading()// External leading
        float maxHeight = lm.getHeight();   // Height of the font ( == (ascent + descent + leading))
        float maxAscent = lm.getAscent();   // Ascent of the font
        float maxDescent = lm.getDescent(); // Descent of the font

        for (int i = 1; i < numFonts; i++){
            lm = fPhysicalFonts[i].getLineMetrics(str, frc, null);
            if (maxUnderlineThickness < lm.getUnderlineThickness()){
                maxUnderlineThickness = lm.getUnderlineThickness();
            }

            if (maxUnderlineOffset < lm.getUnderlineOffset()){
                maxUnderlineOffset = lm.getUnderlineOffset();
            }

            if (maxStrikethroughThickness < lm.getStrikethroughThickness()){
                maxStrikethroughThickness = lm.getStrikethroughThickness();
            }

            if (minStrikethroughOffset > lm.getStrikethroughOffset()){
                minStrikethroughOffset = lm.getStrikethroughOffset();
            }

            if (maxLeading < lm.getLeading()){
                maxLeading = lm.getLeading();
            }

            if (maxAscent < lm.getAscent()){
                maxAscent = lm.getAscent();
            }

            if (maxDescent < lm.getDescent()){
                maxDescent = lm.getDescent();
            }

            float width = (float)fPhysicalFonts[i].getMaxCharBounds(frc).getWidth();
            if(maxCharWidth < width){
                maxCharWidth = width;
            }
            for (int j =0; j < baselineOffsets.length; j++){
                float[] offsets = lm.getBaselineOffsets();
                if (baselineOffsets[j] > offsets[j]){
                    baselineOffsets[j] = offsets[j];
                }
            }

View Full Code Here

        if (nlm == null){
            setDefaultLineMetrics("", frc); //$NON-NLS-1$
        }

        LineMetrics lm = nlm;
        float minY = -lm.getAscent();
        float minX = 0;
        float height = lm.getHeight();
        float width = 0;

        for (int i = start; i < end; i++){
            width += charWidth(chars[i]);
        }
View Full Code Here

        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;
            char[] subChars = new char[len];
            System.arraycopy(chars, start, subChars, 0, len);
View Full Code Here

TOP

Related Classes of com.google.code.appengine.awt.font.LineMetrics

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.