Package java.awt.font

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


            TextLayout layout = measurer.nextLayout((float)wrappingWidth, nextBreak, true);
            if (layout == null) {
                 // layout can be null if the entire word at the current position
                 // does not fit within the wrapping width. Try with requireNextWord=false.
                 layout = measurer.nextLayout((float)wrappingWidth, nextBreak, false);
            }

            if(layout == null) {
                // exit if can't break any more
                break;
View Full Code Here


                  if (linebreakPos.size() > 0) {
                    maxOffs = linebreakPos.get(0);
                  }

                  while ((layout =
                      lbm.nextLayout(Math.max(0, width - 6), maxOffs, false)) != null) {
                    Rectangle2D r = layout.getBounds();
                    dim.width = Math.max((int) r.getWidth(), dim.width);
                    dim.height +=
                        (int) (layout.getAscent() + layout.getDescent() + layout
                            .getLeading());
View Full Code Here

    while (measurer.getPosition() < characterIterator.getEndIndex() && currentHeight <= boxHeight) {
      
      int previousPosition = measurer.getPosition();
     
      // Request next layout
      layout = measurer.nextLayout(boxWidth);
     
      int height = ((Float)(layout.getDescent() + layout.getAscent() + layout.getLeading())).intValue();
     
      if(currentHeight + height > boxHeight) {
        // 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 = as.getIterator();
      FontRenderContext frc = new FontRenderContext(null, true, false);
      LineBreakMeasurer lbm = new LineBreakMeasurer(aci, frc);
     
      while (lbm.getPosition() < text.length()) {
        TextLayout tl = lbm.nextLayout(wrapWidth);
        textY += tl.getAscent();
        Rectangle2D bb = tl.getBounds();
        double tX = graphicInfo.getX();
        if (centered)
            tX += (int) (graphicInfo.getWidth() / 2 - bb.getWidth() / 2);
View Full Code Here

      if(currentLine < newlineLocations.size())
        startOfNextLayout = newlineLocations.get(currentLine) + 1;
      else
        startOfNextLayout = endIndex + 1;

      layout = lbm.nextLayout(width, startOfNextLayout, false);

      lines.add(layout);

      if(lbm.getPosition() == startOfNextLayout)
        currentLine += 1;
View Full Code Here

                // setup iteration and start splitting at word boundaries
                int prevPosition = 0;
                while (lineMeasurer.getPosition() < iter.getEndIndex()) {
                    // grab the next portion of text within the wrapping limits
                    TextLayout layout = lineMeasurer.nextLayout(labelItem.getAutoWrap(), line.length(), true);
                    int newPosition = prevPosition;

                    if (layout != null) {
                        newPosition = lineMeasurer.getPosition();
                    } else {
View Full Code Here

      float dx;
      TextLayout txtLay;
       
      try {
        while( lbm.getPosition() < styledText.getEndIndex() ) {
          txtLay  = lbm.nextLayout( w );
          y       += txtLay.getAscent();
          if( y + txtLay.getDescent() > yStop ) break;
          dx    = (w - txtLay.getVisibleAdvance()) *
            (txtLay.isLeftToRight() ? halign : (1.0f - halign));
         
View Full Code Here

      LineBreakMeasurer msr = (LineBreakMeasurer) measurers.elementAt(i);
      if (msr != null) {
        msr.setPosition(paragraphStart);
        while (msr.getPosition() < paragraphEnd) {
          int begin = msr.getPosition();
          TextLayout layout = msr.nextLayout(textWidth);
          int end = begin + layout.getCharacterCount();

          // update the lineheight if that's necessary
          lineHeight = layout.getAscent() + layout.getDescent() + layout.getLeading();
          lineAscent = layout.getAscent();
View Full Code Here

      // paragraph has been displayed.
      if (measurer != null) {
        while (measurer.getPosition() < paragraphEnd) {

          // Retrieve next layout.
          TextLayout layout = measurer.nextLayout(textWidth);
          bottomBoundary = topBoundary + lineHeight;

          if ((clickY > topBoundary) && (clickY < bottomBoundary)) {
            // Get the character position of the mouse click.
            TextHitInfo currentHit = layout.hitTestChar((float)clickX, (float)clickY);
View Full Code Here

        linha.draw(gr, posX, posY);
       
        // soma espa�o para a proxima linha
        posY += linha.getDescent() + linha.getLeading();
       
        linha = quebrador.nextLayout(larguraTexto);
      }
     
    } // fim dos paragrafos
   
    return PAGE_EXISTS;
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.