Dear group!

I noticed a fuzzy looking TOC some time ago with my FO-results from FOP 1.1 and 
DocBook-XSL 1.78.1. The page numbers seemed  to be "misaligned" slightly. They 
ought to be aligned on the right side, but they were not.

The reason for that lies in the "toc.line" named template in fo/autotoc.xsl. 
Between the dotted line there is a leading and trailing space: <xsl:text> 
</xsl:text>. At least this causes FOP (maybe in combination with only some font 
types and sizes) to render misaligned page numbers.

Now, as a solution, try to substitute the blank space with the Unicode 
character &#x2004; in both lines. This helped immediately, and now my page 
numbers are aligned again as they should.

You may want to use the subsequent template code in your customization layer:

        <xsl:template name="toc.line">
                <xsl:param name="toc-context" select="NOTANODE"/>
                <xsl:variable name="id">
                        <xsl:call-template name="object.id"/>
                </xsl:variable>
                <xsl:variable name="label">
                        <xsl:apply-templates select="." mode="label.markup"/>
                </xsl:variable>
                <fo:block xsl:use-attribute-sets="toc.line.properties">
                        <fo:inline keep-with-next.within-line="always">
                                <fo:basic-link internal-destination="{$id}">
                                        <xsl:if test="$label != ''">
                                                <xsl:copy-of select="$label"/>
                                                <xsl:value-of 
select="$autotoc.label.separator"/>
                                        </xsl:if>
                                        <xsl:apply-templates select="." 
mode="titleabbrev.markup"/>
                                </fo:basic-link>
                        </fo:inline>
                        <fo:inline keep-together.within-line="always">
                                <xsl:text>&#x2004;</xsl:text>
                                <fo:leader leader-pattern="dots" 
leader-pattern-width="3pt" leader-alignment="reference-area" 
keep-with-next.within-line="always"/>
                                <xsl:text>&#x2004;</xsl:text>
                                <fo:basic-link internal-destination="{$id}">
                                        <fo:page-number-citation 
ref-id="{$id}"/>
                                </fo:basic-link>
                        </fo:inline>
                </fo:block>
        </xsl:template>


To be honest: I have not searched the list whether there is a (or another) 
existent solution for the matter. So, I hope I do not bother you, if someone 
else posted any hint here.

Best regards,
Ben


Reply via email to