You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Thierry Kormann <Th...@sophia.inria.fr> on 2000/11/07 13:36:10 UTC

[design] More on text layout problem

Bill, (and all),

I agree that my patch seems better :) anyway, with multiple paint there is 
problem.

So, in the StrokingTextPainter, you iterate through a set of TextAttribute. 
This set does not include TextAttribute.FOREGROUND.

My first patch was to add TextAttribute.FOREGROUND to the set.
Then, I have moved the Set initialization from the paint to a static block (as 
it's always the same in any cases).

My final patch was to :

a. Add a new TextAttribute in the GVTAttributedCharacterIterator.TextAttribute
   called TEXT_COMPOUND_DELIMITER.

b. Each time we create an ACI (for a tspan) in the TextElementBridge, I add
   this attribute. This attribute does nothing except informing the
   StrokingTextPainter that a new text compound starts.

c. In the StrokingTextPainter, I replace the set of attributes by only the
   TEXT_COMPOUND_DELIMITER. The text painter now iterates on the ACI only
   considering this attribute.

   It works - as the only way to define a new style *in SVG* is to use tspan.

d. Then I can use getOutline(Tx) instead of layout.draw in the text painter.

=> The paint problem is solved and the rendering is correct. I have done some 
benchs and my work around is not slower than vincent's one (should even be 
faster in some cases).

The only issue is that we are not doing 'line-through' anymore. The 
text-decoration BE test is mostly the same as before except that the 
line-through is not there anymore.

This is due to the new bug I found in TextLayout. The getOutline returns the 
shape with the underline but not the strike-through. See my small example I 
have sent before.


At last, we can a., b. and c. but not d. if you think it's a better way to iterate through the style. The main advantage is that we don't have to explicitly list the style attributes in the Text painter.

Any comments?
Thierry.

-- 
Thierry Kormann
email: Thierry.Kormann@sophia.inria.fr  http://www.inria.fr/koala/tkormann/
Koala/Dyade/Bull @ INRIA - Sophia Antipolis