vcl/inc/font/PhysicalFontFamily.hxx        |    2 
 vcl/inc/unx/genpspgraphics.h               |    6 --
 vcl/qa/cppunit/physicalfontfamily.cxx      |    4 -
 vcl/source/font/PhysicalFontFamily.cxx     |    1 
 vcl/unx/generic/gdi/freetypetextrender.cxx |   66 +++++++++++++++++++++++++---
 vcl/unx/generic/print/genpspgraphics.cxx   |   67 -----------------------------
 6 files changed, 60 insertions(+), 86 deletions(-)

New commits:
commit aa53ccd834adcd4dde36dcf36b620984b18711b3
Author:     Khaled Hosny <kha...@libreoffice.org>
AuthorDate: Tue Aug 1 18:16:15 2023 +0300
Commit:     خالد حسني <kha...@libreoffice.org>
CommitDate: Wed Aug 2 11:57:34 2023 +0200

    vcl: Drop unused PhysicalFontFamily::GetAliasNames()
    
    Change-Id: Ide306f0656230460f976daef0ed213f734136030
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155167
    Tested-by: Jenkins
    Reviewed-by: خالد حسني <kha...@libreoffice.org>

diff --git a/vcl/inc/font/PhysicalFontFamily.hxx 
b/vcl/inc/font/PhysicalFontFamily.hxx
index bcb8c9dedbb9..c5e38a293488 100644
--- a/vcl/inc/font/PhysicalFontFamily.hxx
+++ b/vcl/inc/font/PhysicalFontFamily.hxx
@@ -74,7 +74,6 @@ public:
 
     const OUString& GetFamilyName() const { return maFamilyName; }
     const OUString& GetSearchName() const { return maSearchName; }
-    const OUString& GetAliasNames() const { return maMapNames; }
     int GetMinQuality() const { return mnMinQuality; }
     FontTypeFaces GetTypeFaces() const { return mnTypeFaces; }
 
@@ -99,7 +98,6 @@ private:
 
     OUString maFamilyName; // original font family name
     OUString maSearchName; // normalized font family name
-    OUString maMapNames; // fontname aliases
     FontTypeFaces mnTypeFaces; // Typeface Flags
     FontFamily meFamily;
     FontPitch mePitch;
diff --git a/vcl/qa/cppunit/physicalfontfamily.cxx 
b/vcl/qa/cppunit/physicalfontfamily.cxx
index 8b771822c6db..d54ce8be6a1e 100644
--- a/vcl/qa/cppunit/physicalfontfamily.cxx
+++ b/vcl/qa/cppunit/physicalfontfamily.cxx
@@ -52,7 +52,6 @@ void VclPhysicalFontFamilyTest::testCreateFontFamily()
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Family name", OUString(""), 
aFamily.GetFamilyName());
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Search name", OUString("Test font face"),
                                  aFamily.GetSearchName());
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("Alias names", OUString(""), 
aFamily.GetAliasNames());
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Min quality", -1, aFamily.GetMinQuality());
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Type faces", FontTypeFaces::NONE, 
aFamily.GetTypeFaces());
 
@@ -71,7 +70,6 @@ void VclPhysicalFontFamilyTest::testAddFontFace_Default()
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Family name", OUString(""), 
aFamily.GetFamilyName());
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Search name", OUString("Test font face"),
                                  aFamily.GetSearchName());
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("Alias names", OUString(""), 
aFamily.GetAliasNames());
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Min quality", 0, aFamily.GetMinQuality());
     FontTypeFaces eTypeFace
         = FontTypeFaces::Scalable | FontTypeFaces::NoneSymbol | 
FontTypeFaces::NoneItalic;
@@ -98,7 +96,6 @@ void VclPhysicalFontFamilyTest::testAddOneFontFace()
                                  aFamily.GetFamilyName());
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Search name", OUString("Test font face"),
                                  aFamily.GetSearchName());
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("Alias names", OUString("Alias name"), 
aFamily.GetAliasNames());
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Min quality", 10, aFamily.GetMinQuality());
     FontTypeFaces eTypeFace = FontTypeFaces::Scalable | 
FontTypeFaces::NoneSymbol
                               | FontTypeFaces::Bold | 
FontTypeFaces::NoneItalic;
@@ -136,7 +133,6 @@ void VclPhysicalFontFamilyTest::testAddTwoFontFaces()
                                  aFamily.GetFamilyName());
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Search name", OUString("Test font face"),
                                  aFamily.GetSearchName());
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("Alias names", OUString("Alias name"), 
aFamily.GetAliasNames());
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Min quality", 5, aFamily.GetMinQuality());
     FontTypeFaces eTypeFace = FontTypeFaces::Scalable | 
FontTypeFaces::NoneSymbol
                               | FontTypeFaces::Light | FontTypeFaces::Bold
diff --git a/vcl/source/font/PhysicalFontFamily.cxx 
b/vcl/source/font/PhysicalFontFamily.cxx
index 16bb35c50100..6956394a5912 100644
--- a/vcl/source/font/PhysicalFontFamily.cxx
+++ b/vcl/source/font/PhysicalFontFamily.cxx
@@ -113,7 +113,6 @@ void PhysicalFontFamily::AddFontFace( PhysicalFontFace* 
pNewFontFace )
     if( maFontFaces.empty() )
     {
         maFamilyName   = pNewFontFace->GetFamilyName();
-        maMapNames     = pNewFontFace->GetMapNames();
         meFamily       = pNewFontFace->GetFamilyType();
         mePitch        = pNewFontFace->GetPitch();
         mnMinQuality   = pNewFontFace->GetQuality();
commit b3911f617d6af1e4fa7a3ed47ff6b85502d8066b
Author:     Khaled Hosny <kha...@libreoffice.org>
AuthorDate: Tue Aug 1 12:32:15 2023 +0000
Commit:     خالد حسني <kha...@libreoffice.org>
CommitDate: Wed Aug 2 11:57:26 2023 +0200

    vcl: Fold two static method into their only call site
    
    Change-Id: Ifa943bd658892d4fcf8e47a6abfa245fbcaa78a5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155161
    Tested-by: Jenkins
    Reviewed-by: خالد حسني <kha...@libreoffice.org>

diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h
index 16cb2bd9d9d2..81734cd9988f 100644
--- a/vcl/inc/unx/genpspgraphics.h
+++ b/vcl/inc/unx/genpspgraphics.h
@@ -64,12 +64,6 @@ public:
     // helper methods
     static FontAttributes   Info2FontAttributes(const psp::FastPrintFontInfo&);
 
-    // helper methods for sharing with FreeTypeTextRenderImpl
-    static void             
GetDevFontListHelper(vcl::font::PhysicalFontCollection*);
-    static bool             
AddTempDevFontHelper(vcl::font::PhysicalFontCollection* pFontCollection,
-                                                 std::u16string_view rFileURL,
-                                                 const OUString& rFontName);
-
     // override all pure virtual methods
     virtual SalGraphicsImpl* GetImpl() const override
     {
diff --git a/vcl/unx/generic/gdi/freetypetextrender.cxx 
b/vcl/unx/generic/gdi/freetypetextrender.cxx
index 3a6891c7f8a8..e8eb6c4febab 100644
--- a/vcl/unx/generic/gdi/freetypetextrender.cxx
+++ b/vcl/unx/generic/gdi/freetypetextrender.cxx
@@ -93,11 +93,38 @@ FreeTypeTextRenderImpl::SetTextColor( Color nColor )
     }
 }
 
-bool FreeTypeTextRenderImpl::AddTempDevFont( 
vcl::font::PhysicalFontCollection* pFontCollection,
-                                     const OUString& rFileURL,
-                                     const OUString& rFontName )
+bool FreeTypeTextRenderImpl::AddTempDevFont(vcl::font::PhysicalFontCollection* 
pFontCollection,
+                                            const OUString& rFileURL, const 
OUString& rFontName)
 {
-    return GenPspGraphics::AddTempDevFontHelper(pFontCollection, rFileURL, 
rFontName);
+    // inform PSP font manager
+    psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
+    std::vector<psp::fontID> aFontIds = rMgr.addFontFile(rFileURL);
+    if (aFontIds.empty())
+        return false;
+
+    FreetypeManager& rFreetypeManager = FreetypeManager::get();
+    for (auto const& elem : aFontIds)
+    {
+        // prepare font data
+        psp::FastPrintFontInfo aInfo;
+        rMgr.getFontFastInfo(elem, aInfo);
+        if (!rFontName.isEmpty())
+            aInfo.m_aFamilyName = rFontName;
+
+        // inform glyph cache of new font
+        FontAttributes aDFA = GenPspGraphics::Info2FontAttributes(aInfo);
+        aDFA.IncreaseQualityBy(5800);
+
+        int nFaceNum = rMgr.getFontFaceNumber(aInfo.m_nID);
+        int nVariantNum = rMgr.getFontFaceVariation(aInfo.m_nID);
+
+        const OString& rFileName = rMgr.getFontFileSysPath(aInfo.m_nID);
+        rFreetypeManager.AddFontFile(rFileName, nFaceNum, nVariantNum, 
aInfo.m_nID, aDFA);
+    }
+
+    // announce new font to device's font list
+    rFreetypeManager.AnnounceFonts(pFontCollection);
+    return true;
 }
 
 void FreeTypeTextRenderImpl::ClearDevFontCache()
@@ -105,9 +132,36 @@ void FreeTypeTextRenderImpl::ClearDevFontCache()
     FreetypeManager::get().ClearFontCache();
 }
 
-void FreeTypeTextRenderImpl::GetDevFontList( 
vcl::font::PhysicalFontCollection* pFontCollection )
+void FreeTypeTextRenderImpl::GetDevFontList(vcl::font::PhysicalFontCollection* 
pFontCollection)
 {
-    GenPspGraphics::GetDevFontListHelper(pFontCollection);
+    // prepare the FreetypeManager using psprint's font infos
+    FreetypeManager& rFreetypeManager = FreetypeManager::get();
+
+    psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
+    ::std::vector<psp::fontID> aList;
+    psp::FastPrintFontInfo aInfo;
+    rMgr.getFontList(aList);
+    for (auto const& elem : aList)
+    {
+        if (!rMgr.getFontFastInfo(elem, aInfo))
+            continue;
+
+        // normalize face number to the FreetypeManager
+        int nFaceNum = rMgr.getFontFaceNumber(aInfo.m_nID);
+        int nVariantNum = rMgr.getFontFaceVariation(aInfo.m_nID);
+
+        // inform FreetypeManager about this font provided by the PsPrint 
subsystem
+        FontAttributes aDFA = GenPspGraphics::Info2FontAttributes(aInfo);
+        aDFA.IncreaseQualityBy(4096);
+        const OString& rFileName = rMgr.getFontFileSysPath(aInfo.m_nID);
+        rFreetypeManager.AddFontFile(rFileName, nFaceNum, nVariantNum, 
aInfo.m_nID, aDFA);
+    }
+
+    // announce glyphcache fonts
+    rFreetypeManager.AnnounceFonts(pFontCollection);
+
+    // register platform specific font substitutions if available
+    SalGenericInstance::RegisterFontSubstitutors(pFontCollection);
 }
 
 void FreeTypeTextRenderImpl::GetFontMetric( FontMetricDataRef& rxFontMetric, 
int nFallbackLevel )
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx 
b/vcl/unx/generic/print/genpspgraphics.cxx
index a8f253629de7..9f08cf11b5f2 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -111,41 +111,6 @@ void GenPspGraphics::SetTextColor( Color nColor )
     m_aTextRenderImpl.SetTextColor(nColor);
 }
 
-bool GenPspGraphics::AddTempDevFontHelper( vcl::font::PhysicalFontCollection* 
pFontCollection,
-                                           std::u16string_view rFileURL,
-                                           const OUString& rFontName)
-{
-    // inform PSP font manager
-    psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
-    std::vector<psp::fontID> aFontIds = rMgr.addFontFile( rFileURL );
-    if( aFontIds.empty() )
-        return false;
-
-    FreetypeManager& rFreetypeManager = FreetypeManager::get();
-    for (auto const& elem : aFontIds)
-    {
-        // prepare font data
-        psp::FastPrintFontInfo aInfo;
-        rMgr.getFontFastInfo( elem, aInfo );
-        if (!rFontName.isEmpty())
-            aInfo.m_aFamilyName = rFontName;
-
-        // inform glyph cache of new font
-        FontAttributes aDFA = Info2FontAttributes( aInfo );
-        aDFA.IncreaseQualityBy( 5800 );
-
-        int nFaceNum = rMgr.getFontFaceNumber( aInfo.m_nID );
-        int nVariantNum = rMgr.getFontFaceVariation( aInfo.m_nID );
-
-        const OString& rFileName = rMgr.getFontFileSysPath( aInfo.m_nID );
-        rFreetypeManager.AddFontFile(rFileName, nFaceNum, nVariantNum, 
aInfo.m_nID, aDFA);
-    }
-
-    // announce new font to device's font list
-    rFreetypeManager.AnnounceFonts(pFontCollection);
-    return true;
-}
-
 bool GenPspGraphics::AddTempDevFont( vcl::font::PhysicalFontCollection* 
pFontCollection,
                                      const OUString& rFileURL,
                                      const OUString& rFontName )
@@ -153,38 +118,6 @@ bool GenPspGraphics::AddTempDevFont( 
vcl::font::PhysicalFontCollection* pFontCol
     return m_aTextRenderImpl.AddTempDevFont(pFontCollection, rFileURL, 
rFontName);
 }
 
-void GenPspGraphics::GetDevFontListHelper( vcl::font::PhysicalFontCollection 
*pFontCollection )
-{
-    // prepare the FreetypeManager using psprint's font infos
-    FreetypeManager& rFreetypeManager = FreetypeManager::get();
-
-    psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
-    ::std::vector< psp::fontID > aList;
-    psp::FastPrintFontInfo aInfo;
-    rMgr.getFontList( aList );
-    for (auto const& elem : aList)
-    {
-        if( !rMgr.getFontFastInfo( elem, aInfo ) )
-            continue;
-
-        // normalize face number to the FreetypeManager
-        int nFaceNum = rMgr.getFontFaceNumber( aInfo.m_nID );
-        int nVariantNum = rMgr.getFontFaceVariation( aInfo.m_nID );
-
-        // inform FreetypeManager about this font provided by the PsPrint 
subsystem
-        FontAttributes aDFA = Info2FontAttributes( aInfo );
-        aDFA.IncreaseQualityBy( 4096 );
-        const OString& rFileName = rMgr.getFontFileSysPath( aInfo.m_nID );
-        rFreetypeManager.AddFontFile(rFileName, nFaceNum, nVariantNum, 
aInfo.m_nID, aDFA);
-    }
-
-    // announce glyphcache fonts
-    rFreetypeManager.AnnounceFonts(pFontCollection);
-
-    // register platform specific font substitutions if available
-    SalGenericInstance::RegisterFontSubstitutors( pFontCollection );
-}
-
 void GenPspGraphics::GetDevFontList( vcl::font::PhysicalFontCollection 
*pFontCollection )
 {
     m_aTextRenderImpl.GetDevFontList(pFontCollection);

Reply via email to