You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2013/03/08 20:30:54 UTC

[Bug 121870] New: Different darkness threshold: doc/docx auto font color inverted

https://issues.apache.org/ooo/show_bug.cgi?id=121870

            Bug ID: 121870
        Issue Type: DEFECT
           Summary: Different darkness threshold: doc/docx auto font color
                    inverted
    Classification: Application
           Product: Writer
           Version: AOO 3.4.1
          Hardware: All
                OS: All
            Status: CONFIRMED
          Severity: normal
          Priority: P3
         Component: code
          Assignee: issues@openoffice.apache.org
          Reporter: pfg@apache.org
                CC: issues@openoffice.apache.org

Created attachment 80384
  --> https://issues.apache.org/ooo/attachment.cgi?id=80384&action=edit
Test document: text should appear white.

Apparently OOo and MS-office have a different threshold to determine what
should be considered dark.
As mentioned in a LibreOffice list:

Neither the OpenDocument spec nor the Office Open XML spec define
what background colour should be considered "dark", leaving it up to the
implementation.

OpenDocument v1.2 section 20.385:
http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1420234_253892949

Luke Deller made an interesting analysis which I will quote here:
___
Word 2010 appears to treat a background colour as "dark" if:

130*red + 255*green * 51*blue < 105*255

Where red, green, blue are the RGB components of the background colour as 8-bit
integers (ie in the range 0 to 255).

(I arrived at this formula by:
- collecting some data points by experimentation with Word 2010
- guessing the form of this formula
- using linear algebra with the data points to work out the coefficients
- double-checking using more data points)

the LibreOffice formula (from code) is:

77*red + 151*green + 28*blue <= 38*256

I notice that both Word and LibreOffice formulae use weights proportional to
the "Rec. 601" coefficients for Luma shown here:
http://en.wikipedia.org/wiki/Luma_%28video%29
ie Luma = 0.299 R' + 0.587 G' + 0.114 B'

(Actually LibreOffice would match these coefficients more accurately if it used
 76*red + 151*green + 29*blue)

Anyway the main difference is that LibreOffice considers Luma <= 38 (out of
255) to be dark, whereas Word considers Luma < about 61 (out of 255) to be
dark.
______

The proposed change in LibreOffice is to change slightly the coefficients in
tools/inc/tools/color.hxx Color::GetLuminance()
change 28 --> 29, 77 -->76
tools/source/generic/color.cxx Color::IsDark()
Change the threshold from 38 --> 60 (or maybe just 50?)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.

[Bug 121870] Different darkness threshold: doc/docx auto font color inverted

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=121870

--- Comment #1 from Pedro Giffuni <pf...@apache.org> ---
Created attachment 80668
  --> https://issues.apache.org/ooo/attachment.cgi?id=80668&action=edit
Increase a bit the luminance threshold

I had this patch in my HD: it is not exactly what LO does (to avoid possible
licensing issues) but it should improve compatibility with LO and MS-Office.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.

[Bug 121870] Different darkness threshold: doc/docx auto font color inverted

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=121870

Pedro Giffuni <pf...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Latest|---                         |AOO 3.4.1
    Confirmation on|                            |
           See Also|                            |https://bugs.freedesktop.or
                   |                            |g/show_bug.cgi?id=61993
         Difficulty|---                         |simple

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.

[Bug 121870] Different darkness threshold: doc/docx auto font color inverted

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=121870

--- Comment #3 from Oliver-Rainer Wittmann <or...@apache.org> ---
I agree to adapt <Color::IsDark()>.

Unfortunately, the above given change does not solve the problem in the given
document - the text is still black.

Pedro:
Do you think we should adapt the threshold to 55?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.

[Issue 121870] Different darkness threshold: doc/docx auto font color inverted

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=121870

zhaoshzh <ao...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aoo.zhaoshzh@gmail.com

--- Comment #7 from zhaoshzh <ao...@gmail.com> ---
verified on AOO410m15(Build:9761)  -  Rev. 1585021

-- 
You are receiving this mail because:
You are on the CC list for the issue.
You are watching all issue changes.

[Issue 121870] Different darkness threshold: doc/docx auto font color inverted

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=121870

zhaoshzh <ao...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |VERIFIED

--- Comment #8 from zhaoshzh <ao...@gmail.com> ---
verified on AOO410m14(Build:9760)  -  Rev. 1585624

-- 
You are receiving this mail because:
You are on the CC list for the issue.
You are watching all issue changes.

[Bug 121870] Different darkness threshold: doc/docx auto font color inverted

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=121870

--- Comment #5 from SVN Robot <sv...@dev.null.org> ---
"orw" committed SVN revision 1544428 into trunk:
121870: adjust threshold for <Color::IsDark()> to improve interoperability
wi...

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.

[Bug 121870] Different darkness threshold: doc/docx auto font color inverted

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=121870

Oliver-Rainer Wittmann <or...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|issues@openoffice.apache.or |orw@apache.org
                   |g                           |

--- Comment #2 from Oliver-Rainer Wittmann <or...@apache.org> ---
taking over for review and integration of the provided patch

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.
You are watching all bug changes.

[Bug 121870] Different darkness threshold: doc/docx auto font color inverted

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=121870

--- Comment #4 from Pedro Giffuni <pf...@apache.org> ---
(In reply to Oliver-Rainer Wittmann from comment #3)
...
> 
> Pedro:
> Do you think we should adapt the threshold to 55?

It looks like a reasonable new default.

Thank you for looking at this issue, again!

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.

[Bug 121870] Different darkness threshold: doc/docx auto font color inverted

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=121870

Oliver-Rainer Wittmann <or...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |orw@apache.org

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.

[Bug 121870] Different darkness threshold: doc/docx auto font color inverted

Posted by bu...@apache.org.
https://issues.apache.org/ooo/show_bug.cgi?id=121870

Oliver-Rainer Wittmann <or...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|CONFIRMED                   |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.1.0

--- Comment #6 from Oliver-Rainer Wittmann <or...@apache.org> ---
adjusted patch applied on trunk for next release

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.