Hi Venkat,

This approach is not a good idea. It is possible that a runtime environment is configured to have multiple instances of Fop being instantiated by FopFactory with different rendering configurations (e.g. renderer resolution values).

Its disappointing, but I've just noticed a bug in AFPPageOverlayElement, an AFPPaintingState shouldn't just be instantiated in there like that. The processNode implementation will not accurately calculate and plot the page overlay position if the document resolution is different from the detault value of 240dpi. This calculation should be carried out much later at rendering time, *not* in here at configuration time - its very hacky and you'll need to refactor this. I seem to remember that Chris worked on this new feature so you may want to converse with him about its implementation.


Venkat Reddy wrote:

AFPPaintingState is being used in three different places altogether in FopTrunk source. The default constructor is being used in the following three classes...

1. AFPDocumentHandler.java
2. AFPRenderer.java
3. AFPPageOverlayElement.java

There is a variable 'resolution' is being initialized for each instance, this resolution parameter can be set using the 'fop.xconf' for a particular render...

Ex:- AFPRenderer configuration below

<renderer mime="application/x-afp">
          The bit depth and type of images produced
          (this is the default setting)
     <images mode="b+w" bits-per-pixel="8"/>

The above <renderer-resolution> is being hardcoded as '240dpi' in AFPRendererConfigurator.java, which initiates the renderer resolution based on the configuration set in 'fop.xconf'. In order to resolve this problem, I will be changing the AFPPaintingState as singleton, so that all the above classes will get the instance using 'getInstance()' method instead of default constructor. This will resolve the <renderer-resolution> problem as well, by a simple change in AFPRendererConfigurator (instead of hardcoded value 240, assigning the value from the configuration object).

Please review the above changes and tell me, if I am doing anything wrong here?


Reply via email to