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

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


    public TextLayout getLayout(int start, int limit) {
        breaker.pushSegments(start - aci.getBeginIndex(), limit - aci.getBeginIndex());

        breaker.createAllSegments();
        TextLayout layout = new TextLayout((TextRunBreaker) breaker.clone());

        breaker.popSegments();
        return layout;
    }
View Full Code Here


        int nextPosition = nextOffset(wrappingWidth, offsetLimit, requireNextWord);

        if (nextPosition == position) {
            return null;
        }
        TextLayout layout = tm.getLayout(position, nextPosition);
        position = nextPosition;
        return layout;
    }
View Full Code Here

        txt.setWordWrap(TextBox.WrapNone);
        txt.setHorizontalAlignment(TextBox.AlignLeft);
        txt.setVerticalAlignment(TextBox.AnchorMiddle);


        TextLayout layout = new TextLayout(s, _font, getFontRenderContext());
        float ascent = layout.getAscent();

        float width = (float) Math.floor(layout.getAdvance());
        /**
         * Even if top and bottom margins are set to 0 PowerPoint
         * always sets extra space between the text and its bounding box.
         *
         * The approximation height = ascent*2 works good enough in most cases
View Full Code Here

      this.getGraphics2D().setPaint( this.getChartProperties().getTitleFont().getPaint() );

      //---draw each title line.  Subtract padding from each side for printable width.
      float wrappingWidth= this.getImageWidth() - ( this.getChartProperties().getEdgePadding() * 2 );

      TextLayout titleTextLayout= null;
      while( ( titleTextLayout = measurer.nextLayout( wrappingWidth ) ) != null )
      {
        //---set the current line to where the title will be written
        currentLine += titleTextLayout.getAscent();

        titleTextLayout.draw( this.getGraphics2D(),
                       ( ( this.getImageWidth() - titleTextLayout.getAdvance() ) / 2 ),
                       currentLine );

        //---keep track of total height of all the title lines
        height +=  titleTextLayout.getAscent() + titleTextLayout.getDescent();
      }

      //---add in the padding between the title and the top of the chart.
      height += this.getChartProperties().getTitlePadding();
    }
View Full Code Here

        for (int i = 0; i < attributes.size(); i++) {
            ((AttributeEntry)attributes.elementAt(i)).apply(attributedString);
        }

        // create the layout
        return new TextLayout(
            attributedString.getIterator(),
            graphics.getFontRenderContext());
    }
View Full Code Here

TOP

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

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.