diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-27 14:01:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-27 21:21:50 +0200 |
commit | 7c1dbb665a3eb7859164dbf83c245b7f450c9028 (patch) | |
tree | 1ba04cb7bb43ff8ffdf3b8b015dd82c25dd83092 /vcl/unx/generic/fontmanager/fontconfig.cxx | |
parent | 98a8d8bc15018576e1312493425d7bb3725be735 (diff) |
no need to allocate PrintFont separately
Change-Id: I8bc213e096ad6ae83d88c548ff8685a872c5ea91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116258
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/unx/generic/fontmanager/fontconfig.cxx')
-rw-r--r-- | vcl/unx/generic/fontmanager/fontconfig.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index 9b16cd9cd5c5..66f09ffc9102 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -636,7 +636,7 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int>& o // not described by fontconfig (e.g. alias names, PSName) if (eFormatRes != FcResultMatch) format = nullptr; - std::vector<std::unique_ptr<PrintFont>> aFonts = analyzeFontFile( nDirID, aBase, reinterpret_cast<char*>(format) ); + std::vector<PrintFont> aFonts = analyzeFontFile( nDirID, aBase, reinterpret_cast<char*>(format) ); if(aFonts.empty()) { SAL_INFO( @@ -651,10 +651,10 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int>& o continue; } - std::unique_ptr<PrintFont> xUpdate; + std::optional<PrintFont> xUpdate; if (aFonts.size() == 1) // one font - xUpdate = std::move(aFonts.front()); + xUpdate = aFonts.front(); else // more than one font { // a collection entry, get the correct index @@ -663,9 +663,9 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int>& o int nCollectionEntry = GetCollectionIndex(nEntryId); for (auto & font : aFonts) { - if( font->m_nCollectionEntry == nCollectionEntry ) + if( font.m_nCollectionEntry == nCollectionEntry ) { - xUpdate = std::move(font); + xUpdate = font; break; } } @@ -710,7 +710,7 @@ void PrintFontManager::countFontconfigFonts( std::unordered_map<OString, int>& o // sort into known fonts fontID aFont = m_nNextFontID++; - m_aFonts[ aFont ] = std::move(xUpdate); + m_aFonts.emplace( aFont, *xUpdate ); m_aFontFileToFontID[ aBase ].insert( aFont ); nFonts++; SAL_INFO("vcl.fonts.detail", "inserted font " << family << " as fontID " << aFont); |