>     Text is quite tricky.  You need to manipulate the TextPaintInfo
> object that is attached to the AttributedString associated with the
> TextNode.  The tricky bit is that all of the tspan's are built into
> the one AttributedString so if you have 'complex' text you would have
> to track down the proper TextPaintInfo to update.

Do you mean `AttributedCharacterIterator'?  I see no AttributedString'
in a `TextNode'.

Is there a reason why all of this is so darned Byzantine?

Why, for instance, is a `StrokingTextPainter' so radically different
than a 'StrokeShapePainter'?  In the `StrokeShapePainter' there's a
`setPaint()' method that allows one to set the color of the object,
whereas in the `StrokingTextPainter' no such method exists and one has
to go through extraordinary contortions to get at the `TextPaintInfo'
for each individual *character* in a text string in order to set
color:

    private void updateTextNodeColor( Color rgb, TextNode text_node )

    {

        AttributedCharacterIterator aci =
            text_node.getAttributedCharacterIterator();

        for( char c = aci.first();
             c != CharacterIterator.DONE;
             c = aci.next() ) {

            TextPaintInfo tpi =
                ( TextPaintInfo ) aci.getAttribute( TextNode.PAINT_INFO );
            
            if ( tpi.fillPaint != null )
                tpi.fillPaint = rgb;
            if ( tpi.strokePaint != null )
                tpi.strokePaint = rgb;

        }

    }

It took me most of a day to figure out that you had to slog through
each character, one by one, in order to get all the characters in the
same string the same color.

I beg your pardon but that's just bizarre.

Oh, one minor point.  In `TextPaintInfo', the method name
`equivilent()' should be `equivalent()'.  I know in computing that
spelling doesn't necessarily have to be correct, but still. . .

                                                        spl

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to