return by unique_ptr from psp::PrintFontManager::getFontOptions

Change-Id: Ib78844af17ff60453ad714eb50c01626ea2ee792
Reviewed-on: https://gerrit.libreoffice.org/69792
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2019-03-27 09:27:17 +02:00
parent d9e0eade62
commit 7047f46695
3 changed files with 6 additions and 6 deletions

View File

@@ -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<FontConfigFontOptions> getFontOptions( const FastPrintFontInfo&, int nSize);
void Substitute(FontSelectPattern &rPattern, OUString& rMissingCodes);

View File

@@ -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<FontConfigFontOptions> PrintFontManager::getFontOptions(const FastPrintFontInfo& rInfo, int nSize)
{
FontCfgWrapper& rWrapper = FontCfgWrapper::get();
FontConfigFontOptions* pOptions = nullptr;
std::unique_ptr<FontConfigFontOptions> 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

View File

@@ -465,7 +465,7 @@ FreetypeFont::FreetypeFont(LogicalFontInstance* pFontInstance, FreetypeFontInfo*
namespace
{
FontConfigFontOptions* GetFCFontOptions( const FontAttributes& rFontAttributes, int nSize)
std::unique_ptr<FontConfigFontOptions> 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();