Kumar Puppala wrote: > The 0.20.5 does not support background-color for fo:inline > element. Does anyone know what I need to change in order to > add this functionality to > 0.20.5 FOP. This feature is essential for our application and > I am planning to add this functionality. Any help in this > direction is greatly appreciated.
I suppose the reason this has not been done is because it is quite difficult to do with the 0.20.5 architecture. I've probably worked with this stuff more recently than others, and still may not be able to help, but I'll try. There are two things that need to be done: 1) get an Area created that has the background-color attribute set as you want it to be, 2) get that Area rendered. For #1, look at the class layout.LineArea. You will probably need to add an instance variable and setter for a background color (there are color components there, but I think they are for the foreground color, i.e. the text). LineArea's processing is stateful, so it needs to have all of these variables set externally. You will either need to write a layout method for the fo.flow.Inline class or update the one in fo.FObjMixed to use the background-color setter that you created above. If there is non-text content, you will probably need to modify the layout methods for those classes as well (the FOP area model pushes traits to the AreaTree rather than having them pulled by the AreaTree from the FOTree). You will need to dig around to see where and how layout.inline.InlineArea instances are created. I can't remember how they interact with layout.inline.WordArea instances. In one or the other of those, perhaps both, you will need to store the background-color and push that color to it. For #2, it gets more fun. Getting the background-color painted on an area for which you know the dimensions is not difficult. If an InlineArea is actually created, or if you can get that done, your job will be easier. If only WordAreas are created, you will need to figure out how to get the background-color painted in the spaces between words. I don't see a method for rendering an InlineArea, but I think that may be the kind of concept you need to keep the WordAreas tied together. It may be useful to know that the Renderer is also stateful, i.e. it has a conceptual cursor, and paints things on the page where the cursor is, computing dimensions and locations as it goes. I think anything you do here will be a kludge. I would rather see you invest your time in one of the three redesign efforts, but I realize that sometimes you just need to get the job done. Good luck. Victor Mote
