[Libreoffice-commits] core.git: include/vcl svx/source vcl/source vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Jul 27 18:52:45 UTC 2018
include/vcl/settings.hxx | 3 +++
svx/source/unodraw/UnoGraphicExporter.cxx | 14 ++++++++++++++
vcl/source/app/settings.cxx | 19 +++++++++++++++++++
vcl/unx/generic/gdi/cairotextrender.cxx | 5 ++++-
4 files changed, 40 insertions(+), 1 deletion(-)
New commits:
commit e6538f5bdd876911ea30f84a6512c03908e620fd
Author: Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Fri Jul 27 17:40:31 2018 +0200
Commit: Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Fri Jul 27 20:52:17 2018 +0200
tdf#118966 vcl: add a flag to determine if AA of fonts is used from the system
This is on by default (as there are loads of vcl users who expect font
AA working even if the default is off and they don't enable it), but the
svx UnoGraphicExporter disables it to make everyone happy.
The reason in practice AA was on by default is that the gtk backend uses
the system settings in GtkInstance::GetCairoFontOptions() (and not the
AA setting from the UI), and lclGetSystemTextAntiAliasMode() does the
same on Windows (at least in the direct write case). So now these
defaults again have higher priority than leaving the vcl-level default
unchanged.
Change-Id: I81267c0b036211525ac02d3282fa89d75510f4a8
Reviewed-on: https://gerrit.libreoffice.org/58199
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index a004b23e8ebc..6eb7be25d438 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -409,6 +409,9 @@ public:
void SetUseSystemUIFonts( bool bUseSystemUIFonts );
bool GetUseSystemUIFonts() const;
+ void SetUseFontAAFromSystem(bool bUseFontAAFromSystem);
+ bool GetUseFontAAFromSystem() const;
+
void SetUseFlatBorders( bool bUseFlatBorders );
bool GetUseFlatBorders() const;
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index e5a410b07f54..fc3fb3b22eb9 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -1031,12 +1031,26 @@ sal_Bool SAL_CALL GraphicExporter::filter( const Sequence< PropertyValue >& aDes
{
SvtOptionsDrawinglayer aOptions;
bool bAntiAliasing = aOptions.IsAntiAliasing();
+ AllSettings aAllSettings = Application::GetSettings();
+ StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
+ bool bUseFontAAFromSystem = aStyleSettings.GetUseFontAAFromSystem();
if (aSettings.meAntiAliasing != TRISTATE_INDET)
+ {
// This is safe to do globally as we own the solar mutex.
aOptions.SetAntiAliasing(aSettings.meAntiAliasing == TRISTATE_TRUE);
+ // Opt in to have AA affect font rendering as well.
+ aStyleSettings.SetUseFontAAFromSystem(false);
+ aAllSettings.SetStyleSettings(aStyleSettings);
+ Application::SetSettings(aAllSettings);
+ }
nStatus = GetGraphic( aSettings, aGraphic, bVectorType ) ? ERRCODE_NONE : ERRCODE_GRFILTER_FILTERERROR;
if (aSettings.meAntiAliasing != TRISTATE_INDET)
+ {
aOptions.SetAntiAliasing(bAntiAliasing);
+ aStyleSettings.SetUseFontAAFromSystem(bUseFontAAFromSystem);
+ aAllSettings.SetStyleSettings(aStyleSettings);
+ Application::SetSettings(aAllSettings);
+ }
}
if( nStatus == ERRCODE_NONE )
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 4354ff573bee..0dc2558ab36a 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -168,6 +168,11 @@ struct ImplStyleData
StyleSettingsOptions mnOptions;
bool mbHighContrast;
bool mbUseSystemUIFonts;
+ /**
+ * Disabling AA doesn't actually disable AA of fonts, instead it is taken
+ * from system settings.
+ */
+ bool mbUseFontAAFromSystem;
bool mbAutoMnemonic;
TriState meUseImagesInMenus;
bool mnUseFlatBorders;
@@ -582,6 +587,7 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
mnOptions(rData.mnOptions),
mbHighContrast(rData.mbHighContrast),
mbUseSystemUIFonts(rData.mbUseSystemUIFonts),
+ mbUseFontAAFromSystem(rData.mbUseFontAAFromSystem),
mbAutoMnemonic(rData.mbAutoMnemonic),
meUseImagesInMenus(rData.meUseImagesInMenus),
mnUseFlatBorders(rData.mnUseFlatBorders),
@@ -697,6 +703,7 @@ void ImplStyleData::SetStandardStyles()
mnFloatTitleHeight = 13;
mbHighContrast = false;
mbUseSystemUIFonts = true;
+ mbUseFontAAFromSystem = true;
mnUseFlatBorders = false;
mnUseFlatMenus = false;
mbPreferredUseImagesInMenus = true;
@@ -1386,6 +1393,17 @@ StyleSettings::GetUseSystemUIFonts() const
return mxData->mbUseSystemUIFonts;
}
+void StyleSettings::SetUseFontAAFromSystem(bool bUseFontAAFromSystem)
+{
+ CopyData();
+ mxData->mbUseFontAAFromSystem = bUseFontAAFromSystem;
+}
+
+bool StyleSettings::GetUseFontAAFromSystem() const
+{
+ return mxData->mbUseFontAAFromSystem;
+}
+
void
StyleSettings::SetUseFlatBorders( bool bUseFlatBorders )
{
@@ -2239,6 +2257,7 @@ bool StyleSettings::operator ==( const StyleSettings& rSet ) const
(mxData->mnAntialiasedMin == rSet.mxData->mnAntialiasedMin) &&
(mxData->mbHighContrast == rSet.mxData->mbHighContrast) &&
(mxData->mbUseSystemUIFonts == rSet.mxData->mbUseSystemUIFonts) &&
+ (mxData->mbUseFontAAFromSystem == rSet.mxData->mbUseFontAAFromSystem) &&
(mxData->mnUseFlatBorders == rSet.mxData->mnUseFlatBorders) &&
(mxData->mnUseFlatMenus == rSet.mxData->mnUseFlatMenus) &&
(mxData->maFaceColor == rSet.mxData->maFaceColor) &&
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index 55316ed9926a..878abefb346b 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -219,8 +219,11 @@ void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalG
ImplSVData* pSVData = ImplGetSVData();
if (const cairo_font_options_t* pFontOptions = pSVData->mpDefInst->GetCairoFontOptions())
{
- if (!rGraphics.getAntiAliasB2DDraw())
+ const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
+ if (!rStyleSettings.GetUseFontAAFromSystem() && !rGraphics.getAntiAliasB2DDraw())
{
+ // Disable font AA in case global AA setting is supposed to affect
+ // font rendering (not the default) and AA is disabled.
cairo_font_options_t* pOptions = cairo_font_options_copy(pFontOptions);
cairo_font_options_set_antialias(pOptions, CAIRO_ANTIALIAS_NONE);
cairo_set_font_options(cr, pOptions);
More information about the Libreoffice-commits
mailing list