You are viewing a plain text version of this content. The canonical link for it is here.
Posted to doxia-commits@maven.apache.org by vs...@apache.org on 2009/06/04 12:59:08 UTC

svn commit: r781707 - /maven/doxia/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java

Author: vsiveton
Date: Thu Jun  4 10:59:08 2009
New Revision: 781707

URL: http://svn.apache.org/viewvc?rev=781707&view=rev
Log:
DOXIA-331: Unable to renderer images on iText module

o take care of figure() calls

Modified:
    maven/doxia/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java

Modified: maven/doxia/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java
URL: http://svn.apache.org/viewvc/maven/doxia/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java?rev=781707&r1=781706&r2=781707&view=diff
==============================================================================
--- maven/doxia/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java (original)
+++ maven/doxia/doxia/trunk/doxia-modules/doxia-module-itext/src/main/java/org/apache/maven/doxia/module/itext/ITextSink.java Thu Jun  4 10:59:08 2009
@@ -113,6 +113,9 @@
      * destination. */
     private boolean anchorDefined = false;
 
+    /** Flag to know if an figure event is called. */
+    private boolean figureDefined = false;
+
     /** Map of warn messages with a String as key to describe the error type and a Set as value.
      * Using to reduce warn messages. */
     private Map warnMessages;
@@ -1099,11 +1102,15 @@
         writeEndElement(); // ElementTags.CHUNK
 
         actionContext.release();
+
+        figureDefined = false;
     }
 
     /** {@inheritDoc} */
     public void figure()
     {
+        figureDefined = true;
+
         writeStartElement( ElementTags.CHUNK );
         writeAddAttribute( ElementTags.FONT, font.getFontName() );
         writeAddAttribute( ElementTags.SIZE, font.getFontSize() );
@@ -1193,7 +1200,11 @@
             return;
         }
 
-        figure();
+        boolean figureCalled = figureDefined;
+        if ( !figureCalled )
+        {
+            figure();
+        }
 
         float width = 0;
         float height = 0;
@@ -1224,7 +1235,10 @@
 
         actionContext.setAction( SinkActionContext.FIGURE_GRAPHICS );
 
-        figure_();
+        if ( !figureCalled )
+        {
+            figure_();
+        }
     }
 
     // ----------------------------------------------------------------------