I suggest you look at StrokingTextPainter since that seems to have support for filling.
On Wed, Oct 29, 2014 at 12:27 PM, Ben Moxon <bmo...@cellohealth.com> wrote: > I am trying to use Batik to perform an SVG conversion and it is going > alright except that I can't seem to find out where the value of the fill > attribute for the original SVG document is stored on the Batik TextNode > element. So in my SVG I have the following: > > > > <text x="276.1875" y="120.390625" text-anchor="middle" font="10px > "Arial"" > > stroke="none" fill="#ffffff" style="-webkit-tap-highlight-color: > rgb(0, 0, 0); text-anchor: middle; font-style: normal; font-variant: > normal; font-weight: normal; font-stretch: normal; font-size: 10px; > line-height: normal; font-family: Arial;" > > font-size="10px" font-family="Arial"> > > <tspan dy="3.5" >Proportion </tspan> > > </text> > > > > This works fine, but when I am using my custom TextPainter ( through a > generic Bridge ) to try and process the TextNode I find the following: > > > > public void paint(TextNode node, Graphics2D g2d ) > > { > > AttributedCharacterIterator aci = > node.getAttributedCharacterIterator(); > > Paint colourInfo = > (Paint)aci.getAttribute(TextAttribute.FOREGROUND); //null > > Paint bgInfo = (Paint)aci.getAttribute(TextAttribute.BACKGROUND); > //null > > // do actual painting > > } > > > > In fact most of the attributes relating to colour that I can find looking > through the TextAttribute and GVT custom text attributes are coming back > null. The aci object does have a list of non-null attributes but I can't > figure out what the keys are from the debugger as they're all keyed off > attribute lists. > > > > The existing paint property of the Graphics2D object is usually set to the > colour of the block that it has just drawn, meaning if I don't change > things, I just get all my text appearing the same colour as the background, > making it hard to read. > > > > How can I find the colour for these text nodes that they are provided with > in the original SVG? > > > > If you prize reputation over mailing list kudos, I have also asked this > question on StackOverflow. > > > ------------------------------ > This email message has been delivered safely and archived online by > Mimecast. > For more information please visit http://www.mimecast.com > ------------------------------ >