Package java.awt.font

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


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

            float lineHeights = 0;
            while (lbm.getPosition() < aci.getEndIndex()) {
                int offset = lbm.nextOffset(contentWidth);

                LineMetrics lm = font.getLineMetrics(aci,
                    lbm.getPosition(), offset, fontRenderContext);

                float lineHeight = lm.getAscent() + lm.getDescent()
View Full Code Here


    astr.addAttribute(TextAttribute.FONT, lbl.getFont());
    FontRenderContext frc = lbl.getFontMetrics(lbl.getFont()).getFontRenderContext();
    LineBreakMeasurer lbm = new LineBreakMeasurer(astr.getIterator(), frc);
    Vector<String> lines = new Vector<String>();
    int prevOffs = 0;
    int offs = lbm.nextOffset(width, text.length(), false);
    do {
      lines.add(text.substring(prevOffs, offs));
      lbm.setPosition(offs);
      prevOffs = offs;
      offs = lbm.nextOffset(width, text.length(), false);
View Full Code Here

    int offs = lbm.nextOffset(width, text.length(), false);
    do {
      lines.add(text.substring(prevOffs, offs));
      lbm.setPosition(offs);
      prevOffs = offs;
      offs = lbm.nextOffset(width, text.length(), false);
    } while(offs > prevOffs);
   
    StringBuilder output = new StringBuilder();
    output.append("<html><center>");
    for(int i = 0; i < lines.size(); i++) {
View Full Code Here

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

            float lineHeights = 0;
            while (lbm.getPosition() < aci.getEndIndex()) {
                int offset = lbm.nextOffset(contentWidth);

                LineMetrics lm = font.getLineMetrics(aci,
                    lbm.getPosition(), offset, fontRenderContext);

                float lineHeight = lm.getAscent() + lm.getDescent()
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.