Antialias drawing is part of the font selection
At least on Windows antialias-drawing has to be selected via LOGFONTW.lfQuality passed to CreateFont, so InitFont is too late. Change-Id: Ie81c5f0074fdbcf1f0e74fbff31a5df663a67884 Reviewed-on: https://gerrit.libreoffice.org/62200 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
This commit is contained in:
@@ -37,8 +37,8 @@ class Size;
|
||||
class VCL_DLLPUBLIC FontSelectPattern : public FontAttributes
|
||||
{
|
||||
public:
|
||||
FontSelectPattern( const vcl::Font&, const OUString& rSearchName,
|
||||
const Size&, float fExactHeight );
|
||||
FontSelectPattern(const vcl::Font&, const OUString& rSearchName,
|
||||
const Size&, float fExactHeight, bool bNonAntialias = false);
|
||||
#ifdef _WIN32
|
||||
FontSelectPattern( const PhysicalFontFace&, const Size&,
|
||||
float fExactHeight, int nOrientation, bool bVertical );
|
||||
|
||||
@@ -82,8 +82,8 @@ public:
|
||||
ImplFontCache();
|
||||
~ImplFontCache();
|
||||
|
||||
rtl::Reference<LogicalFontInstance> GetFontInstance( PhysicalFontCollection const *,
|
||||
const vcl::Font&, const Size& rPixelSize, float fExactHeight);
|
||||
rtl::Reference<LogicalFontInstance> GetFontInstance(PhysicalFontCollection const *,
|
||||
const vcl::Font&, const Size& rPixelSize, float fExactHeight, bool bNonAntialias = false);
|
||||
rtl::Reference<LogicalFontInstance> GetGlyphFallbackFont( PhysicalFontCollection const *, FontSelectPattern&,
|
||||
LogicalFontInstance* pLogicalFont,
|
||||
int nFallbackLevel, OUString& rMissingCodes );
|
||||
|
||||
@@ -97,10 +97,10 @@ ImplFontCache::~ImplFontCache()
|
||||
}
|
||||
|
||||
rtl::Reference<LogicalFontInstance> ImplFontCache::GetFontInstance( PhysicalFontCollection const * pFontList,
|
||||
const vcl::Font& rFont, const Size& rSize, float fExactHeight )
|
||||
const vcl::Font& rFont, const Size& rSize, float fExactHeight, bool bNonAntialias )
|
||||
{
|
||||
// initialize internal font request object
|
||||
FontSelectPattern aFontSelData(rFont, rFont.GetFamilyName(), rSize, fExactHeight);
|
||||
FontSelectPattern aFontSelData(rFont, rFont.GetFamilyName(), rSize, fExactHeight, bNonAntialias);
|
||||
return GetFontInstance( pFontList, aFontSelData );
|
||||
}
|
||||
|
||||
|
||||
@@ -55,11 +55,6 @@ LogicalFontInstance::LogicalFontInstance(const PhysicalFontFace& rFontFace, cons
|
||||
{
|
||||
}
|
||||
|
||||
void LogicalFontInstance::SetNonAntialiased(bool bNonAntialiased)
|
||||
{
|
||||
const_cast<FontSelectPattern*>(&m_aFontSelData)->mbNonAntialiased = bNonAntialiased;
|
||||
}
|
||||
|
||||
LogicalFontInstance::~LogicalFontInstance()
|
||||
{
|
||||
mpUnicodeFallbackList.reset();
|
||||
|
||||
@@ -31,7 +31,7 @@ const char FontSelectPattern::FEAT_PREFIX = ':';
|
||||
const char FontSelectPattern::FEAT_SEPARATOR = '&';
|
||||
|
||||
FontSelectPattern::FontSelectPattern( const vcl::Font& rFont,
|
||||
const OUString& rSearchName, const Size& rSize, float fExactHeight )
|
||||
const OUString& rSearchName, const Size& rSize, float fExactHeight, bool bNonAntialias)
|
||||
: maSearchName( rSearchName )
|
||||
, mnWidth( rSize.Width() )
|
||||
, mnHeight( rSize.Height() )
|
||||
@@ -39,7 +39,7 @@ FontSelectPattern::FontSelectPattern( const vcl::Font& rFont,
|
||||
, mnOrientation( rFont.GetOrientation() )
|
||||
, meLanguage( rFont.GetLanguage() )
|
||||
, mbVertical( rFont.IsVertical() )
|
||||
, mbNonAntialiased( false )
|
||||
, mbNonAntialiased(bNonAntialias)
|
||||
, mbEmbolden( false )
|
||||
{
|
||||
maTargetName = GetFamilyName();
|
||||
|
||||
+15
-17
@@ -998,22 +998,11 @@ void OutputDevice::InitFont() const
|
||||
|
||||
if (!mpFontInstance)
|
||||
return;
|
||||
if (!mbInitFont)
|
||||
return;
|
||||
|
||||
if ( mbInitFont )
|
||||
{
|
||||
// decide if antialiasing is appropriate
|
||||
bool bNonAntialiased(GetAntialiasing() & AntialiasingFlags::DisableText);
|
||||
if (!utl::ConfigManager::IsFuzzing())
|
||||
{
|
||||
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
|
||||
bNonAntialiased |= bool(rStyleSettings.GetDisplayOptions() & DisplayOptions::AADisable);
|
||||
bNonAntialiased |= (int(rStyleSettings.GetAntialiasingMinPixelHeight()) > mpFontInstance->GetFontSelectPattern().mnHeight);
|
||||
}
|
||||
mpFontInstance->SetNonAntialiased(bNonAntialiased);
|
||||
// select font in the device layers
|
||||
mpGraphics->SetFont(mpFontInstance.get(), 0);
|
||||
mbInitFont = false;
|
||||
}
|
||||
mpGraphics->SetFont(mpFontInstance.get(), 0);
|
||||
mbInitFont = false;
|
||||
}
|
||||
|
||||
bool OutputDevice::ImplNewFont() const
|
||||
@@ -1059,10 +1048,19 @@ bool OutputDevice::ImplNewFont() const
|
||||
if( (0 == aSize.Width()) && (0 != maFont.GetFontSize().Width()) )
|
||||
aSize.setWidth( 1 );
|
||||
|
||||
// decide if antialiasing is appropriate
|
||||
bool bNonAntialiased(GetAntialiasing() & AntialiasingFlags::DisableText);
|
||||
if (!utl::ConfigManager::IsFuzzing())
|
||||
{
|
||||
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
|
||||
bNonAntialiased |= bool(rStyleSettings.GetDisplayOptions() & DisplayOptions::AADisable);
|
||||
bNonAntialiased |= (int(rStyleSettings.GetAntialiasingMinPixelHeight()) > maFont.GetFontSize().Height());
|
||||
}
|
||||
|
||||
// get font entry
|
||||
rtl::Reference<LogicalFontInstance> pOldFontInstance = mpFontInstance;
|
||||
mpFontInstance = mxFontCache->GetFontInstance( mxFontCollection.get(), maFont, aSize, fExactHeight );
|
||||
bool bNewFontInstance = pOldFontInstance.get() != mpFontInstance.get();
|
||||
mpFontInstance = mxFontCache->GetFontInstance(mxFontCollection.get(), maFont, aSize, fExactHeight, bNonAntialiased);
|
||||
const bool bNewFontInstance = pOldFontInstance.get() != mpFontInstance.get();
|
||||
pOldFontInstance.clear();
|
||||
|
||||
LogicalFontInstance* pFontInstance = mpFontInstance.get();
|
||||
|
||||
Reference in New Issue
Block a user