[Libreoffice-commits] core.git: vcl/inc vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Apr 14 10:40:15 UTC 2021


 vcl/inc/unx/fontmanager.hxx                    |    4 +++-
 vcl/unx/generic/fontmanager/fontconfig.cxx     |    6 +++---
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |   11 ++---------
 3 files changed, 8 insertions(+), 13 deletions(-)

New commits:
commit e6aa51affc269753644222103d55f7655e84bfa2
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Apr 14 10:02:08 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Apr 14 12:39:28 2021 +0200

    use original FontAttributes instead of an intermediate FastPrintFontInfo
    
    Change-Id: Id8f8ea9b9d144d5bf9eace81ecc07e6b5dce6d41
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114077
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx
index 0ef3aa3655e6..0f5a85d61153 100644
--- a/vcl/inc/unx/fontmanager.hxx
+++ b/vcl/inc/unx/fontmanager.hxx
@@ -40,6 +40,7 @@
  *  friends are PostScript afm style, that is they are 1/1000 font height
  */
 
+class FontAttributes;
 class FontSubsetInfo;
 class FontConfigFontOptions;
 class FontSelectPattern;
@@ -310,7 +311,8 @@ public:
     in different fonts in e.g. english and japanese
      */
     void matchFont( FastPrintFontInfo& rInfo, const css::lang::Locale& rLocale );
-    static std::unique_ptr<FontConfigFontOptions> getFontOptions( const FastPrintFontInfo&, int nSize);
+
+    static std::unique_ptr<FontConfigFontOptions> getFontOptions(const FontAttributes& rFontAttributes, 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 17ca8f46ccae..1ebe39ca4b98 100644
--- a/vcl/unx/generic/fontmanager/fontconfig.cxx
+++ b/vcl/unx/generic/fontmanager/fontconfig.cxx
@@ -1097,7 +1097,7 @@ void FontConfigFontOptions::SyncPattern(const OString& rFileName, sal_uInt32 nIn
     FcPatternAddBool(mpPattern, FC_EMBOLDEN, bEmbolden ? FcTrue : FcFalse);
 }
 
-std::unique_ptr<FontConfigFontOptions> PrintFontManager::getFontOptions(const FastPrintFontInfo& rInfo, int nSize)
+std::unique_ptr<FontConfigFontOptions> PrintFontManager::getFontOptions(const FontAttributes& rInfo, int nSize)
 {
     FontCfgWrapper& rWrapper = FontCfgWrapper::get();
 
@@ -1105,7 +1105,7 @@ std::unique_ptr<FontConfigFontOptions> PrintFontManager::getFontOptions(const Fa
     FcConfig* pConfig = FcConfigGetCurrent();
     FcPattern* pPattern = FcPatternCreate();
 
-    OString sFamily = OUStringToOString( rInfo.m_aFamilyName, RTL_TEXTENCODING_UTF8 );
+    OString sFamily = OUStringToOString( rInfo.GetFamilyName(), RTL_TEXTENCODING_UTF8 );
 
     std::unordered_map< OString, OString >::const_iterator aI = rWrapper.m_aLocalizedToCanonical.find(sFamily);
     if (aI != rWrapper.m_aLocalizedToCanonical.end())
@@ -1114,7 +1114,7 @@ std::unique_ptr<FontConfigFontOptions> PrintFontManager::getFontOptions(const Fa
         FcPatternAddString(pPattern, FC_FAMILY, reinterpret_cast<FcChar8 const *>(sFamily.getStr()));
 
     // TODO: ePitch argument of always PITCH_DONTKNOW is suspicious
-    addtopattern(pPattern, rInfo.m_eItalic, rInfo.m_eWeight, rInfo.m_eWidth, PITCH_DONTKNOW);
+    addtopattern(pPattern, rInfo.GetItalic(), rInfo.GetWeight(), rInfo.GetWidthType(), PITCH_DONTKNOW);
     FcPatternAddDouble(pPattern, FC_PIXEL_SIZE, nSize);
 
     FcConfigSubstitute(pConfig, pPattern, FcMatchPattern);
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index 5831979e6109..0881913c040c 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -473,16 +473,9 @@ FreetypeFont::FreetypeFont(FreetypeFontInstance& rFontInstance, const std::share
 
 namespace
 {
-    std::unique_ptr<FontConfigFontOptions> GetFCFontOptions( const FontAttributes& rFontAttributes, int nSize)
+    std::unique_ptr<FontConfigFontOptions> GetFCFontOptions(const FontAttributes& rFontAttributes, int nSize)
     {
-        psp::FastPrintFontInfo aInfo;
-
-        aInfo.m_aFamilyName = rFontAttributes.GetFamilyName();
-        aInfo.m_eItalic = rFontAttributes.GetItalic();
-        aInfo.m_eWeight = rFontAttributes.GetWeight();
-        aInfo.m_eWidth = rFontAttributes.GetWidthType();
-
-        return psp::PrintFontManager::getFontOptions(aInfo, nSize);
+        return psp::PrintFontManager::getFontOptions(rFontAttributes, nSize);
     }
 }
 


More information about the Libreoffice-commits mailing list