editeng/source/editeng/impedit3.cxx | 42 ++++++++++++++----------- vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 3 + 2 files changed, 27 insertions(+), 18 deletions(-)
New commits: commit dcfc779f84772d098815999ee1df57ad9805b176 Author: Caolán McNamara <[email protected]> AuthorDate: Mon Jan 12 08:42:08 2026 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Tue Jan 13 15:38:21 2026 +0100 cid#1680326 Uninitialized scalar field Change-Id: I6f50ecc2973700553692589c88538b190dbc5cf5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197071 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 5263ddf5d429..af773a3c6232 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -77,7 +77,8 @@ FreetypeFontFile::FreetypeFontFile( OString aNativeFileName ) mpFileMap( nullptr ), mnFileSize( 0 ), mnRefCount( 0 ), - mnLangBoost( 0 ) + mnLangBoost( 0 ), + mnHandle( 0 ) { // boost font preference if UI language is mentioned in filename int nPos = maNativeFileName.lastIndexOf( '_' ); commit aa89c0830b5cd471a4ba23aa3410b864aae21ddf Author: Caolán McNamara <[email protected]> AuthorDate: Mon Jan 12 13:32:42 2026 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Tue Jan 13 15:38:11 2026 +0100 tdf#167737 chart renders text black on black in dark mode when there is no chart background and the document mode is to use a dark color for the document color. The intent of this function is to get a color that can be seen against the background. So: a) Always get the background the text is to be rendered on. b) We can consult svtools::FONTCOLOR as a potential foreground color, but reject it if it will not contrast against the background Change-Id: If441050423750fdf0a12f07dd686daf8f7e8b165 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197109 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 88804e0e68e7..7ab01100ed7b 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -4743,39 +4743,47 @@ Reference < i18n::XExtendedInputSequenceChecker > const & ImpEditEngine::ImplGet return mxISC; } +static bool hasColorContrast(const Color& rColor, const Color& rBackgroundColor) +{ + if (rColor.IsDark() && !rBackgroundColor.IsDark()) + return true; + if (rColor.IsBright() && !rBackgroundColor.IsBright()) + return true; + return false; +} + Color ImpEditEngine::GetAutoColor(const SvxFont* pFont) const { Color aColor; + Color aBackgroundColor; + if (pFont) //check for char background color + aBackgroundColor = pFont->GetFillColor(); + if (aBackgroundColor == COL_AUTO) // check for aother background (i.e: cell color) + aBackgroundColor = GetBackgroundColor(); + const SfxViewShell* pKitSh = comphelper::LibreOfficeKit::isActive() ? SfxViewShell::Current() : nullptr; if (pKitSh) { - Color aBackgroundColor; - if (pFont) //check for char background color - aBackgroundColor = pFont->GetFillColor(); - if (aBackgroundColor == COL_AUTO) // check for another background (i.e: cell color) - aBackgroundColor = GetBackgroundColor(); if (aBackgroundColor == COL_AUTO) // if everything is auto/transparent then use doc color aBackgroundColor = pKitSh->GetColorConfigColor(svtools::DOCCOLOR); - - if (aBackgroundColor.IsDark()) - aColor = COL_WHITE; - else - aColor = COL_BLACK; } else { + if (aBackgroundColor == COL_AUTO) // if everything is auto/transparent then use doc color + aBackgroundColor = GetColorConfig().GetColorValue(svtools::DOCCOLOR).nColor; aColor = GetColorConfig().GetColorValue(svtools::FONTCOLOR, false).nColor; - if ( aColor == COL_AUTO ) - { - if ( GetBackgroundColor().IsDark() ) - aColor = COL_WHITE; - else - aColor = COL_BLACK; - } + // allow using FONTCOLOR if it provides contrast to the current background color + if (aColor != COL_AUTO && hasColorContrast(aColor, aBackgroundColor)) + return aColor; } + if (aBackgroundColor.IsDark()) + aColor = COL_WHITE; + else + aColor = COL_BLACK; + return aColor; }
