Package java.awt.font

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


        attrs.put(TextAttribute.FONT, joglRenderer.getFont());
        AttributedString str = new AttributedString(paragraph, attrs);
        LineBreakMeasurer measurer = new LineBreakMeasurer(str.getIterator(), frc);
        int curPos = 0;
        while (measurer.getPosition() < paragraph.length()) {
            int nextPos = measurer.nextOffset(width);
            String line = paragraph.substring(curPos, nextPos);
            TextDataImpl.TextLine textLine = new TextDataImpl.TextLine(line);
            //Rectangle2D bounds = renderer.getBounds(line);
            if (nextPos < paragraph.length()) {
                flowList.add(textLine);
View Full Code Here


            LineBreakMeasurer measurer = new LineBreakMeasurer(attrStr.getIterator(),
            frc);
            int nextPos = 0;
            int lineCnt = 0;
            while (measurer.getPosition() < text.length())  {
                nextPos = measurer.nextOffset(width/43);            // mergedCellWidth is the max width of each line
                lineCnt++;
                measurer.setPosition(nextPos);
            }
            if(255*lineCnt > r.getHeight()){
                r.setHeight((short)(255 * lineCnt));
 
View Full Code Here

            LineBreakMeasurer measurer = new LineBreakMeasurer(attrStr.getIterator(),
            frc);
            int nextPos = 0;
            int lineCnt = 0;
            while (measurer.getPosition() < text.length())  {
                nextPos = measurer.nextOffset(width/43);            // mergedCellWidth is the max width of each line
                lineCnt++;
                measurer.setPosition(nextPos);
            }
            if(255*lineCnt > r.getHeight()){
                r.setHeight((short)(255 * lineCnt));
 
View Full Code Here

            LineBreakMeasurer measurer = new LineBreakMeasurer(attrStr.getIterator(),
            frc);
            int nextPos = 0;
            int lineCnt = 0;
            while (measurer.getPosition() < text.length())  {
                nextPos = measurer.nextOffset(width/43);            // mergedCellWidth is the max width of each line
                lineCnt++;
                measurer.setPosition(nextPos);
            }
            if(255*lineCnt > r.getHeight()){
                r.setHeight((short)(255 * lineCnt));
 
View Full Code Here

                if (wordLength > maxLineLength) {
                    // This word by itself is too long to fit on one line so we truncate the word.
               
                    AttributedString attrString = new AttributedString (word);
                    LineBreakMeasurer measurer = new LineBreakMeasurer(attrString.getIterator(), context);
                    int index = measurer.nextOffset(maxLineLength);
               
                    // Add the previous line if there is any
                    if (lineBuffer.length() > 0) {
                        result.add (lineBuffer.toString ());
                        lineBuffer = new StringBuilder ();
View Full Code Here

            ((Graphics2D) g).getFontRenderContext());
        // The max width of the extra text line - need to leave
        // space for the popup arrow icon
        int maxFirstExtraLineWidth = width - x - ins.right - layoutHGap
            - labelHeight;
        int breakIndex = lineBreakMeasurer
            .nextOffset(maxFirstExtraLineWidth);

        TextLayoutInfo extraLineLayoutInfo1 = new TextLayoutInfo();
        extraLineLayoutInfo1.text = commandButton.getExtraText()
            .substring(0, breakIndex);
View Full Code Here

            ((Graphics2D) g).getFontRenderContext());
        // The max width of the extra text line - need to leave
        // space for the popup arrow icon
        int maxFirstExtraLineWidth = x - ins.left - layoutHGap
            - labelHeight;
        int breakIndex = lineBreakMeasurer
            .nextOffset(maxFirstExtraLineWidth);

        TextLayoutInfo extraLineLayoutInfo1 = new TextLayoutInfo();
        extraLineLayoutInfo1.text = commandButton.getExtraText()
            .substring(0, breakIndex);
View Full Code Here

                .getFontRenderContext());
        // The max width of the extra text line - need to leave
        // space for the popup arrow icon
        int maxFirstExtraLineWidth = width - x - ins.right - layoutHGap
            - labelHeight;
        int breakIndex = lineBreakMeasurer
            .nextOffset(maxFirstExtraLineWidth);

        TextLayoutInfo extraLineLayoutInfo1 = new TextLayoutInfo();
        extraLineLayoutInfo1.text = commandButton.getExtraText()
            .substring(0, breakIndex);
View Full Code Here

                .getFontRenderContext());
        // The max width of the extra text line - need to leave
        // space for the popup arrow icon
        int maxFirstExtraLineWidth = x - ins.left - layoutHGap
            - labelHeight;
        int breakIndex = lineBreakMeasurer
            .nextOffset(maxFirstExtraLineWidth);

        TextLayoutInfo extraLineLayoutInfo1 = new TextLayoutInfo();
        extraLineLayoutInfo1.text = commandButton.getExtraText()
            .substring(0, breakIndex);
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.