Kaydet (Commit) e6538f5b authored tarafından Miklos Vajna's avatar Miklos Vajna

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/58199Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins
üst e545e16d
......@@ -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;
......
......@@ -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 )
......
......@@ -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) &&
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment