Package java.awt.font

Examples of java.awt.font.LineBreakMeasurer.nextLayout()


      // instancia um line breaker para o texto formatado
      LineBreakMeasurer quebrador = new LineBreakMeasurer(str.getIterator(),
          gr.getFontRenderContext());   
   
      // cria um TextLayout para armazenar cada linha 'quebrada'
      TextLayout linha = quebrador.nextLayout(larguraTexto);
      while (linha != null) {

        // posiciona o texto
        posY += linha.getAscent();
       
View Full Code Here


                LineBreakMeasurer lbm = new LineBreakMeasurer(aci, fontRenderContext);

                int contentWidth = width - (padding.left + padding.right);

                while (lbm.getPosition() < aci.getEndIndex()) {
                    TextLayout textLayout = lbm.nextLayout(contentWidth);
                    y += textLayout.getAscent();
                    drawText(graphics, textLayout, y);
                    y += textLayout.getDescent() + textLayout.getLeading();
                }
            } else {
View Full Code Here

        // precalculating the render pictureheight
        double renderHeight = padTop + padBottom;
        int numRows = 0;
        while ( measurer.getPosition() < iterator.getEndIndex() )
        {
            if ( ( layout = measurer.nextLayout( wrappingWidth ) ) == null || ( numRows >= maxRows ) )
            {
                break;
            }
            numRows++;
            renderHeight += layout.getAscent() + layout.getDescent() + layout.getLeading();
View Full Code Here

        iterator = attributedString.getIterator();
        measurer = new LineBreakMeasurer( iterator, context );
        numRows = 0;
        while ( measurer.getPosition() < iterator.getEndIndex() )
        {
            if ( ( layout = measurer.nextLayout( wrappingWidth ) ) == null || ( numRows >= maxRows ) )
            {
                break;
            }
            numRows++;
            pen.y += layout.getAscent();
View Full Code Here

    while (measurer.getPosition() < characterIterator.getEndIndex() && currentHeight <= availableHeight) {
      
      int previousPosition = measurer.getPosition();
     
      // Request next layout
      layout = measurer.nextLayout(width);
     
      int height = ((Float)(layout.getDescent() + layout.getAscent() + layout.getLeading())).intValue();
     
      if(currentHeight + height > availableHeight) {
        // The line we're about to add should NOT be added anymore, append three dots to previous one instead
View Full Code Here

                AttributedCharacterIterator aci = attributedText.getIterator();
                LineBreakMeasurer lbm = new LineBreakMeasurer(aci, fontRenderContext);

                float lineHeights = 0;
                while (lbm.getPosition() < aci.getEndIndex()) {
                    TextLayout line = lbm.nextLayout(width);
                    lines.add(line);
                    lineHeights += line.getAscent() + line.getDescent()
                        + line.getLeading();
                }
View Full Code Here

            descText);
        attributedDescription.addAttribute(TextAttribute.FONT, font);
        LineBreakMeasurer lineBreakMeasurer = new LineBreakMeasurer(
            attributedDescription.getIterator(), frc);
        while (true) {
          TextLayout tl = lineBreakMeasurer.nextLayout(descTextWidth);
          if (tl == null)
            break;
          descriptionTextHeight += fontHeight;
        }
        // add an empty line after the paragraph
View Full Code Here

          attributedDescription
              .addAttribute(TextAttribute.FONT, font);
          LineBreakMeasurer lineBreakMeasurer = new LineBreakMeasurer(
              attributedDescription.getIterator(), frc);
          while (true) {
            TextLayout tl = lineBreakMeasurer
                .nextLayout(availableWidth);
            if (tl == null)
              break;
            footerTextHeight += fontHeight;
          }
View Full Code Here

        attributedDescription.addAttribute(TextAttribute.FONT, font);
        LineBreakMeasurer lineBreakMeasurer = new LineBreakMeasurer(
            attributedDescription.getIterator(), frc);
        int currOffset = 0;
        while (true) {
          TextLayout tl = lineBreakMeasurer
              .nextLayout(descLabelWidth);
          if (tl == null)
            break;
          int charCount = tl.getCharacterCount();
          String line = descText.substring(currOffset, currOffset
View Full Code Here

              .addAttribute(TextAttribute.FONT, font);
          LineBreakMeasurer lineBreakMeasurer = new LineBreakMeasurer(
              attributedDescription.getIterator(), frc);
          int currOffset = 0;
          while (true) {
            TextLayout tl = lineBreakMeasurer
                .nextLayout(footerLabelWidth);
            if (tl == null)
              break;
            int charCount = tl.getCharacterCount();
            String line = footerText.substring(currOffset,
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.