Bug 124138 - XHTML Export: Automatic colour changes from black to red
Summary: XHTML Export: Automatic colour changes from black to red
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.1 all versions
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Svante Schubert
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: (X)HTML-Export Automatic-Color
  Show dependency treegraph
 
Reported: 2019-03-17 20:47 UTC by Ola Smith
Modified: 2023-10-23 15:08 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
file contains sample string (8.33 KB, application/vnd.oasis.opendocument.text)
2019-03-17 20:50 UTC, Ola Smith
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ola Smith 2019-03-17 20:47:34 UTC
Description:
It is of type; https://xkcd.com/2109/
Please see enclosed sample.

.odt has a black "A" followed by a red "1"
when file/export to .xhtml the "A" becomes red.

export to .pdf will not make "A" red.

I have no clear idea of how this string originally (years ago) was created.

Steps to Reproduce:
1.expoert enclosed document to .xhtml
2.check the result
3.

Actual Results:
a red "A"

Expected Results:
a black "A"


Reproducible: Always


User Profile Reset: No



Additional Info:
[Information automatically included from LibreOffice]
Locale: en-US
Module: TextDocument
[Information guessed from browser]
OS: Linux (All)
OS is 64bit: yes
Comment 1 Ola Smith 2019-03-17 20:50:08 UTC
Created attachment 150033 [details]
file contains sample string
Comment 2 Dieter 2019-03-18 14:25:14 UTC
I confirm it with

Version: 6.3.0.0.alpha0+ (x64)
Build ID: 91cdf22b88a4f7bec243c8fb187627e766d3294c
CPU threads: 4; OS: Windows 10.0; UI render: default; VCL: win; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2019-03-08_00:38:10
Locale: en-US (de_DE); UI-Language: en-US
Calc: threaded

If you change colour of the A from "automatic" to "Black" export works well.
Comment 3 Xisco Faulí 2019-03-22 12:00:09 UTC
Also reproduced in

Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
Comment 4 Dieter 2021-02-17 08:14:26 UTC
Bug still present in

Version: 7.1.0.3 (x64) / LibreOffice Community
Build ID: f6099ecf3d29644b5008cc8f48f42f4a40986e4c
CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL
Comment 5 Stéphane Guillou (stragu) 2021-05-19 11:51:17 UTC
Reproduced in 7.2 alpha1. Note that Save As > HTML looks as expected.

Version: 7.2.0.0.alpha1+ / LibreOffice Community
Build ID: b1c0734ffe0f395757b6e0cea7830d820231afeb
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2021-05-18_03:16:20
Calc: threaded
Comment 6 QA Administrators 2023-05-20 03:17:35 UTC Comment hidden (obsolete)
Comment 7 Ola Smith 2023-06-02 14:30:41 UTC
Problem remains in 7.3.7.2 (Latest version available in Kubuntu 22.04.2)

The problem seems to be associated with the original string "<black>A<space><red>1" itself.
When I copy/paste the string into a new File/New/Text Document the error remains. A newly written "<black>A<space><red>1" comes out as expected in the same .html file.

My guess is that the original "A" is not a plain "<black>A" but still carries with it memories of a previous career as a "<red>A", now totally invisible.

But the problem remains - a black A should never be anything other than a black A ....
Comment 8 Xisco Faulí 2023-10-20 09:36:52 UTC
@Svante, I thought you might be interested in this issue
Comment 9 Svante Schubert 2023-10-22 17:20:12 UTC
            <text:p text:style-name="P1">
                <text:span text:style-name="T2">A</text:span>
                <text:span text:style-name="T3"> </text:span>
                <text:span text:style-name="T4">1</text:span>
            </text:p>

Interesting! 
The Paragraph P1 contains the color red and T2 does not contain a color black to overwrite it!
I am going to tell Michael Stahl about it to get a second opinion. It is not necessary an XHTML filter issue on first glance:

<style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
    <style:paragraph-properties fo:margin-left="1.265cm" fo:margin-right="0cm"
        fo:text-indent="0cm" style:auto-text-indent="false">
        <style:tab-stops />
    </style:paragraph-properties>
    <style:text-properties fo:color="#ff0000" style:font-name="FreeSans" fo:font-size="10pt"
        officeooo:paragraph-rsid="00041ba9" style:font-size-asian="10pt"
        style:font-size-complex="10pt" />
</style:style>
<style:style style:name="T1" style:family="text">
    <style:text-properties style:use-window-font-color="true" fo:font-weight="bold"
        fo:background-color="transparent" loext:char-shading-value="0"
        style:font-weight-asian="bold" style:font-weight-complex="bold" />
</style:style>
<style:style style:name="T2" style:family="text">
    <style:text-properties style:use-window-font-color="true" fo:font-weight="bold"
        officeooo:rsid="0005faa8" fo:background-color="transparent"
        loext:char-shading-value="0" style:font-weight-asian="bold"
        style:font-weight-complex="bold" />
</style:style>
Comment 10 Svante Schubert 2023-10-23 15:08:56 UTC
Michael Stahl was so kind to explain.
The relevant value is: https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part3-schema/OpenDocument-v1.3-os-part3-schema.html#property-style_use-window-font-color

Everything not being the background is the foreground and I will try some heuristic to see if the background is "dark", than font color is white, otherwise the font color will be black (most of the time in this situation).

Taking over this issue!
Thanks for the nice test case!