Package java.awt.font

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


                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


      FontRenderContext frc = g.getFontRenderContext();
      LineBreakMeasurer lbm = new LineBreakMeasurer(attrstr.getIterator(), frc);
      layouts.clear();
      int pos = lbm.getPosition();
      int linebreak = text.indexOf("\n", pos);
      TextLayout tl = lbm.nextLayout((float)dispArea.getWidth(), (linebreak == -1 ? text.length() : linebreak + 1), false);
      do {
        layouts.add(tl);
        pos = lbm.getPosition();
        linebreak = text.indexOf("\n", pos);
        tl = lbm.nextLayout((float)dispArea.getWidth(), (linebreak == -1 ? text.length() : linebreak + 1), false);
View Full Code Here

      TextLayout tl = lbm.nextLayout((float)dispArea.getWidth(), (linebreak == -1 ? text.length() : linebreak + 1), false);
      do {
        layouts.add(tl);
        pos = lbm.getPosition();
        linebreak = text.indexOf("\n", pos);
        tl = lbm.nextLayout((float)dispArea.getWidth(), (linebreak == -1 ? text.length() : linebreak + 1), false);
      } while(tl != null);
      metrics = g.getFontMetrics(font);
      int h = metrics.getHeight() * layouts.size();
     
      if(h < dispArea.getHeight()) {
View Full Code Here

                AttributedString styledText = new AttributedString(line);
                LineBreakMeasurer measurer = new LineBreakMeasurer(styledText.getIterator(), frc);

                while (measurer.getPosition() < line.length()) {

                    TextLayout layout = measurer.nextLayout(lineWidth - startX);

                    cursor.y += (layout.getAscent());
                    float dx = layout.isLeftToRight() ? 0 : (lineWidth - layout.getAdvance());

                    layout.draw(g, cursor.x + dx, cursor.y);
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

                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

                AttributedString styledText = new AttributedString(line);
                LineBreakMeasurer measurer = new LineBreakMeasurer(styledText.getIterator(), frc);

                while (measurer.getPosition() < line.length()) {

                    TextLayout layout = measurer.nextLayout(lineWidth - startX);

                    cursor.y += (layout.getAscent());
                    float dx = layout.isLeftToRight() ? 0 : (lineWidth - layout.getAdvance());

                    layout.draw(g, cursor.x + dx, cursor.y);
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.