diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx index d796aba7e944..0ce8ff437c69 100644 --- a/vcl/inc/unx/fontmanager.hxx +++ b/vcl/inc/unx/fontmanager.hxx @@ -312,7 +312,7 @@ public: in different fonts in e.g. english and japanese */ void matchFont( FastPrintFontInfo& rInfo, const css::lang::Locale& rLocale ); - static FontConfigFontOptions* getFontOptions( const FastPrintFontInfo&, int nSize); + static std::unique_ptr getFontOptions( const FastPrintFontInfo&, int nSize); void Substitute(FontSelectPattern &rPattern, OUString& rMissingCodes); diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index 003e163d8777..2cb1aee919d9 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -1092,11 +1092,11 @@ void FontConfigFontOptions::SyncPattern(const OString& rFileName, sal_uInt32 nIn FcPatternAddBool(mpPattern, FC_EMBOLDEN, bEmbolden ? FcTrue : FcFalse); } -FontConfigFontOptions* PrintFontManager::getFontOptions(const FastPrintFontInfo& rInfo, int nSize) +std::unique_ptr PrintFontManager::getFontOptions(const FastPrintFontInfo& rInfo, int nSize) { FontCfgWrapper& rWrapper = FontCfgWrapper::get(); - FontConfigFontOptions* pOptions = nullptr; + std::unique_ptr pOptions; FcConfig* pConfig = FcConfigGetCurrent(); FcPattern* pPattern = FcPatternCreate(); @@ -1125,7 +1125,7 @@ FontConfigFontOptions* PrintFontManager::getFontOptions(const FastPrintFontInfo& (void) FcPatternGetInteger(pResult, FC_HINT_STYLE, 0, &hintstyle); - pOptions = new FontConfigFontOptions(pResult); + pOptions.reset(new FontConfigFontOptions(pResult)); } // cleanup diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 42eff115aaee..691b3f004f12 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -465,7 +465,7 @@ FreetypeFont::FreetypeFont(LogicalFontInstance* pFontInstance, FreetypeFontInfo* namespace { - FontConfigFontOptions* GetFCFontOptions( const FontAttributes& rFontAttributes, int nSize) + std::unique_ptr GetFCFontOptions( const FontAttributes& rFontAttributes, int nSize) { psp::FastPrintFontInfo aInfo; @@ -482,7 +482,7 @@ const FontConfigFontOptions* FreetypeFont::GetFontOptions() const { if (!mxFontOptions) { - mxFontOptions.reset(GetFCFontOptions(mpFontInfo->GetFontAttributes(), mpFontInstance->GetFontSelectPattern().mnHeight)); + mxFontOptions = GetFCFontOptions(mpFontInfo->GetFontAttributes(), mpFontInstance->GetFontSelectPattern().mnHeight); mxFontOptions->SyncPattern(GetFontFileName(), GetFontFaceIndex(), GetFontFaceVariation(), NeedsArtificialBold()); } return mxFontOptions.get();