speedata / publisher

speedata Publisher - a professional database Publishing system
https://www.speedata.de/
GNU Affero General Public License v3.0
300 stars 36 forks source link

Tables bug #318

Closed Demosteneus closed 3 years ago

Demosteneus commented 3 years ago

Hi,

I noticed a strange behavior when printing some tables in a specific way. See below an explanation of the bug on a printed example:

image

The files needed to reproduce the issue: data.xml

<test>
    <table>
        <row>
            <para>row 1</para>
        </row>
    </table>
    <table>
        <row>
            <para>Some text after.</para>
        </row>
    </table>
    <table>
        <row>
            <para>row 1</para>
            <para>row 2</para>
        </row>
    </table>
    <table>
        <row>
            <para>Some text after.</para>
        </row>
    </table>
    <table>
        <row>
            <para>row 1</para>
            <para>row 2</para>
            <para>row 3</para>
        </row>
    </table>
    <table>
        <row>
            <para>Some text after.</para>
        </row>
    </table>
    <table>
        <row>
            <para>row 1</para>
            <para>row 2</para>
            <para>row 3</para>
            <para>row 4</para>
        </row>
    </table>
    <table>
        <row>
            <para>Some text after.</para>
        </row>
    </table>
    <table>
        <row>
            <para>row 1</para>
            <para>row 2</para>
            <para>row 3</para>
            <para>row 4</para>
            <para>row 5</para>
        </row>
    </table>
    <table>
        <row>
            <para>Some text after.</para>
        </row>
    </table>
    <table>
        <row>
            <para>row 1</para>
            <para>row 2</para>
            <para>row 3</para>
            <para>row 4</para>
            <para>row 5</para>
            <para>row 6</para>
        </row>
    </table>
    <table>
        <row>
            <para>Some text after.</para>
        </row>
    </table>
    <table>
        <row>
            <para>row 1</para>
            <para>row 2</para>
            <para>row 3</para>
            <para>row 4</para>
            <para>row 5</para>
            <para>row 6</para>
            <para>row 7</para>
        </row>
    </table>
    <table>
        <row>
            <para>Some text after.</para>
        </row>
    </table>    
</test>

layout.xml

<Layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="layoutschema-en.xsd" xmlns:sd="urn:speedata:2009/publisher/functions/en" xmlns="urn:speedata.de:2009/publisher/en" xmlns:xi="http://www.w3.org/2001/XInclude" version="4.3.6">
    <SetGrid height="10pt" nx="20"/>

    <Record element="test">
        <ForAll select="table">
            <PlaceObject>
                <Table width="170mm">
                    <Columns>
                        <Column width="4mm" />
                        <Column width="166mm" /> 
                    </Columns>
                    <ForAll select="row/para">
                        <Tr>
                            <Td>
                                <Paragraph>
                                    <Value select="'-'" />
                                </Paragraph>
                            </Td>
                            <Td>
                                <Paragraph>
                                    <Copy-of select="string(.)" />
                                </Paragraph>
                            </Td>
                        </Tr>
                    </ForAll>
                </Table>
            </PlaceObject>
        </ForAll>
   </Record>
</Layout>

If you delete the <SetGrid height="10pt" nx="20"/> the distance will be even more random and strange.

pgundlach commented 3 years ago

This is - if I understand you layout correctly - the expected behaviour.

Take the first table for example. It has a height of 12 pt and uses two grid rows.

If you set the grid height to 12pt (the leading of the default font), everything is fine.

Put <Trace grid="yes" gridallocation="yes"/> for more info.

Does this help?

Demosteneus commented 3 years ago

Changing the grid at this point is not really an option.

If I would change the leading of the font used, shouldn't that also work?

I have tried with a font like below, but this didn't improve.

    <LoadFontfile name="R" filename="arial.ttf"/>

    <DefineFontfamily name="default" fontsize="10" leading="10">
        <Regular fontface="R"/>
    </DefineFontfamily>
pgundlach commented 3 years ago

Did you select the font family?

You should either name it "text" to be the default or you need to tell the table to use the font family.

<Table fontfamily="default" >
Demosteneus commented 3 years ago

I had the fontfamily="default" set for the paragraph, that didn't work. But setting fontfamily="default" to the table worked.

Thanks