Wow, what complexity/effort for so little gain. I guess there's no way around adding reference values to the area tree so you can redo the percentage calculations in the renderer without the FO tree percentage infrastructure. But that doesn't really feel right.
The only other possibility to me seems to investigate what we've talked about once or twice in the past: Going for a different style of area tree and use absolute coordinates instead of relative coordinates there. But switching just for covering this feature...I don't know. If this were investigated in the context of the new intermediate format it might suddenly make sense again but I haven't thought this through. So in the end, I don't have any really good ideas right now. On 28.02.2008 19:51:15 Vincent Hennebert wrote: > Hi, > > I need some help regarding percentages. I’m currently trying to > implement the rendering of backgrounds from table-column elements. But > since the space represented by the border-separation property must be > filled with the background of the table, I can’t simply create block > areas for the columns (as well as rows, BTW) that would span the whole > table. > > The solution I’ve come up with is to create an area for each table-cell > containing the background informations, and set it as a child of the > table area. So there would be an area for the column background, above > it an area for the row background, above it an area for the cell. Only > that latter would have paddings and borders settings. > > If the backgrounds only have colours there’s no problem, and this works > well. But if they also have images I must ensure that the image is > placed correctly (see attached picture). If I take the following example > (let’s say each column has a width of 100pt): > <fo:table-row background-image="asf-logo.png" > background-repeat="no-repeat"> > <fo:table-cell border="4pt solid red"> > <fo:block>Cell 1.1</fo:block> > <fo:block>Cell 1.1</fo:block> > </fo:table-cell> > <fo:table-cell border="4pt solid red"> > <fo:block>Cell 1.2</fo:block> > <fo:block>Cell 1.2</fo:block> > </fo:table-cell> > </fo:table-row> > > For cell 1.2, the image must be additionally shifted to the left by > 104pt to actually start on the left side of the table. Since it will be > cropped to the dimensions of the area, this gives the desired effect. > > Now if percentages are used to place the background image, this all > becomes more complicated, since the width of the image must be > substracted from the table’s IPD. And apparently there’s no simple mean > to do that. I can no longer rely on the width of the area, like is > currently done in TraitSetter.addBackground, since the area will have > the IPD of the cell instead of the row. I’d have to replace width with > a call to context.getBaseLength, but I have no access to the FObj that > will be used as the base. > > Any ideas? I hope I’m clear. > > Thanks, > Vincent > > > -- > Vincent Hennebert Anyware Technologies > http://people.apache.org/~vhennebert http://www.anyware-tech.com > Apache FOP Committer FOP Development/Consulting Jeremias Maerki