xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas DeWeese <Thomas.DeWe...@Kodak.com>
Subject Re: Setting Text Colors
Date Sun, 24 Oct 2004 12:01:07 GMT
Hi Urs,

Urs Reupke wrote:

>>   This code looks right to me.  is there any chance that you are
>> doing something silly like setting the text to the same color as
>> the background?
> 
> Chances were :), but I thought of this, too, and explicitly set
> the colors to be of pure red (255,0,0) for the background and pure green 
> (0,255,0) for the text for testing purposes. I don't think that this is 
> the problem.
> Maybe I'm doing some other silly thing and just not seeing it.
> 
>>    Can you still select the text?
>>    I take it other modifications in the document work
>> (i.e. the problem isn't in supporting dynamic updates in general).
> 
> I can select the text, though the select-Box appears to be empty (no glyphs
> are shown, just the surrounding box), and onClick-Events are still 
> handled correctly. Dynamic updates are supported, I explicitly set the 
> document to be dynamic on loading.

    My guess would be that the code that is setting the fill on the
polygon is going overboard and setting the fill on the text as well.

>>    What do you mean by setting an area's background color.  You mean
>> setting the fill for a rectangle or something?
> 
> Setting the fill-attribute on a polygon, in this case, but I tried more 
> simple forms in the beginning with the same results.
> 
> Could it be a problem with the text having attributes from a <style> 
> property as well as in XML form? (I don't think so, as you said 
> presentation attributes are stored in CSS-form and a hardcoded 
> experiment at setting text-color worked, but you never know.)

    Well it would only be a problem if the style attribute set
the fill property.  In this case the style will win (the only
thing presentation attributes override is inherited values).
If you want to set the CSS value directly you can use:

    elem.getStyle().setProperty("fill", "red", "");

    This is a bit more efficient than setting the presentation
attribute (this will also update the 'style' attribute.  If
you want to know what CSS thinks the value is:

    String val = elem.getStyle.getPropertyValue("fill");



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message