I tried to get total numer of pages as described in http://xml.apache.org/fop/fo.html#fo-total-pages. The following sample.fo works fine with Fop 0.20.5 but it crashes with Fop 1.0dev with the following message : Exception :java.lang.ClassCastException : org.apache.fop.layoutmgr.inline.KnuthInlineBox <?xml version="1.0" encoding="utf-8"?> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master margin-right="1.5cm" margin-left="1.5cm" margin-bottom="2cm" margin-top="1cm" page-width="21cm" page-height="29.7cm" master-name="first"> <fo:region-body margin-top="1cm" margin-bottom="1.5cm"/> <fo:region-before extent="1cm"/> <fo:region-after extent="1.5cm"/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="first"> <fo:static-content flow-name="xsl-region-after"> <fo:block> <fo:inline line-height="14pt" font-size="10pt" >page <fo:page-number/>/<fo:page-number-citation ref-id="last-page"/> </fo:inline> </fo:block> </fo:static-content> <fo:flow flow-name="xsl-region-body"> <fo:block id="last-page"/> </fo:flow> </fo:page-sequence> </fo:root>
Created attachment 16096 [details] total pages bug
Definitely a side-effect from the inline-block work I thought could be done cheaply by mixing lists of KnuthSequences and lists of KnuthElements. Thomas' example hits an area which isn't covered by the existing tests so I hadn't found the problem. Looks like it is probably safer to do it consistently like Simon preferred even if it means creating more container instances. I'll look into it ASAP.
InlineLM does not check whether it receives a list of KnuthElements or of KnuthSequences, like LineLM does. It blindly assumes the latter, while PageNumberLM returns the former. Hence the wrong cast to a KnuthSequence. A cheap solution would be to let InlineLM do the same as LineLM. That is not fail safe but would cover very many cases.
Should be fixed now. SVN revs: http://svn.apache.org/viewcvs?rev=234042&view=rev http://svn.apache.org/viewcvs?rev=234033&view=rev
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed