Examples of TextSpanLayout


Examples of org.apache.batik.gvt.text.TextSpanLayout

        // for each text run, get its outline and append it to the overall
        // outline

        for (int i = 0; i < textRuns.size(); ++i) {
            TextRun textRun = (TextRun)textRuns.get(i);
            TextSpanLayout textRunLayout = textRun.getLayout();
            GeneralPath textRunOutline =
    new GeneralPath(textRunLayout.getOutline());

            if (outline == null) {
               outline = textRunOutline;
            } else {
                outline.setWindingRule(GeneralPath.WIND_NON_ZERO);
View Full Code Here

Examples of org.apache.batik.gvt.text.TextSpanLayout

            TextRun textRun = (TextRun)textRuns.get(i);
            AttributedCharacterIterator textRunACI = textRun.getACI();
            textRunACI.first();

            TextSpanLayout textRunLayout = textRun.getLayout();

            Stroke stroke = (Stroke) textRunACI.getAttribute
    (GVTAttributedCharacterIterator.TextAttribute.STROKE);

            Paint strokePaint = (Paint) textRunACI.getAttribute
    (GVTAttributedCharacterIterator.TextAttribute.STROKE_PAINT);

            if (stroke != null && strokePaint != null) {
                // this textRun is stroked
                Shape textRunOutline =
        textRunLayout.getOutline();
                textRunStrokeOutline =
        stroke.createStrokedShape(textRunOutline);
            }

            if (textRunStrokeOutline != null) {
View Full Code Here

Examples of org.apache.batik.gvt.text.TextSpanLayout

        List textRuns = getTextRuns(node, aci);

        // for each text run, see if its been hit
        for (int i = 0; i < textRuns.size(); ++i) {
            TextRun textRun = (TextRun)textRuns.get(i);
            TextSpanLayout layout = textRun.getLayout();
            TextHit textHit = layout.hitTestChar((float) x, (float) y);
            if (textHit != null && layout.getBounds().contains(x,y)) {
                return new BasicTextPainter.BasicMark(node, textHit);
            }
        }

        return null;
View Full Code Here

Examples of org.apache.batik.gvt.text.TextSpanLayout

        // get the list of text runs
        List textRuns = getTextRuns(textNode, aci);
        Iterator trI = textRuns.iterator();
        int startGlyphIndex = -1;
        int endGlyphIndex = -1;
        TextSpanLayout startLayout=null, endLayout=null;
        while (trI.hasNext()) {
            TextRun tr = (TextRun)trI.next();
            TextSpanLayout tsl = tr.getLayout();
            if (startGlyphIndex == -1) {
                startGlyphIndex  = tsl.getGlyphIndex(result[0]);
                if (startGlyphIndex != -1)
                    startLayout = tsl;
            }
               
            if (endGlyphIndex == -1) {
                endGlyphIndex = tsl.getGlyphIndex(result[1]);
                if (endGlyphIndex != -1)
                    endLayout = tsl;
            }
            if ((startGlyphIndex != -1) && (endGlyphIndex != -1))
                break;
View Full Code Here

Examples of org.apache.batik.gvt.text.TextSpanLayout

        // for each text run, append any highlight it may contain for
        // the current selection
        for (int i = 0; i < textRuns.size(); ++i) {
            TextRun textRun = (TextRun)textRuns.get(i);
            TextSpanLayout layout = textRun.getLayout();

            Shape layoutHighlightedShape = layout.getHighlightShape
                (beginIndex, endIndex);

            // append the highlighted shape of this layout to the
            // overall hightlighted shape
            if (( layoutHighlightedShape != null) &&
View Full Code Here

Examples of org.apache.batik.gvt.text.TextSpanLayout

                }
    for (int i = 0 ; i < list.size(); i++) {
                    StrokingTextPainter.TextRun run =
                        (StrokingTextPainter.TextRun)list.get(i);
                    AttributedCharacterIterator aci = run.getACI();
                    TextSpanLayout layout = run.getLayout();
                    float x = (float)coords.getX();
                    float y = (float)coords.getY();
                    TextHit textHit = layout.hitTestChar(x, y);
                    if (textHit != null && layout.getBounds().contains(x, y)) {
                        Object delimiter = aci.getAttribute
                            (GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_DELIMITER);
                        if (delimiter instanceof Element) {
                            return (Element)delimiter;
                        }
View Full Code Here

Examples of org.apache.batik.gvt.text.TextSpanLayout

                if (list != null){
                    for (int i = 0 ; i < list.size(); i++) {
                        StrokingTextPainter.TextRun run =
                            (StrokingTextPainter.TextRun)list.get(i);
                        AttributedCharacterIterator aci = run.getACI();
                        TextSpanLayout layout = run.getLayout();
                        float x = (float)coords.getX();
                        float y = (float)coords.getY();
                        TextHit textHit = layout.hitTestChar(x, y);
                        if (textHit != null && layout.getBounds().contains(x, y)) {
                            Object delimiter = aci.getAttribute
                                (GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_DELIMITER);
                            if (delimiter instanceof Element) {
                                return (Element)delimiter;
                            }
View Full Code Here

Examples of org.apache.batik.gvt.text.TextSpanLayout

        List list = tn.getTextRuns();
        Set elems = new HashSet();
        for (int i = 0 ; i < list.size(); i++) {
            StrokingTextPainter.TextRun run;
            run = (StrokingTextPainter.TextRun)list.get(i);
            TextSpanLayout layout = run.getLayout();
            AttributedCharacterIterator aci = run.getACI();
            aci.first();
            Element elem = (Element)aci.getAttribute(TEXT_COMPOUND_DELIMITER);

            if (elem == null) continue;
            if (elems.contains(elem)) continue;
            if (!isTextSensitive(elem))   continue;

            Rectangle2D glBounds = layout.getBounds2D();
            if (glBounds != null)
                glBounds = at.createTransformedShape(glBounds).getBounds2D();

            if (!rect.intersects(glBounds))
                continue;

            GVTGlyphVector gv = layout.getGlyphVector();
            for (int g = 0; g < gv.getNumGlyphs(); g++) {
                Shape gBounds = gv.getGlyphLogicalBounds(g);
                if (gBounds != null)
                    gBounds = at.createTransformedShape
                        (gBounds).getBounds2D();
View Full Code Here

Examples of org.apache.batik.gvt.text.TextSpanLayout

        Set reject = new HashSet();
        List list = tn.getTextRuns();
        for (int i = 0 ; i < list.size(); i++) {
            StrokingTextPainter.TextRun run;
            run = (StrokingTextPainter.TextRun)list.get(i);
            TextSpanLayout layout = run.getLayout();
            AttributedCharacterIterator aci = run.getACI();
            aci.first();
            Element elem = (Element)aci.getAttribute(TEXT_COMPOUND_DELIMITER);

            if (elem == null) continue;
            if (reject.contains(elem)) continue;
            if (!isTextSensitive(elem)) {
                reject.add(elem);
                continue;
            }
                       
            Rectangle2D glBounds = layout.getBounds2D();
            if (glBounds != null)
                glBounds = at.createTransformedShape
                    (glBounds).getBounds2D();

            if (rect.contains(glBounds)) {
View Full Code Here

Examples of org.apache.batik.gvt.text.TextSpanLayout

        List list = tn.getTextRuns();
        for (int i = 0 ; i < list.size(); i++) {
            StrokingTextPainter.TextRun run;
            run = (StrokingTextPainter.TextRun)list.get(i);
            TextSpanLayout layout = run.getLayout();
            AttributedCharacterIterator aci = run.getACI();
            aci.first();
            Element runElem = (Element)aci.getAttribute
                (TEXT_COMPOUND_DELIMITER);
            if (runElem == null) continue;

            // Only consider runElem if it is sensitive.
            if (checkSensitivity && !isTextSensitive(runElem)) continue;

            Element p = runElem;
            while ((p != null) && (p != txtElem) && (p != elem)) {
                p = (Element)p.getParentNode();
            }
            if (p != elem) continue;

            // runElem is a child of elem so check it out.
            Rectangle2D glBounds = layout.getBounds2D();
            if (glBounds == null) continue;
            glBounds = at.createTransformedShape(glBounds).getBounds2D();
            if (!rect.intersects(glBounds)) continue;
           
            GVTGlyphVector gv = layout.getGlyphVector();
            for (int g = 0; g < gv.getNumGlyphs(); g++) {
                Shape gBounds = gv.getGlyphLogicalBounds(g);
                if (gBounds != null)
                    gBounds = at.createTransformedShape
                        (gBounds).getBounds2D();
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.