xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 49355] Text renderer does not output correctly when margin is set
Date Fri, 28 May 2010 15:24:03 GMT

--- Comment #1 from Vu <vu_k_tran@yahoo.com> 2010-05-28 11:24:00 EDT ---
Looking at the source file, I've noticed the following:

- The TXTRenderer uses TXTState as graphic state and TXTState implements as a
stack (LinkedList)
- The CTM is pushed on to this graphic state in 2 cases:
   1) TXTRenderer.startVPArea()
   2) TXTRenderer.concatenateTransformationMatrix()

- But the CTM is popped out from this graphic state only when:
   1) TXTRenderer.endVPArea() is called

- There is no counterpart for TXTRenderer.concatenateTransformationMatrix() to
popped the CTM out of the graphic state and that state accumulates all CTM and
causes issue when rendering content.

My proposed approach is:
In TXTRenderer, create a new variable to keep a stack trace of when CTM is
pushed, popped from the stack and whether it is pushed using the
concatenateTransformationMatrix() method call.  When it is time for popping the
CTM, check this new stack and pop the CTM out of the stack when the CTM is
pushed on it using the concatenateTransformationMatrix() call.

-- Code example:

private LinkedList ctmTransformStack = new LinkedList();

protected void startVParea(CTM ctm, Rectangle2D clippingRect) {

protected void endVParea() {
    Boolean transformMatrix = (Boolean) ctmTransformStack.removeLast();

     * Perform compensation pop for concatenateTransformationMatrix()'s push
    while (transformMatrix.booleanValue()) {
          transformMatrix = (Boolean) ctmTransformStack.removeLast();

protected void concatenateTransformationMatrix(AffineTransform at) {
   currentState.push(new CTM(ptToMpt(at)));

Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

View raw message