speedata / publisher

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

Text not visible in table with backgroundcolor #337

Closed langmic closed 3 years ago

langmic commented 3 years ago

layout:

<Layout xmlns="urn:speedata.de:2009/publisher/en" xmlns:sd="urn:speedata:2009/publisher/functions/en">
  <Record element="ranking">
    <PlaceObject>
      <Table padding="1mm" stretch="max"> 
        <ForAll select="rank">
          <SetVariable variable="bgcolor" select="sd:alternating('tab', 'lightgrey', 'white')" /> 
          <Tr backgroundcolor="{ $bgcolor }">
            <Td><Paragraph><Value select="@rank"/></Paragraph></Td> 
            <Td backgroundcolor="{ if (empty(symbol/@color)) then $bgcolor else symbol/@color }"><Paragraph><Value select="symbol"/></Paragraph></Td>
            <Td backgroundcolor="{ if (string(ok) = 'no') then 'gold' else $bgcolor }"><Paragraph ><Value select="ok"/></Paragraph></Td>
            <Td><Paragraph><Value select="name"/></Paragraph></Td>
          </Tr>
        </ForAll>
      </Table>
    </PlaceObject>
  </Record>
</Layout>

data:

<ranking>
<rank rank="1"><symbol>XYZ 123</symbol><name>Xyz</name><ok>yes</ok></rank>
<rank rank="2"><symbol color="gold">Abcdefgh</symbol><name>Enemenemiste</name><ok>no</ok></rank>
<rank rank="3"><symbol>HUGO 2</symbol><name>Hugo</name><ok>yes</ok></rank>
<rank rank="4"><symbol color="lightgreen">DUMMY 0815</symbol><name>Yeppa</name><ok>yes</ok></rank>
<rank rank="5"><symbol>TEST 4711</symbol><name>foobar</name><ok>no</ok></rank>
</ranking>

good result (with version 4.0.1): screenshot_2021-07-01-210118

bad result (with version 4.2.0 upto 4.5.2) screenshot_2021-07-01-210157

I assume it could be broken by version 4.1.16 with commit 76f20867fb34dcb49ef88eb12ef62789444c0309

Kind Regards, Michael

pgundlach commented 3 years ago

Thank you very much for your bug report!

This looks like an incorrect interpretation of <symbol color="..." > in text rendering. A workaround would be to switch HTML interpretation off with <Paragraph html="off"> ...

I need to turn off interpretation of the color attribute.

pgundlach commented 3 years ago

A different example:

<Layout xmlns="urn:speedata.de:2009/publisher/en"
    xmlns:sd="urn:speedata:2009/publisher/functions/en">

    <Record element="data">
        <PlaceObject>
            <Textblock>
                <Paragraph>
                    <Value select="."/>
                </Paragraph>
            </Textblock>
        </PlaceObject>
    </Record>
</Layout>

and

<data>
    <text color="green">Hello world</text>
</data>
langmic commented 3 years ago

It works with <Paragraph html="off">. I thougt the issue is caused by the backgroundcolor which lays over the text but not with the text color itself. Thanks a lot!

pgundlach commented 3 years ago

This is fixed in version 4.5.3 which is available for download now. Thanks again for the report!