Package org.apache.batik.gvt.text

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


                } else if (n.getLocalName().equals(SVG_TEXT_PATH_TAG)) {

                    SVGTextPathElementBridge textPathBridge
                        = (SVGTextPathElementBridge)ctx.getBridge(nodeElement);
                    TextPath newTextPath
                        = textPathBridge.createTextPath(ctx, nodeElement);
                    if (newTextPath != null) {
                        buildAttributedStrings(ctx,
                                           nodeElement,
                                           node,
View Full Code Here


        while (aci.current() != CharacterIterator.DONE) {

            int chunkStartIndex = aci.getIndex();
            boolean inChunk = true;
            boolean isChunkStart = true;
            TextPath prevTextPath = null;

            while (inChunk) {

                int start = aci.getRunStart(
                    GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_DELIMITER);
                int end = aci.getRunLimit(
                    GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_DELIMITER);

                AttributedCharacterIterator runaci =
                    new AttributedCharacterSpanIterator(aci, start, end);

                runaci.first();

                Float runX = (Float) runaci.getAttribute(
                    GVTAttributedCharacterIterator.TextAttribute.X);
                Float runY = (Float) runaci.getAttribute(
                    GVTAttributedCharacterIterator.TextAttribute.Y);
                TextPath textPath = (TextPath) runaci.getAttribute(
                    GVTAttributedCharacterIterator.TextAttribute.TEXTPATH);

                inChunk = (isChunkStart)
                        || ((runX == null || runX.isNaN())
                          &&(runY == null || runY.isNaN()));
View Full Code Here

        if (aci.current() != CharacterIterator.DONE) {
            int chunkStartIndex = aci.getIndex();

            // find out if this chunck is the start or end of a text path chunck
            // if it is, then we ignore any previous advance
            TextPath chunkTextPath = (TextPath) aci.getAttribute(
                   GVTAttributedCharacterIterator.TextAttribute.TEXTPATH);
            TextPath prevChunkTextPath = null;
            if (chunkStartIndex > 0) {
                aci.setIndex(chunkStartIndex-1);
                prevChunkTextPath = (TextPath) aci.getAttribute(
                   GVTAttributedCharacterIterator.TextAttribute.TEXTPATH);
                aci.setIndex(chunkStartIndex);
            }
            if (prevChunkTextPath != chunkTextPath) {
                advance = new Point2D.Float(0,0);
            }

            boolean isChunkStart = true;
            TextPath prevTextPath = null;
            Point2D prevTextPathAdvance = null;
            do {

                int start = aci.getRunStart(extendedAtts);
                int end = aci.getRunLimit(extendedAtts);

                runaci =
                    new AttributedCharacterSpanIterator(aci, start, end);

                runaci.first();

                Float runX = (Float) runaci.getAttribute(
                     GVTAttributedCharacterIterator.TextAttribute.X);
                Float runY = (Float) runaci.getAttribute(
                     GVTAttributedCharacterIterator.TextAttribute.Y);

                TextPath textPath =  (TextPath) runaci.getAttribute(
                   GVTAttributedCharacterIterator.TextAttribute.TEXTPATH);

                inChunk = (isChunkStart)
                        || ((runX == null || runX.isNaN())
                          &&(runY == null || runY.isNaN()));
View Full Code Here

                                                  SVG_TRANSFORM_ATTRIBUTE, s);
            pathShape = tr.createTransformedShape(pathShape);
        }

        // create the TextPath object that we are going to return
        TextPath textPath = new TextPath(new GeneralPath(pathShape));

        // set the start offset if specified
        s = textPathElement.getAttributeNS(null, SVG_START_OFFSET_ATTRIBUTE);
        if (s.length() > 0) {
            float startOffset = 0;
            int percentIndex = s.indexOf("%");
            if (percentIndex != -1) {
                // its a percentage of the length of the path
                float pathLength = textPath.lengthOfPath();
                String percentString = s.substring(0,percentIndex);
                float startOffsetPercent = 0;
                try {
                    startOffsetPercent = SVGUtilities.convertSVGNumber(percentString);
                } catch (NumberFormatException e) {
                    startOffsetPercent = -1;
                }
                if (startOffsetPercent < 0) {
                    throw new BridgeException(textPathElement, ERR_ATTRIBUTE_VALUE_MALFORMED,
                                              new Object[] {SVG_START_OFFSET_ATTRIBUTE, s});
                }
                startOffset = (float)(startOffsetPercent * pathLength/100.0);

            } else {
                // its an absolute length
                UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, textPathElement);
                startOffset = UnitProcessor.svgOtherLengthToUserSpace(s, SVG_START_OFFSET_ATTRIBUTE, uctx);
            }
            textPath.setStartOffset(startOffset);
        }

        return textPath;
    }
View Full Code Here

        while (aci.current() != CharacterIterator.DONE) {

            int chunkStartIndex = aci.getIndex();
            boolean inChunk = true;
            boolean isChunkStart = true;
            TextPath prevTextPath = null;

            while (inChunk) {

                int start = aci.getRunStart(
                    GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_DELIMITER);
                int end = aci.getRunLimit(
                    GVTAttributedCharacterIterator.TextAttribute.TEXT_COMPOUND_DELIMITER);

                AttributedCharacterIterator runaci =
                    new AttributedCharacterSpanIterator(aci, start, end);

                runaci.first();

                Float runX = (Float) runaci.getAttribute(
                    GVTAttributedCharacterIterator.TextAttribute.X);
                Float runY = (Float) runaci.getAttribute(
                    GVTAttributedCharacterIterator.TextAttribute.Y);
                TextPath textPath = (TextPath) runaci.getAttribute(
                    GVTAttributedCharacterIterator.TextAttribute.TEXTPATH);

                inChunk = (isChunkStart)
                        || ((runX == null || runX.isNaN())
                          &&(runY == null || runY.isNaN()));
View Full Code Here

        if (aci.current() != CharacterIterator.DONE) {
            int chunkStartIndex = aci.getIndex();

            // find out if this chunck is the start or end of a text path chunck
            // if it is, then we ignore any previous advance
            TextPath chunkTextPath = (TextPath) aci.getAttribute(
                   GVTAttributedCharacterIterator.TextAttribute.TEXTPATH);
            TextPath prevChunkTextPath = null;
            if (chunkStartIndex > 0) {
                aci.setIndex(chunkStartIndex-1);
                prevChunkTextPath = (TextPath) aci.getAttribute(
                   GVTAttributedCharacterIterator.TextAttribute.TEXTPATH);
                aci.setIndex(chunkStartIndex);
            }
            if (prevChunkTextPath != chunkTextPath) {
                advance = new Point2D.Float(0,0);
            }

            boolean isChunkStart = true;
            TextPath prevTextPath = null;
            Point2D prevTextPathAdvance = null;
            do {

                int start = aci.getRunStart(extendedAtts);
                int end = aci.getRunLimit(extendedAtts);

                runaci =
                    new AttributedCharacterSpanIterator(aci, start, end);

                runaci.first();

                Float runX = (Float) runaci.getAttribute(
                     GVTAttributedCharacterIterator.TextAttribute.X);
                Float runY = (Float) runaci.getAttribute(
                     GVTAttributedCharacterIterator.TextAttribute.Y);

                TextPath textPath =  (TextPath) runaci.getAttribute(
                   GVTAttributedCharacterIterator.TextAttribute.TEXTPATH);

                inChunk = (isChunkStart)
                        || ((runX == null || runX.isNaN())
                          &&(runY == null || runY.isNaN()));
View Full Code Here

        while (aci.current() != CharacterIterator.DONE) {

            int chunkStartIndex = aci.getIndex();
            boolean inChunk = true;
            boolean isChunkStart = true;
            TextPath prevTextPath = null;

            while (inChunk) {
                int start = aci.getRunStart(TEXT_COMPOUND_DELIMITER);
                int end = aci.getRunLimit(TEXT_COMPOUND_DELIMITER);
               
                // Go to start of compound.
                aci.setIndex(start);
                Float runX = (Float) aci.getAttribute
                    (GVTAttributedCharacterIterator.TextAttribute.X);
                Float runY = (Float) aci.getAttribute
                    (GVTAttributedCharacterIterator.TextAttribute.Y);
                TextPath textPath = (TextPath) aci.getAttribute
                    (GVTAttributedCharacterIterator.TextAttribute.TEXTPATH);

                inChunk = (   (isChunkStart)
                           || (   (runX == null || runX.isNaN())
                               && (runY == null || runY.isNaN())));
View Full Code Here

            int chunkStartIndex = aci.getIndex();

            // find out if this chunck is the start or end of a text
            // path chunck if it is, then we ignore any previous
            // advance
            TextPath chunkTextPath = (TextPath) aci.getAttribute
                (GVTAttributedCharacterIterator.TextAttribute.TEXTPATH);
            TextPath prevChunkTextPath = null;
            if (chunkStartIndex > 0) {
                aci.setIndex(chunkStartIndex-1);
                prevChunkTextPath = (TextPath) aci.getAttribute
                    (GVTAttributedCharacterIterator.TextAttribute.TEXTPATH);
                aci.setIndex(chunkStartIndex);
            }

            if (prevChunkTextPath != chunkTextPath) {
                advance = new Point2D.Float(0,0);
            }

            boolean isChunkStart = true;
            TextPath prevTextPath = null;
            Point2D prevTextPathAdvance = null;
            do {

                int start = aci.getRunStart(extendedAtts);
                int end   = aci.getRunLimit(extendedAtts);

                runaci = new AttributedCharacterSpanIterator(aci, start, end);

                runaci.first();

                Float runX = (Float) runaci.getAttribute
        (GVTAttributedCharacterIterator.TextAttribute.X);

                Float runY = (Float) runaci.getAttribute
        (GVTAttributedCharacterIterator.TextAttribute.Y);

                TextPath textPath =  (TextPath) runaci.getAttribute
        (GVTAttributedCharacterIterator.TextAttribute.TEXTPATH);
   
                inChunk = ((isChunkStart) ||
         ((runX == null || runX.isNaN()) &&
          (runY == null || runY.isNaN())));
View Full Code Here

                                           result);

                } else if (n.getLocalName().equals(SVG_TEXT_PATH_TAG)) {

                    SVGTextPathElementBridge textPathBridge = (SVGTextPathElementBridge)ctx.getBridge(nodeElement);
                    TextPath newTextPath = textPathBridge.createTextPath(ctx, nodeElement);
                    if (newTextPath != null) {
                        buildAttributedStrings(ctx,
                                           nodeElement,
                                           node,
                                           false,
View Full Code Here

                } else if (n.getLocalName().equals(SVG_TEXT_PATH_TAG)) {

                    SVGTextPathElementBridge textPathBridge
                        = (SVGTextPathElementBridge)ctx.getBridge(nodeElement);
                    TextPath newTextPath
                        = textPathBridge.createTextPath(ctx, nodeElement);
                    if (newTextPath != null) {
                        buildAttributedStrings(ctx,
                                           nodeElement,
                                           node,
View Full Code Here

TOP

Related Classes of org.apache.batik.gvt.text.TextPath

Copyright © 2018 www.massapicom. 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.