vcl: test PhysicalFontCollection and move to vcl::font namespace

- tested PhysicalFontCollection, noted odd behaviour with search names
  and normalization
- moved PhysicalFontCollection.hxx to vcl/inc/font
- moved PhysicalFontCollection into vcl::font namespace

Note that I needed to regenerate the pch file otherwise errors were
generated.

Change-Id: Ifa0c7b871c40687bd15002565d2f7a3e408218f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122036
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index f44a9d5..50ee032 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -69,7 +69,6 @@ struct ImplOutDevData;
class LogicalFontInstance;
struct SystemGraphicsData;
class ImplFontCache;
class PhysicalFontCollection;
class ImplMultiTextLineInfo;
class SalGraphics;
class Gradient;
@@ -105,6 +104,7 @@ namespace vcl
    class WindowOutputDevice;
    namespace font {
        struct Feature;
        class PhysicalFontCollection;
        class PhysicalFontFaceCollection;
    }

@@ -256,7 +256,7 @@ private:
    mutable bool                    mbEnableRTL : 1;

protected:
    mutable std::shared_ptr<PhysicalFontCollection> mxFontCollection;
    mutable std::shared_ptr<vcl::font::PhysicalFontCollection> mxFontCollection;
    mutable std::shared_ptr<ImplFontCache> mxFontCache;

    /** @name Initialization and accessor functions
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 9240bff..92219db 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -14419,7 +14419,6 @@ vcl/headless/svptext.cxx
vcl/headless/svpvd.cxx
vcl/inc/IconThemeSelector.hxx
vcl/inc/IPrioritable.hxx
vcl/inc/PhysicalFontCollection.hxx
vcl/inc/PhysicalFontFamily.hxx
vcl/inc/ResampleKernel.hxx
vcl/inc/WidgetThemeLibraryTypes.hxx
@@ -14439,6 +14438,7 @@ vcl/inc/dndlistenercontainer.hxx
vcl/inc/factory.hxx
vcl/inc/fltcall.hxx
vcl/inc/font/FontSelectPattern.hxx
vcl/inc/font/PhysicalFontCollection.hxx
vcl/inc/font/PhysicalFontFace.hxx
vcl/inc/fontattributes.hxx
vcl/inc/fontinstance.hxx
@@ -14484,7 +14484,6 @@ vcl/inc/osx/salprn.h
vcl/inc/osx/salsys.h
vcl/inc/osx/saltimer.h
vcl/inc/osx/vclnsapp.h
vcl/inc/outdev.h
vcl/inc/pdf/pdffontcache.hxx
vcl/inc/pdf/pdfwriter_impl.hxx
vcl/inc/ppdparser.hxx
@@ -14940,6 +14939,7 @@ vcl/source/filter/wmf/emfwr.hxx
vcl/source/filter/wmf/wmf.cxx
vcl/source/filter/wmf/wmfwr.cxx
vcl/source/filter/wmf/wmfwr.hxx
vcl/source/font/DirectFontSubstitution.cxx
vcl/source/font/FontSelectPattern.cxx
vcl/source/font/PhysicalFontCollection.cxx
vcl/source/font/PhysicalFontFace.cxx
diff --git a/vcl/CppunitTest_vcl_font.mk b/vcl/CppunitTest_vcl_font.mk
index 5c9da11..8913525 100644
--- a/vcl/CppunitTest_vcl_font.mk
+++ b/vcl/CppunitTest_vcl_font.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,vcl_font, \
	vcl/qa/cppunit/physicalfontface \
	vcl/qa/cppunit/physicalfontfacecollection \
	vcl/qa/cppunit/physicalfontfamily \
	vcl/qa/cppunit/physicalfontcollection \
))

$(eval $(call gb_CppunitTest_use_externals,vcl_font,\
@@ -38,6 +39,7 @@ $(eval $(call gb_CppunitTest_use_libraries,vcl_font, \
	tl \
	tk \
	unotest \
	utl \
	vcl \
))

diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx
index 3822bac..c79dadc 100644
--- a/vcl/headless/svptext.cxx
+++ b/vcl/headless/svptext.cxx
@@ -47,7 +47,7 @@ bool SvpSalGraphics::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilitie
    return m_aTextRenderImpl.GetFontCapabilities(rFontCapabilities);
}

void SvpSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
void SvpSalGraphics::GetDevFontList( vcl::font::PhysicalFontCollection* pFontCollection )
{
    m_aTextRenderImpl.GetDevFontList(pFontCollection);
}
@@ -57,7 +57,7 @@ void SvpSalGraphics::ClearDevFontCache()
    m_aTextRenderImpl.ClearDevFontCache();
}

bool SvpSalGraphics::AddTempDevFont( PhysicalFontCollection* pFontCollection,
bool SvpSalGraphics::AddTempDevFont( vcl::font::PhysicalFontCollection* pFontCollection,
    const OUString& rFileURL, const OUString& rFontName)
{
    return m_aTextRenderImpl.AddTempDevFont(pFontCollection, rFileURL, rFontName);
diff --git a/vcl/inc/PhysicalFontCollection.hxx b/vcl/inc/font/PhysicalFontCollection.hxx
similarity index 97%
rename from vcl/inc/PhysicalFontCollection.hxx
rename to vcl/inc/font/PhysicalFontCollection.hxx
index e9907b8..5cad84c 100644
--- a/vcl/inc/PhysicalFontCollection.hxx
+++ b/vcl/inc/font/PhysicalFontCollection.hxx
@@ -23,8 +23,10 @@

#include <vcl/dllapi.h>

#include "fontinstance.hxx"
#include "font/PhysicalFontFamily.hxx"
#include <fontinstance.hxx>

#include "PhysicalFontFamily.hxx"

#include <array>

#define MAX_GLYPHFALLBACK 16
@@ -38,6 +40,9 @@ class PreMatchFontSubstitution;
// TODO: merge with ImplFontCache
// TODO: rename to LogicalFontManager

namespace vcl::font
{

class VCL_PLUGIN_PUBLIC PhysicalFontCollection final
{
public:
@@ -92,4 +97,6 @@ private:

};

}

/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/inc/font/PhysicalFontFamily.hxx b/vcl/inc/font/PhysicalFontFamily.hxx
index 7bbcf56..fa0036b 100644
--- a/vcl/inc/font/PhysicalFontFamily.hxx
+++ b/vcl/inc/font/PhysicalFontFamily.hxx
@@ -28,8 +28,6 @@

#include <unotools/fontcfg.hxx>

class PhysicalFontCollection;

namespace vcl::font
{
// flags for mnTypeFaces member
@@ -57,6 +55,7 @@ struct typed_flags<vcl::font::FontTypeFaces> : is_typed_flags<vcl::font::FontTyp
namespace vcl::font
{
class FontSelectPattern;
class PhysicalFontCollection;
class PhysicalFontFace;
class PhysicalFontFaceCollection;

diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 125d00c..32168d8 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -179,9 +179,9 @@ public:
    virtual void            GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
    virtual FontCharMapRef  GetFontCharMap() const override;
    virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
    virtual void            GetDevFontList( PhysicalFontCollection* ) override;
    virtual void            GetDevFontList( vcl::font::PhysicalFontCollection* ) override;
    virtual void ClearDevFontCache() override;
    virtual bool            AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;
    virtual bool            AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;
    virtual bool        CreateFontSubset( const OUString& rToFile,
                                              const vcl::font::PhysicalFontFace*,
                                              const sal_GlyphId* pGlyphIds,
diff --git a/vcl/inc/impfontcache.hxx b/vcl/inc/impfontcache.hxx
index 72e7a44d..aa5efdb 100644
--- a/vcl/inc/impfontcache.hxx
+++ b/vcl/inc/impfontcache.hxx
@@ -31,7 +31,7 @@

class Size;
namespace vcl { class Font; }
class PhysicalFontCollection;
namespace vcl::font { class PhysicalFontCollection; }

// TODO: closely couple with PhysicalFontCollection

@@ -74,15 +74,15 @@ private:
    FontInstanceList maFontInstanceList;
    GlyphBoundRectCache m_aBoundRectCache;

    rtl::Reference<LogicalFontInstance> GetFontInstance(PhysicalFontCollection const*, vcl::font::FontSelectPattern&);
    rtl::Reference<LogicalFontInstance> GetFontInstance(vcl::font::PhysicalFontCollection const*, vcl::font::FontSelectPattern&);

public:
    ImplFontCache();
    ~ImplFontCache();

    rtl::Reference<LogicalFontInstance> GetFontInstance(PhysicalFontCollection const *,
    rtl::Reference<LogicalFontInstance> GetFontInstance(vcl::font::PhysicalFontCollection const *,
                             const vcl::Font&, const Size& rPixelSize, float fExactHeight, bool bNonAntialias = false);
    rtl::Reference<LogicalFontInstance> GetGlyphFallbackFont( PhysicalFontCollection const *, vcl::font::FontSelectPattern&,
    rtl::Reference<LogicalFontInstance> GetGlyphFallbackFont( vcl::font::PhysicalFontCollection const *, vcl::font::FontSelectPattern&,
                            LogicalFontInstance* pLogicalFont,
                            int nFallbackLevel, OUString& rMissingCodes );

diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx
index afa6ea5..2a87404 100644
--- a/vcl/inc/pch/precompiled_vcl.hxx
+++ b/vcl/inc/pch/precompiled_vcl.hxx
@@ -13,7 +13,7 @@
 manual changes will be rewritten by the next run of update_pch.sh (which presumably
 also fixes all possible problems, so it's usually better to use it).

 Generated on 2021-10-06 16:34:16 using:
 Generated on 2021-10-06 19:41:09 using:
 ./bin/update_pch vcl vcl --cutoff=6 --exclude:system --include:module --include:local

 If after updating build fails, use the following command to locate conflicting headers:
@@ -195,6 +195,7 @@
#include <cppuhelper/weakagg.hxx>
#include <cppuhelper/weakref.hxx>
#include <font/FontSelectPattern.hxx>
#include <font/PhysicalFontCollection.hxx>
#include <font/PhysicalFontFace.hxx>
#include <font/PhysicalFontFaceCollection.hxx>
#include <i18nlangtag/lang.h>
@@ -265,7 +266,6 @@
#endif // PCH_LEVEL >= 3
#if PCH_LEVEL >= 4
#include <ImplOutDevData.hxx>
#include <PhysicalFontCollection.hxx>
#include <accel.hxx>
#include <brdwin.hxx>
#include <configsettings.hxx>
diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx
index a285f07..fed7c2c 100644
--- a/vcl/inc/qt5/QtGraphics.hxx
+++ b/vcl/inc/qt5/QtGraphics.hxx
@@ -31,7 +31,10 @@

#include "QtGraphicsBase.hxx"

namespace vcl::font
{
class PhysicalFontCollection;
}
class QImage;
class QPushButton;
class QtFont;
@@ -224,9 +227,9 @@ public:
    virtual void GetFontMetric(ImplFontMetricDataRef&, int nFallbackLevel) override;
    virtual FontCharMapRef GetFontCharMap() const override;
    virtual bool GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) const override;
    virtual void GetDevFontList(PhysicalFontCollection*) override;
    virtual void GetDevFontList(vcl::font::PhysicalFontCollection*) override;
    virtual void ClearDevFontCache() override;
    virtual bool AddTempDevFont(PhysicalFontCollection*, const OUString& rFileURL,
    virtual bool AddTempDevFont(vcl::font::PhysicalFontCollection*, const OUString& rFileURL,
                                const OUString& rFontName) override;
    virtual bool CreateFontSubset(const OUString& rToFile, const vcl::font::PhysicalFontFace* pFont,
                                  const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncoding,
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 4210499..f0aa925 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -122,7 +122,7 @@ public:
    bool        Init( void );
    void        AddFont( CoreTextFontFace* );

    void    AnnounceFonts( PhysicalFontCollection& ) const;
    void    AnnounceFonts( vcl::font::PhysicalFontCollection& ) const;
    CoreTextFontFace* GetFontDataFromId( sal_IntPtr nFontId ) const;

    CTFontCollectionRef fontCollection() { return mpCTFontCollection; }
@@ -535,10 +535,10 @@ public:
    virtual FontCharMapRef  GetFontCharMap() const override;
    virtual bool            GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
    // graphics must fill supplied font list
    virtual void            GetDevFontList( PhysicalFontCollection* ) override;
    virtual void            GetDevFontList( vcl::font::PhysicalFontCollection* ) override;
    // graphics must drop any cached font info
    virtual void            ClearDevFontCache() override;
    virtual bool            AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;
    virtual bool            AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;
    // CreateFontSubset: a method to get a subset of glyhps of a font
    // inside a new valid font file
    // returns TRUE if creation of subset was successful
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 3abfbd7..716c9aa 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -35,12 +35,12 @@
#include <map>
#include <vector>

class PhysicalFontCollection;
class SalBitmap;
class FontAttributes;
namespace vcl::font {
    class FontSelectPattern;
    class PhysicalFontFace;
    class PhysicalFontCollection;
}
class SalLayout;
namespace tools { class Rectangle; }
@@ -152,13 +152,13 @@ public:
    virtual bool                GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const = 0;

    // graphics must fill supplied font list
    virtual void                GetDevFontList( PhysicalFontCollection* ) = 0;
    virtual void                GetDevFontList( vcl::font::PhysicalFontCollection* ) = 0;

    // graphics must drop any cached font info
    virtual void                ClearDevFontCache() = 0;

    virtual bool                AddTempDevFont(
                                    PhysicalFontCollection*,
                                    vcl::font::PhysicalFontCollection*,
                                    const OUString& rFileURL,
                                    const OUString& rFontName ) = 0;

diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 1995df3..21d1259 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -52,12 +52,15 @@ struct ImplPostEventData;
struct ImplTimerData;
struct ImplIdleData;
struct ImplConfigData;
namespace vcl::font { class DirectFontSubstitution; }
namespace vcl::font
{
    class DirectFontSubstitution;
    class PhysicalFontCollection;
}
struct ImplHotKey;
struct ImplEventHook;
class Point;
class ImplAccelManager;
class PhysicalFontCollection;
class ImplFontCache;
class HelpTextWindow;
class ImplTBDragMgr;
@@ -221,7 +224,7 @@ struct ImplSVGDIData
    OpenGLContext*          mpLastContext = nullptr;        // Last OpenGLContext
    VclPtr<Printer>         mpFirstPrinter;                 // First Printer
    std::unique_ptr<ImplPrnQueueList> mpPrinterQueueList;   // List of all printer queue
    std::shared_ptr<PhysicalFontCollection> mxScreenFontList; // Screen-Font-List
    std::shared_ptr<vcl::font::PhysicalFontCollection> mxScreenFontList; // Screen-Font-List
    std::shared_ptr<ImplFontCache> mxScreenFontCache;       // Screen-Font-Cache
    lru_scale_cache         maScaleCache = lru_scale_cache(10); // Cache for scaled images
    vcl::font::DirectFontSubstitution* mpDirectFontSubst = nullptr; // Font-Substitutions defined in Tools->Options->Fonts
diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx
index fc7b81d..9e6fcc9 100644
--- a/vcl/inc/textrender.hxx
+++ b/vcl/inc/textrender.hxx
@@ -39,9 +39,9 @@ public:
    virtual void                    GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) = 0;
    virtual FontCharMapRef          GetFontCharMap() const = 0;
    virtual bool                    GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const = 0;
    virtual void                    GetDevFontList( PhysicalFontCollection* ) = 0;
    virtual void                    GetDevFontList( vcl::font::PhysicalFontCollection* ) = 0;
    virtual void                    ClearDevFontCache() = 0;
    virtual bool                    AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) = 0;
    virtual bool                    AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) = 0;
    virtual bool                    CreateFontSubset(
                                        const OUString& rToFile,
                                        const vcl::font::PhysicalFontFace*,
diff --git a/vcl/inc/unx/freetype_glyphcache.hxx b/vcl/inc/unx/freetype_glyphcache.hxx
index d7b7151..64a55dc 100644
--- a/vcl/inc/unx/freetype_glyphcache.hxx
+++ b/vcl/inc/unx/freetype_glyphcache.hxx
@@ -71,7 +71,7 @@ public:
    bool                  IsSymbolFont() const      { return maDevFontAttributes.IsSymbolFont(); }
    const FontAttributes& GetFontAttributes() const { return maDevFontAttributes; }

    void                  AnnounceFont( PhysicalFontCollection* );
    void                  AnnounceFont( vcl::font::PhysicalFontCollection* );

    const FontCharMapRef & GetFontCharMap() const;
    bool GetFontCapabilities(vcl::FontCapabilities&) const;
diff --git a/vcl/inc/unx/freetypetextrender.hxx b/vcl/inc/unx/freetypetextrender.hxx
index 6b17a15..994edb5 100644
--- a/vcl/inc/unx/freetypetextrender.hxx
+++ b/vcl/inc/unx/freetypetextrender.hxx
@@ -44,9 +44,9 @@ public:
    virtual void                GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
    virtual FontCharMapRef      GetFontCharMap() const override;
    virtual bool                GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
    virtual void                GetDevFontList( PhysicalFontCollection* ) override;
    virtual void                GetDevFontList( vcl::font::PhysicalFontCollection* ) override;
    virtual void                ClearDevFontCache() override;
    virtual bool                AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;
    virtual bool                AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;
    virtual bool                CreateFontSubset(
                                    const OUString& rToFile,
                                    const vcl::font::PhysicalFontFace*,
diff --git a/vcl/inc/unx/geninst.h b/vcl/inc/unx/geninst.h
index 5a4f037..984e91a 100644
--- a/vcl/inc/unx/geninst.h
+++ b/vcl/inc/unx/geninst.h
@@ -38,7 +38,11 @@ public:
 * Abstract generic class to build vclplugin's instance classes from
 */
class GenPspGraphics;
class PhysicalFontCollection;
namespace vcl::font
{
    class PhysicalFontCollection;
}

class VCL_DLLPUBLIC SalGenericInstance : public SalInstance
{
protected:
@@ -67,7 +71,7 @@ public:
    virtual OUString            getOSVersion() override;

    // prolly belongs somewhere else ... just a font help
    static void RegisterFontSubstitutors( PhysicalFontCollection* pFontCollection );
    static void RegisterFontSubstitutors( vcl::font::PhysicalFontCollection* pFontCollection );

protected:
    static void configurePspInfoPrinter( PspSalInfoPrinter* pInfoPrinter,
diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h
index 977083b..75c1e4c 100644
--- a/vcl/inc/unx/genpspgraphics.h
+++ b/vcl/inc/unx/genpspgraphics.h
@@ -30,8 +30,11 @@

#include <unx/GenPspGfxBackend.hxx>

namespace vcl::font { class PhysicalFontFace; }
namespace vcl::font
{
class PhysicalFontFace;
class PhysicalFontCollection;
}

namespace psp { struct JobData; class PrinterGfx; }

@@ -66,7 +69,7 @@ public:
                                              Ucs2UIntMap& rUnicodeEnc );

    static FontAttributes Info2FontAttributes( const psp::FastPrintFontInfo& );
    static void             AnnounceFonts( PhysicalFontCollection*,
    static void             AnnounceFonts( vcl::font::PhysicalFontCollection*,
                                           const psp::FastPrintFontInfo& );

    // override all pure virtual methods
@@ -82,13 +85,13 @@ public:
    virtual void            GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
    virtual FontCharMapRef  GetFontCharMap() const override;
    virtual bool            GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
    virtual void            GetDevFontList( PhysicalFontCollection* ) override;
    virtual void            GetDevFontList( vcl::font::PhysicalFontCollection* ) override;
    // graphics must drop any cached font info
    virtual void            ClearDevFontCache() override;
    virtual bool            AddTempDevFont( PhysicalFontCollection*,
    virtual bool            AddTempDevFont( vcl::font::PhysicalFontCollection*,
                                            const OUString& rFileURL,
                                            const OUString& rFontName ) override;
    static bool             AddTempDevFontHelper( PhysicalFontCollection* pFontCollection,
    static bool             AddTempDevFontHelper( vcl::font::PhysicalFontCollection* pFontCollection,
                                                  const OUString& rFileURL,
                                                  const OUString& rFontName);

diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx
index 228351f..b6120e2 100644
--- a/vcl/inc/unx/glyphcache.hxx
+++ b/vcl/inc/unx/glyphcache.hxx
@@ -43,7 +43,10 @@ class FreetypeFontFile;
class FreetypeFontInstance;
class FreetypeFontInfo;
class FontConfigFontOptions;
namespace vcl::font
{
class PhysicalFontCollection;
}
class FreetypeFont;
class SvpGcpHelper;

@@ -84,7 +87,7 @@ public:
                                sal_IntPtr nFontId,
                                const FontAttributes&);

    void                    AnnounceFonts( PhysicalFontCollection* ) const;
    void                    AnnounceFonts( vcl::font::PhysicalFontCollection* ) const;

    void                    ClearFontCache();

diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index bc5653e..2a1a994 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -50,8 +50,11 @@ class SalFrame;
class X11SalVirtualDevice;
class X11SalGraphicsImpl;
class X11SkiaSalVirtualDevice;
namespace vcl::font
{
class PhysicalFontCollection;
namespace vcl::font { class PhysicalFontFace; }
class PhysicalFontFace;
}
class SalGraphicsImpl;
class TextRenderImpl;

@@ -116,9 +119,9 @@ public:
    virtual void                    GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override;
    virtual FontCharMapRef          GetFontCharMap() const override;
    virtual bool                    GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override;
    virtual void                    GetDevFontList( PhysicalFontCollection* ) override;
    virtual void                    GetDevFontList( vcl::font::PhysicalFontCollection* ) override;
    virtual void                    ClearDevFontCache() override;
    virtual bool                    AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;
    virtual bool                    AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;

    virtual bool                    CreateFontSubset(
                                        const OUString& rToFile,
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index f02eadf..9555cc1 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -45,11 +45,11 @@

namespace vcl::font
{
class PhysicalFontCollection;
class FontSelectPattern;
}
class WinFontInstance;
class ImplFontAttrCache;
class PhysicalFontCollection;
class SalGraphicsImpl;
class WinSalGraphicsImplBase;
class ImplFontMetricData;
@@ -347,10 +347,10 @@ public:
    // get the layout capabilities of the current font
    virtual bool GetFontCapabilities(vcl::FontCapabilities &rGetFontCapabilities) const override;
    // graphics must fill supplied font list
    virtual void            GetDevFontList( PhysicalFontCollection* ) override;
    virtual void            GetDevFontList( vcl::font::PhysicalFontCollection* ) override;
    // graphics must drop any cached font info
    virtual void            ClearDevFontCache() override;
    virtual bool            AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;
    virtual bool            AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override;
    // CreateFontSubset: a method to get a subset of glyhps of a font
    // inside a new valid font file
    // returns TRUE if creation of subset was successful
diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 8f61cce..bc4b1ee 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -41,7 +41,7 @@
class FixedText;
class VclSizeGroup;
class VirtualDevice;
class PhysicalFontCollection;
namespace vcl::font { class PhysicalFontCollection; }
class ImplFontCache;
class VCLXWindow;
class WindowStateData;
@@ -132,7 +132,7 @@ struct ImplFrameData
    VclPtr<vcl::Window> mpMouseMoveWin;         //< last window, where MouseMove() called
    VclPtr<vcl::Window> mpMouseDownWin;         //< last window, where MouseButtonDown() called
    std::vector<VclPtr<vcl::Window> > maOwnerDrawList;    //< List of system windows with owner draw decoration
    std::shared_ptr<PhysicalFontCollection> mxFontCollection;   //< Font-List for this frame
    std::shared_ptr<vcl::font::PhysicalFontCollection> mxFontCollection;   //< Font-List for this frame
    std::shared_ptr<ImplFontCache> mxFontCache; //< Font-Cache for this frame
    sal_Int32           mnDPIX;                 //< Original Screen Resolution
    sal_Int32           mnDPIY;                 //< Original Screen Resolution
diff --git a/vcl/qa/cppunit/physicalfontcollection.cxx b/vcl/qa/cppunit/physicalfontcollection.cxx
new file mode 100644
index 0000000..ea76fde
--- /dev/null
+++ b/vcl/qa/cppunit/physicalfontcollection.cxx
@@ -0,0 +1,118 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#include <sal/config.h>

#include <test/bootstrapfixture.hxx>
#include <cppunit/TestAssert.h>

#include <font/PhysicalFontCollection.hxx>
#include <font/PhysicalFontFamily.hxx>

#include "fontmocks.hxx"

#include <memory>

class VclPhysicalFontCollectionTest : public test::BootstrapFixture
{
public:
    VclPhysicalFontCollectionTest()
        : BootstrapFixture(true, false)
    {
    }

    void testShouldCreateAndAddFontFamilyToCollection();
    void testShouldFindFontFamily();
    void testShouldNotFindFontFamily();
    void testShouldFindFontFamilyByTokenNames();
    void testShouldFindNoFamilyWithWorthlessAttributes();

    CPPUNIT_TEST_SUITE(VclPhysicalFontCollectionTest);
    CPPUNIT_TEST(testShouldCreateAndAddFontFamilyToCollection);
    CPPUNIT_TEST(testShouldFindFontFamily);
    CPPUNIT_TEST(testShouldNotFindFontFamily);
    CPPUNIT_TEST(testShouldFindFontFamilyByTokenNames);
    CPPUNIT_TEST(testShouldFindNoFamilyWithWorthlessAttributes);
    CPPUNIT_TEST_SUITE_END();
};

void VclPhysicalFontCollectionTest::testShouldCreateAndAddFontFamilyToCollection()
{
    vcl::font::PhysicalFontCollection aFontCollection;
    CPPUNIT_ASSERT_EQUAL_MESSAGE("Empty font collection", static_cast<int>(0),
                                 aFontCollection.Count());

    // please note that fonts created this way are NOT normalized and will not be found if you search for them in the collection
    vcl::font::PhysicalFontFamily* pFontFamily
        = aFontCollection.FindOrCreateFontFamily("Test Font Family Name");
    CPPUNIT_ASSERT_EQUAL_MESSAGE("One font family in collection", static_cast<int>(1),
                                 aFontCollection.Count());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("Font family name correct", OUString("Test Font Family Name"),
                                 pFontFamily->GetSearchName());

    vcl::font::PhysicalFontFamily* pFontFamily2
        = aFontCollection.FindOrCreateFontFamily("Test Font Family Name");
    CPPUNIT_ASSERT_EQUAL_MESSAGE("Still only one font family in collection", static_cast<int>(1),
                                 aFontCollection.Count());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("Font family name correct", OUString("Test Font Family Name"),
                                 pFontFamily2->GetSearchName());
}

void VclPhysicalFontCollectionTest::testShouldFindFontFamily()
{
    // note: you must normalize the search family name (first parameter of PhysicalFontFamily constructor)
    vcl::font::PhysicalFontCollection aFontCollection;
    aFontCollection.FindOrCreateFontFamily(GetEnglishSearchFontName("Test Font Family Name"));

    vcl::font::PhysicalFontFamily* pFontFamily
        = aFontCollection.FindFontFamily("Test Font Family Name");
    CPPUNIT_ASSERT_EQUAL_MESSAGE("Font family name correct",
                                 GetEnglishSearchFontName("Test Font Family Name"),
                                 pFontFamily->GetSearchName());
}

void VclPhysicalFontCollectionTest::testShouldNotFindFontFamily()
{
    // note: you must normalize the search family name (first parameter of PhysicalFontFamily constructor)
    vcl::font::PhysicalFontCollection aFontCollection;
    aFontCollection.FindOrCreateFontFamily(GetEnglishSearchFontName("Test Font Family Name"));

    CPPUNIT_ASSERT(!aFontCollection.FindFontFamily("blah"));
}

void VclPhysicalFontCollectionTest::testShouldFindFontFamilyByTokenNames()
{
    // note: you must normalize the search family name (first parameter of PhysicalFontFamily constructor)
    vcl::font::PhysicalFontCollection aFontCollection;
    aFontCollection.FindOrCreateFontFamily(GetEnglishSearchFontName("Test Font Family Name"));

    OUString sTokenNames(GetEnglishSearchFontName("Test Font Family Name;"));
    sTokenNames += GetEnglishSearchFontName("Test 2");

    vcl::font::PhysicalFontFamily* pFontFamily
        = aFontCollection.FindFontFamilyByTokenNames("Test Font Family Name");
    CPPUNIT_ASSERT_MESSAGE("Found the font family", pFontFamily);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("Font family name correct",
                                 GetEnglishSearchFontName("Test Font Family Name"),
                                 pFontFamily->GetSearchName());
}

void VclPhysicalFontCollectionTest::testShouldFindNoFamilyWithWorthlessAttributes()
{
    // note: you must normalize the search family name (first parameter of PhysicalFontFamily constructor)
    vcl::font::PhysicalFontCollection aFontCollection;
    aFontCollection.FindOrCreateFontFamily(GetEnglishSearchFontName("Test Font Family Name"));

    CPPUNIT_ASSERT(!aFontCollection.FindFontFamilyByAttributes(ImplFontAttrs::None, WEIGHT_NORMAL,
                                                               WIDTH_NORMAL, ITALIC_NONE, ""));
}

CPPUNIT_TEST_SUITE_REGISTRATION(VclPhysicalFontCollectionTest);

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/qt5/QtFontFace.cxx b/vcl/qt5/QtFontFace.cxx
index ffe88f2..e69bfa7 100644
--- a/vcl/qt5/QtFontFace.cxx
+++ b/vcl/qt5/QtFontFace.cxx
@@ -29,7 +29,7 @@
#include <impfontcharmap.hxx>
#include <fontinstance.hxx>
#include <font/FontSelectPattern.hxx>
#include <PhysicalFontCollection.hxx>
#include <font/PhysicalFontCollection.hxx>

#include <QtGui/QFont>
#include <QtGui/QFontDatabase>
diff --git a/vcl/qt5/QtGraphics_Text.cxx b/vcl/qt5/QtGraphics_Text.cxx
index 45733888..b509c2a 100644
--- a/vcl/qt5/QtGraphics_Text.cxx
+++ b/vcl/qt5/QtGraphics_Text.cxx
@@ -32,7 +32,7 @@
#include <unx/genpspgraphics.h>

#include <sallayout.hxx>
#include <PhysicalFontCollection.hxx>
#include <font/PhysicalFontCollection.hxx>

#include <QtGui/QGlyphRun>
#include <QtGui/QFontDatabase>
@@ -84,7 +84,7 @@ bool QtGraphics::GetFontCapabilities(vcl::FontCapabilities& rFontCapabilities) c
    return m_pTextStyle[0]->GetFontFace()->GetFontCapabilities(rFontCapabilities);
}

void QtGraphics::GetDevFontList(PhysicalFontCollection* pPFC)
void QtGraphics::GetDevFontList(vcl::font::PhysicalFontCollection* pPFC)
{
    static const bool bUseFontconfig = (nullptr == getenv("SAL_VCL_QT5_NO_FONTCONFIG"));

@@ -124,7 +124,7 @@ void QtGraphics::GetDevFontList(PhysicalFontCollection* pPFC)

void QtGraphics::ClearDevFontCache() {}

bool QtGraphics::AddTempDevFont(PhysicalFontCollection*, const OUString& /*rFileURL*/,
bool QtGraphics::AddTempDevFont(vcl::font::PhysicalFontCollection*, const OUString& /*rFileURL*/,
                                const OUString& /*rFontName*/)
{
    return false;
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 5e958f7..7de60b8 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -35,7 +35,7 @@
#include <fontinstance.hxx>
#include <fontattributes.hxx>
#include <impglyphitem.hxx>
#include <PhysicalFontCollection.hxx>
#include <font/PhysicalFontCollection.hxx>
#include <quartz/salgdi.h>
#include <quartz/utils.h>
#include <sallayout.hxx>
@@ -506,7 +506,7 @@ void SystemFontList::AddFont( CoreTextFontFace* pFontData )
    maFontContainer[ nFontId ] = pFontData;
}

void SystemFontList::AnnounceFonts( PhysicalFontCollection& rFontCollection ) const
void SystemFontList::AnnounceFonts( vcl::font::PhysicalFontCollection& rFontCollection ) const
{
    for(const auto& rEntry : maFontContainer )
    {
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 9fed991..9928cc4 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -44,7 +44,7 @@
#include <impfontcharmap.hxx>
#include <impfontmetricdata.hxx>
#include <font/fontsubstitution.hxx>
#include <PhysicalFontCollection.hxx>
#include <font/PhysicalFontCollection.hxx>

#ifdef MACOSX
#include <osx/salframe.h>
@@ -323,7 +323,7 @@ static void AddLocalTempFontDirs()
    AddTempFontDir( aBrandStr + "/" LIBO_SHARE_FOLDER "/fonts/truetype/" );
}

void AquaSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
void AquaSalGraphics::GetDevFontList(vcl::font::PhysicalFontCollection* pFontCollection)
{
    SAL_WARN_IF( !pFontCollection, "vcl", "AquaSalGraphics::GetDevFontList(NULL) !");

@@ -355,8 +355,8 @@ void AquaSalGraphics::ClearDevFontCache()
    pSalData->mpFontList = nullptr;
}

bool AquaSalGraphics::AddTempDevFont( PhysicalFontCollection*,
    const OUString& rFontFileURL, const OUString& /*rFontName*/ )
bool AquaSalGraphics::AddTempDevFont(vcl::font::PhysicalFontCollection*,
    const OUString& rFontFileURL, const OUString& /*rFontName*/)
{
    return ::AddTempDevFont(rFontFileURL);
}
diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index d3559ed..30169e7 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -73,7 +73,7 @@
#include <vcl/svmain.hxx>
#include <dbggui.hxx>
#include <accmgr.hxx>
#include <PhysicalFontCollection.hxx>
#include <font/PhysicalFontCollection.hxx>
#include <print.h>
#include <salsys.hxx>
#include <saltimer.hxx>
@@ -361,7 +361,7 @@ bool InitVCL()
    pSVData->maAppData.mxAppFileName = aNativeFileName;

    // Initialize global data
    pSVData->maGDIData.mxScreenFontList = std::make_shared<PhysicalFontCollection>();
    pSVData->maGDIData.mxScreenFontList = std::make_shared<vcl::font::PhysicalFontCollection>();
    pSVData->maGDIData.mxScreenFontCache = std::make_shared<ImplFontCache>();
    pSVData->maGDIData.mxGrfConverter.reset(new GraphicConverter);

diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx
index c780550..bbccffc 100644
--- a/vcl/source/font/PhysicalFontCollection.cxx
+++ b/vcl/source/font/PhysicalFontCollection.cxx
@@ -28,7 +28,7 @@
#include <o3tl/sorted_vector.hxx>

#include <font/PhysicalFontFaceCollection.hxx>
#include <PhysicalFontCollection.hxx>
#include <font/PhysicalFontCollection.hxx>
#include <font/fontsubstitution.hxx>

static ImplFontAttrs lcl_IsCJKFont( const OUString& rFontName )
@@ -65,6 +65,9 @@ static ImplFontAttrs lcl_IsCJKFont( const OUString& rFontName )
    return ImplFontAttrs::None;
}

namespace vcl::font
{

PhysicalFontCollection::PhysicalFontCollection()
    : mbMatchData( false )
    , mpPreMatchHook( nullptr )
@@ -77,12 +80,12 @@ PhysicalFontCollection::~PhysicalFontCollection()
    Clear();
}

void PhysicalFontCollection::SetPreMatchHook( vcl::font::PreMatchFontSubstitution* pHook )
void PhysicalFontCollection::SetPreMatchHook(PreMatchFontSubstitution* pHook)
{
    mpPreMatchHook = pHook;
}

void PhysicalFontCollection::SetFallbackHook( vcl::font::GlyphFallbackFontSubstitution* pHook )
void PhysicalFontCollection::SetFallbackHook(GlyphFallbackFontSubstitution* pHook)
{
    mpFallbackHook = pHook;
}
@@ -132,7 +135,7 @@ void PhysicalFontCollection::ImplInitGenericGlyphFallback() const
    bool bHasEudc = false;
    int nMaxLevel = 0;
    int nBestQuality = 0;
    std::unique_ptr<std::array<vcl::font::PhysicalFontFamily*,MAX_GLYPHFALLBACK>> pFallbackList;
    std::unique_ptr<std::array<PhysicalFontFamily*,MAX_GLYPHFALLBACK>> pFallbackList;

    for( const char** ppNames = &aGlyphFallbackList[0];; ++ppNames )
    {
@@ -152,7 +155,7 @@ void PhysicalFontCollection::ImplInitGenericGlyphFallback() const

        // test if the glyph fallback candidate font is available and scalable
        OUString aTokenName( *ppNames, strlen(*ppNames), RTL_TEXTENCODING_UTF8 );
        vcl::font::PhysicalFontFamily* pFallbackFont = FindFontFamily( aTokenName );
        PhysicalFontFamily* pFallbackFont = FindFontFamily( aTokenName );

        if( !pFallbackFont )
            continue;
@@ -163,7 +166,7 @@ void PhysicalFontCollection::ImplInitGenericGlyphFallback() const
            nBestQuality = pFallbackFont->GetMinQuality();
            // store available glyph fallback fonts
            if( !pFallbackList )
                pFallbackList.reset(new std::array<vcl::font::PhysicalFontFamily*,MAX_GLYPHFALLBACK>);
                pFallbackList.reset(new std::array<PhysicalFontFamily*,MAX_GLYPHFALLBACK>);

            (*pFallbackList)[ nMaxLevel ] = pFallbackFont;
            if( !bHasEudc && !nMaxLevel )
@@ -175,12 +178,12 @@ void PhysicalFontCollection::ImplInitGenericGlyphFallback() const
    mpFallbackList  = std::move(pFallbackList);
}

vcl::font::PhysicalFontFamily* PhysicalFontCollection::GetGlyphFallbackFont( vcl::font::FontSelectPattern& rFontSelData,
                                                                  LogicalFontInstance* pFontInstance,
                                                                  OUString& rMissingCodes,
                                                                  int nFallbackLevel ) const
PhysicalFontFamily* PhysicalFontCollection::GetGlyphFallbackFont(FontSelectPattern& rFontSelData,
                                                                 LogicalFontInstance* pFontInstance,
                                                                 OUString& rMissingCodes,
                                                                 int nFallbackLevel) const
{
    vcl::font::PhysicalFontFamily* pFallbackData = nullptr;
    PhysicalFontFamily* pFallbackData = nullptr;

    // find a matching font candidate for platform specific glyph fallback
    if( mpFallbackHook )
@@ -277,17 +280,17 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::GetGlyphFallbackFont( vcl
    return pFallbackData;
}

void PhysicalFontCollection::Add( vcl::font::PhysicalFontFace* pNewData )
void PhysicalFontCollection::Add(PhysicalFontFace* pNewData)
{
    OUString aSearchName = GetEnglishSearchFontName( pNewData->GetFamilyName() );

    vcl::font::PhysicalFontFamily* pFoundData = FindOrCreateFontFamily( aSearchName );
    PhysicalFontFamily* pFoundData = FindOrCreateFontFamily(aSearchName);

    pFoundData->AddFontFace( pNewData );
}

// find the font from the normalized font family name
vcl::font::PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyBySearchName( const OUString& rSearchName ) const
PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyBySearchName(const OUString& rSearchName) const
{
    // must be called with a normalized name.
    assert( GetEnglishSearchFontName( rSearchName ) == rSearchName );
@@ -296,35 +299,35 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyBySearc
    if( it == maPhysicalFontFamilies.end() )
        return nullptr;

    vcl::font::PhysicalFontFamily* pFoundData = (*it).second.get();
    PhysicalFontFamily* pFoundData = (*it).second.get();
    return pFoundData;
}

vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( const OUString& rFontName ) const
PhysicalFontFamily* PhysicalFontCollection::FindFontFamily(OUString const& rFontName) const
{
    return ImplFindFontFamilyBySearchName( GetEnglishSearchFontName( rFontName ) );
}

vcl::font::PhysicalFontFamily *PhysicalFontCollection::FindOrCreateFontFamily( const OUString &rFamilyName )
PhysicalFontFamily *PhysicalFontCollection::FindOrCreateFontFamily(OUString const& rFamilyName)
{
    PhysicalFontFamilies::const_iterator it = maPhysicalFontFamilies.find( rFamilyName );
    vcl::font::PhysicalFontFamily* pFoundData = nullptr;
    PhysicalFontFamily* pFoundData = nullptr;

    if( it != maPhysicalFontFamilies.end() )
        pFoundData = (*it).second.get();

    if( !pFoundData )
    {
        pFoundData = new vcl::font::PhysicalFontFamily( rFamilyName );
        pFoundData = new PhysicalFontFamily(rFamilyName);
        maPhysicalFontFamilies[ rFamilyName ].reset(pFoundData);
    }

    return pFoundData;
}

vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByTokenNames(const OUString& rTokenStr) const
PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByTokenNames(OUString const& rTokenStr) const
{
    vcl::font::PhysicalFontFamily* pFoundData = nullptr;
    PhysicalFontFamily* pFoundData = nullptr;

    // use normalized font name tokens to find the font
    for( sal_Int32 nTokenPos = 0; nTokenPos != -1; )
@@ -342,9 +345,9 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByTokenName
    return pFoundData;
}

vcl::font::PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyBySubstFontAttr( const utl::FontNameAttr& rFontAttr ) const
PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyBySubstFontAttr(utl::FontNameAttr const& rFontAttr) const
{
    vcl::font::PhysicalFontFamily* pFoundData = nullptr;
    PhysicalFontFamily* pFoundData = nullptr;

    // use the font substitutions suggested by the FontNameAttr to find the font
    for (auto const& substitution : rFontAttr.Substitutions)
@@ -388,17 +391,17 @@ void PhysicalFontCollection::ImplInitMatchData() const
    for (auto const& family : maPhysicalFontFamilies)
    {
        const OUString& rSearchName = family.first;
        vcl::font::PhysicalFontFamily* pEntry = family.second.get();
        PhysicalFontFamily* pEntry = family.second.get();

        pEntry->InitMatchData( rFontSubst, rSearchName );
    }
}

vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttributes( ImplFontAttrs nSearchType,
                                                                        FontWeight eSearchWeight,
                                                                        FontWidth eSearchWidth,
                                                                        FontItalic eSearchItalic,
                                                                        const OUString& rSearchFamilyName ) const
PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttributes(ImplFontAttrs nSearchType,
                                                                       FontWeight eSearchWeight,
                                                                       FontWidth eSearchWidth,
                                                                       FontItalic eSearchItalic,
                                                                       OUString const& rSearchFamilyName ) const
{
    if( (eSearchItalic != ITALIC_NONE) && (eSearchItalic != ITALIC_DONTKNOW) )
        nSearchType |= ImplFontAttrs::Italic;
@@ -410,14 +413,14 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttribute
        return nullptr;

    ImplInitMatchData();
    vcl::font::PhysicalFontFamily* pFoundData = nullptr;
    PhysicalFontFamily* pFoundData = nullptr;

    tools::Long    nBestMatch = 40000;
    ImplFontAttrs  nBestType = ImplFontAttrs::None;

    for (auto const& family : maPhysicalFontFamilies)
    {
        vcl::font::PhysicalFontFamily* pData = family.second.get();
        PhysicalFontFamily* pData = family.second.get();

        // Get all information about the matching font
        ImplFontAttrs nMatchType  = pData->GetMatchType();
@@ -498,7 +501,7 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttribute
            {
                nTestMatch += 10000000*5;
            }
            else if ( pData->GetTypeFaces() & vcl::font::FontTypeFaces::Symbol )
            else if (pData->GetTypeFaces() & FontTypeFaces::Symbol)
            {
                nTestMatch += 10000000*4;
            }
@@ -510,7 +513,7 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttribute
                    nTestMatch += 10000000;
            }
        }
        else if ( (pData->GetTypeFaces() & (vcl::font::FontTypeFaces::Symbol | vcl::font::FontTypeFaces::NoneSymbol)) == vcl::font::FontTypeFaces::Symbol )
        else if ((pData->GetTypeFaces() & (FontTypeFaces::Symbol | FontTypeFaces::NoneSymbol)) == FontTypeFaces::Symbol)
        {
            nTestMatch -= 10000000;
        }
@@ -677,14 +680,14 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttribute
        // test ITALIC attribute
        if( nSearchType & ImplFontAttrs::Italic )
        {
            if( pData->GetTypeFaces() & vcl::font::FontTypeFaces::Italic )
            if (pData->GetTypeFaces() & FontTypeFaces::Italic)
                nTestMatch += 1000000*3;
            if( nMatchType & ImplFontAttrs::Italic )
                nTestMatch += 1000000;
        }
        else if( !(nSearchType & ImplFontAttrs::AllScript) &&
                 ((nMatchType & ImplFontAttrs::Italic) ||
                  !(pData->GetTypeFaces() & vcl::font::FontTypeFaces::NoneItalic)) )
        else if (!(nSearchType & ImplFontAttrs::AllScript)
                 && ((nMatchType & ImplFontAttrs::Italic)
                 || !(pData->GetTypeFaces() & FontTypeFaces::NoneItalic)))
        {
            nTestMatch -= 1000000*2;
        }
@@ -719,29 +722,29 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttribute
        {
            if( eSearchWeight < WEIGHT_NORMAL )
            {
                if( pData->GetTypeFaces() & vcl::font::FontTypeFaces::Light )
                if (pData->GetTypeFaces() & FontTypeFaces::Light)
                    nTestMatch += 1000000;
                if( (eMatchWeight < WEIGHT_NORMAL) && (eMatchWeight != WEIGHT_DONTKNOW) )
                    nTestMatch += 1000000;
            }
            else
            {
                if( pData->GetTypeFaces() & vcl::font::FontTypeFaces::Bold )
                if (pData->GetTypeFaces() & FontTypeFaces::Bold)
                    nTestMatch += 1000000;
                if( eMatchWeight > WEIGHT_BOLD )
                    nTestMatch += 1000000;
            }
        }
        else if( ((eMatchWeight != WEIGHT_DONTKNOW) &&
                  (eMatchWeight != WEIGHT_NORMAL) &&
                  (eMatchWeight != WEIGHT_MEDIUM)) ||
                 !(pData->GetTypeFaces() & vcl::font::FontTypeFaces::Normal) )
        else if (((eMatchWeight != WEIGHT_DONTKNOW)
                  && (eMatchWeight != WEIGHT_NORMAL)
                  && (eMatchWeight != WEIGHT_MEDIUM))
                  || !(pData->GetTypeFaces() & FontTypeFaces::Normal))
        {
            nTestMatch -= 1000000;
        }

        // prefer scalable fonts
        if( pData->GetTypeFaces() & vcl::font::FontTypeFaces::Scalable )
        if (pData->GetTypeFaces() & FontTypeFaces::Scalable)
            nTestMatch += 10000*4;
        else
            nTestMatch -= 10000*4;
@@ -815,11 +818,11 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamilyByAttribute
    return pFoundData;
}

vcl::font::PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyOfDefaultFont() const
PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyOfDefaultFont() const
{
    // try to find one of the default fonts of the
    // UNICODE, SANSSERIF, SERIF or FIXED default font lists
    vcl::font::PhysicalFontFamily* pFoundData = nullptr;
    PhysicalFontFamily* pFoundData = nullptr;
    if (!utl::ConfigManager::IsFuzzing())
    {
        const utl::DefaultFontConfiguration& rDefaults = utl::DefaultFontConfiguration::get();
@@ -852,7 +855,7 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyOfDefau

    for (auto const& family : maPhysicalFontFamilies)
    {
        vcl::font::PhysicalFontFamily* pData = family.second.get();
        PhysicalFontFamily* pData = family.second.get();
        if( pData->GetMatchType() & ImplFontAttrs::Symbol )
            continue;

@@ -882,20 +885,20 @@ std::shared_ptr<PhysicalFontCollection> PhysicalFontCollection::Clone() const

    for (auto const& family : maPhysicalFontFamilies)
    {
        const vcl::font::PhysicalFontFamily* pFontFace = family.second.get();
        const PhysicalFontFamily* pFontFace = family.second.get();
        pFontFace->UpdateCloneFontList(*xClonedCollection);
    }

    return xClonedCollection;
}

std::unique_ptr<vcl::font::PhysicalFontFaceCollection> PhysicalFontCollection::GetFontFaceCollection() const
std::unique_ptr<PhysicalFontFaceCollection> PhysicalFontCollection::GetFontFaceCollection() const
{
    std::unique_ptr<vcl::font::PhysicalFontFaceCollection> pDeviceFontList(new vcl::font::PhysicalFontFaceCollection);
    std::unique_ptr<PhysicalFontFaceCollection> pDeviceFontList(new PhysicalFontFaceCollection);

    for (auto const& family : maPhysicalFontFamilies)
    {
        const vcl::font::PhysicalFontFamily* pFontFamily = family.second.get();
        const PhysicalFontFamily* pFontFamily = family.second.get();
        pFontFamily->UpdateDevFontList( *pDeviceFontList );
    }

@@ -915,7 +918,7 @@ const std::vector<std::pair<OUString, OUString>> aMetricCompatibleMap =
    { "Calibri",         "Carlito" },
};

static bool FindMetricCompatibleFont(vcl::font::FontSelectPattern& rFontSelData)
static bool FindMetricCompatibleFont(FontSelectPattern& rFontSelData)
{
    for (const auto& aSub : aMetricCompatibleMap)
    {
@@ -929,7 +932,7 @@ static bool FindMetricCompatibleFont(vcl::font::FontSelectPattern& rFontSelData)
    return false;
}

vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( vcl::font::FontSelectPattern& rFSD ) const
PhysicalFontFamily* PhysicalFontCollection::FindFontFamily(FontSelectPattern& rFSD) const
{
    // give up if no fonts are available
    if( !Count() )
@@ -942,7 +945,7 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( vcl::font
        sal_Int32 nIndex = 0;
        rFSD.maTargetName = GetNextFontToken(rFSD.GetFamilyName(), nIndex);
        rFSD.maSearchName = "liberationsans";
        vcl::font::PhysicalFontFamily* pFont = ImplFindFontFamilyBySearchName(rFSD.maSearchName);
        PhysicalFontFamily* pFont = ImplFindFontFamilyBySearchName(rFSD.maSearchName);
        assert(pFont);
        return pFont;
    }
@@ -957,7 +960,7 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( vcl::font

        // Until features are properly supported, they are appended to the
        // font name, so we need to strip them off so the font is found.
        sal_Int32 nFeat = aSearchName.indexOf(vcl::font::FontSelectPattern::FEAT_PREFIX);
        sal_Int32 nFeat = aSearchName.indexOf(FontSelectPattern::FEAT_PREFIX);
        OUString aOrigName = rFSD.maTargetName;
        OUString aBaseFontName = aSearchName.copy( 0, (nFeat != -1) ? nFeat : aSearchName.getLength() );

@@ -968,7 +971,7 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( vcl::font
        }

        aSearchName = GetEnglishSearchFontName( aSearchName );
        vcl::font::ImplFontSubstitute(aSearchName);
        ImplFontSubstitute(aSearchName);
        // #114999# special emboldening for Ricoh fonts
        // TODO: smarter check for special cases by using PreMatch infrastructure?
        if( (rFSD.GetWeight() > WEIGHT_MEDIUM) &&
@@ -1001,7 +1004,7 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( vcl::font
        rFSD.maTargetName = aOrigName;

        // check if the current font name token or its substitute is valid
        vcl::font::PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySearchName( aSearchName );
        PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySearchName(aSearchName);
        if( pFoundData )
            return pFoundData;

@@ -1065,8 +1068,8 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( vcl::font
        {
            aSearchName = GetEnglishSearchFontName( aSearchName );
        }
        vcl::font::ImplFontSubstitute( aSearchName );
        vcl::font::PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySearchName( aSearchName );
        ImplFontSubstitute(aSearchName);
        PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySearchName(aSearchName);
        if( pFoundData )
            return pFoundData;
    }
@@ -1092,7 +1095,7 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( vcl::font
    // use the font's shortened name if needed
    if ( aSearchShortName != aSearchName )
    {
        vcl::font::PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySearchName( aSearchShortName );
        PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySearchName(aSearchShortName);
        if( pFoundData )
        {
#ifdef UNX
@@ -1125,7 +1128,7 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( vcl::font
        // try the font substitutions suggested by the fallback info
        if( pFontAttr )
        {
            vcl::font::PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySubstFontAttr( *pFontAttr );
            PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySubstFontAttr(*pFontAttr);
            if( pFoundData )
                return pFoundData;
        }
@@ -1139,7 +1142,7 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( vcl::font
            aSearchName = "OpenSymbol";
        else
            aSearchName = utl::DefaultFontConfiguration::get().getDefaultFont( aDefaultLanguageTag, DefaultFontType::SYMBOL );
        vcl::font::PhysicalFontFamily* pFoundData = FindFontFamilyByTokenNames( aSearchName );
        PhysicalFontFamily* pFoundData = FindFontFamilyByTokenNames(aSearchName);
        if( pFoundData )
            return pFoundData;
    }
@@ -1164,7 +1167,7 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( vcl::font
        // use a shortened token name if available
        if( aTempShortName != aSearchName )
        {
            vcl::font::PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySearchName( aTempShortName );
            PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySearchName(aTempShortName);
            if( pFoundData )
                return pFoundData;
        }
@@ -1188,7 +1191,7 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( vcl::font
        // try the font substitutions suggested by the fallback info
        if( pTempFontAttr )
        {
            vcl::font::PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySubstFontAttr( *pTempFontAttr );
            PhysicalFontFamily* pFoundData = ImplFindFontFamilyBySubstFontAttr(*pTempFontAttr);
            if( pFoundData )
                return pFoundData;
            if( !pFontAttr )
@@ -1212,31 +1215,31 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( vcl::font
            nSearchType |= ImplFontAttrs::Symbol;
    }

    vcl::font::PhysicalFontFamily::CalcType( nSearchType, eSearchWeight, eSearchWidth, rFSD.GetFamilyType(), pFontAttr );
    vcl::font::PhysicalFontFamily* pFoundData = FindFontFamilyByAttributes( nSearchType,
        eSearchWeight, eSearchWidth, rFSD.GetItalic(), aSearchFamilyName );
    PhysicalFontFamily::CalcType(nSearchType, eSearchWeight, eSearchWidth, rFSD.GetFamilyType(), pFontAttr);
    PhysicalFontFamily* pFoundData = FindFontFamilyByAttributes(nSearchType,
        eSearchWeight, eSearchWidth, rFSD.GetItalic(), aSearchFamilyName);

    if( pFoundData )
    {
        // overwrite font selection attributes using info from the typeface flags
        if( (eSearchWeight >= WEIGHT_BOLD) &&
            (eSearchWeight > rFSD.GetWeight()) &&
            (pFoundData->GetTypeFaces() & vcl::font::FontTypeFaces::Bold) )
        if ((eSearchWeight >= WEIGHT_BOLD)
            && (eSearchWeight > rFSD.GetWeight())
            && (pFoundData->GetTypeFaces() & FontTypeFaces::Bold))
        {
            rFSD.SetWeight( eSearchWeight );
        }
        else if( (eSearchWeight < WEIGHT_NORMAL) &&
                 (eSearchWeight < rFSD.GetWeight()) &&
                 (eSearchWeight != WEIGHT_DONTKNOW) &&
                 (pFoundData->GetTypeFaces() & vcl::font::FontTypeFaces::Light) )
        else if ((eSearchWeight < WEIGHT_NORMAL)
                 && (eSearchWeight < rFSD.GetWeight())
                 && (eSearchWeight != WEIGHT_DONTKNOW)
                 && (pFoundData->GetTypeFaces() & FontTypeFaces::Light))
        {
            rFSD.SetWeight( eSearchWeight );
        }

        if( (nSearchType & ImplFontAttrs::Italic) &&
            ((rFSD.GetItalic() == ITALIC_DONTKNOW) ||
             (rFSD.GetItalic() == ITALIC_NONE)) &&
            (pFoundData->GetTypeFaces() & vcl::font::FontTypeFaces::Italic) )
        if ((nSearchType & ImplFontAttrs::Italic)
            && ((rFSD.GetItalic() == ITALIC_DONTKNOW)
            || (rFSD.GetItalic() == ITALIC_NONE))
            && (pFoundData->GetTypeFaces() & FontTypeFaces::Italic))
        {
            rFSD.SetItalic( ITALIC_NORMAL );
        }
@@ -1249,5 +1252,6 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( vcl::font

    return pFoundData;
}
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/source/font/PhysicalFontFamily.cxx b/vcl/source/font/PhysicalFontFamily.cxx
index 31d19e6..5e3f64f 100644
--- a/vcl/source/font/PhysicalFontFamily.cxx
+++ b/vcl/source/font/PhysicalFontFamily.cxx
@@ -23,7 +23,7 @@
#include <unotools/fontdefs.hxx>

#include <font/PhysicalFontFaceCollection.hxx>
#include <PhysicalFontCollection.hxx>
#include <font/PhysicalFontCollection.hxx>

namespace vcl::font
{
@@ -247,7 +247,7 @@ void PhysicalFontFamily::UpdateDevFontList( vcl::font::PhysicalFontFaceCollectio
    }
}

void PhysicalFontFamily::UpdateCloneFontList(PhysicalFontCollection& rFontCollection) const
void PhysicalFontFamily::UpdateCloneFontList(vcl::font::PhysicalFontCollection& rFontCollection) const
{
    OUString aFamilyName = GetEnglishSearchFontName( GetFamilyName() );
    PhysicalFontFamily* pFamily(nullptr);
diff --git a/vcl/source/font/fontcache.cxx b/vcl/source/font/fontcache.cxx
index c125d49..bdc4742 100644
--- a/vcl/source/font/fontcache.cxx
+++ b/vcl/source/font/fontcache.cxx
@@ -21,7 +21,7 @@

#include <sal/log.hxx>

#include <PhysicalFontCollection.hxx>
#include <font/PhysicalFontCollection.hxx>
#include <font/PhysicalFontFace.hxx>
#include <font/PhysicalFontFamily.hxx>
#include <fontinstance.hxx>
diff --git a/vcl/source/gdi/embeddedfontshelper.cxx b/vcl/source/gdi/embeddedfontshelper.cxx
index b699a33..846f232 100644
--- a/vcl/source/gdi/embeddedfontshelper.cxx
+++ b/vcl/source/gdi/embeddedfontshelper.cxx
@@ -21,7 +21,7 @@
#include <com/sun/star/io/XInputStream.hpp>

#include <font/PhysicalFontFaceCollection.hxx>
#include <PhysicalFontCollection.hxx>
#include <font/PhysicalFontCollection.hxx>
#include <salgdi.hxx>
#include <sft.hxx>

@@ -256,7 +256,7 @@ OUString EmbeddedFontsHelper::fontFileUrl( std::u16string_view familyName, FontF
    }
    bool ok = false;
    SalGraphics* graphics = Application::GetDefaultDevice()->GetGraphics();
    PhysicalFontCollection fonts;
    vcl::font::PhysicalFontCollection fonts;
    graphics->GetDevFontList( &fonts );
    std::unique_ptr< vcl::font::PhysicalFontFaceCollection > fontInfo( fonts.GetFontFaceCollection());
    vcl::font::PhysicalFontFace* selected = nullptr;
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 864755c..1b7e421 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -34,7 +34,7 @@
#include <jobset.h>
#include <print.h>
#include <ImplOutDevData.hxx>
#include <PhysicalFontCollection.hxx>
#include <font/PhysicalFontCollection.hxx>
#include <font/PhysicalFontFaceCollection.hxx>
#include <font/fontsubstitution.hxx>
#include <impfontcache.hxx>
@@ -665,7 +665,7 @@ void Printer::ImplInit( SalPrinterQueueInfo* pInfo )

    // Init data
    ImplUpdatePageData();
    mxFontCollection = std::make_shared<PhysicalFontCollection>();
    mxFontCollection = std::make_shared<vcl::font::PhysicalFontCollection>();
    mxFontCache = std::make_shared<ImplFontCache>();
    mpGraphics->GetDevFontList(mxFontCollection.get());
}
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index ea6e97a..6a44cc1 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -26,8 +26,8 @@
#include <vcl/virdev.hxx>

#include <ImplOutDevData.hxx>
#include <font/PhysicalFontCollection.hxx>
#include <font/PhysicalFontFaceCollection.hxx>
#include <PhysicalFontCollection.hxx>
#include <impfontcache.hxx>
#include <salinst.hxx>
#include <salgdi.hxx>
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 435b554..9ac3d74 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -41,7 +41,7 @@
#include <impfontcache.hxx>
#include <font/DirectFontSubstitution.hxx>
#include <font/PhysicalFontFaceCollection.hxx>
#include <PhysicalFontCollection.hxx>
#include <font/PhysicalFontCollection.hxx>
#include <font/FeatureCollector.hxx>
#include <impglyphitem.hxx>
#include <sallayout.hxx>
diff --git a/vcl/unx/generic/fontmanager/fontsubst.cxx b/vcl/unx/generic/fontmanager/fontsubst.cxx
index 7945da6..afbe53d 100644
--- a/vcl/unx/generic/fontmanager/fontsubst.cxx
+++ b/vcl/unx/generic/fontmanager/fontsubst.cxx
@@ -20,9 +20,9 @@
#include <sal/config.h>

#include <unx/geninst.h>
#include <font/PhysicalFontCollection.hxx>
#include <font/fontsubstitution.hxx>
#include <unx/fontmanager.hxx>
#include <PhysicalFontCollection.hxx>

// platform specific font substitution hooks

@@ -49,7 +49,7 @@ public:

}

void SalGenericInstance::RegisterFontSubstitutors( PhysicalFontCollection* pFontCollection )
void SalGenericInstance::RegisterFontSubstitutors(vcl::font::PhysicalFontCollection* pFontCollection)
{
    // register font fallback substitutions
    static FcPreMatchSubstitution aSubstPreMatch;
diff --git a/vcl/unx/generic/gdi/font.cxx b/vcl/unx/generic/gdi/font.cxx
index bc56b56..57ff99a 100644
--- a/vcl/unx/generic/gdi/font.cxx
+++ b/vcl/unx/generic/gdi/font.cxx
@@ -53,7 +53,7 @@ X11SalGraphics::SetTextColor( Color nColor )
    mxTextRenderImpl->SetTextColor(nColor);
}

bool X11SalGraphics::AddTempDevFont( PhysicalFontCollection* pFontCollection,
bool X11SalGraphics::AddTempDevFont( vcl::font::PhysicalFontCollection* pFontCollection,
                                     const OUString& rFileURL,
                                     const OUString& rFontName )
{
@@ -65,7 +65,7 @@ void X11SalGraphics::ClearDevFontCache()
    mxTextRenderImpl->ClearDevFontCache();
}

void X11SalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
void X11SalGraphics::GetDevFontList( vcl::font::PhysicalFontCollection* pFontCollection )
{
    mxTextRenderImpl->GetDevFontList(pFontCollection);
}
diff --git a/vcl/unx/generic/gdi/freetypetextrender.cxx b/vcl/unx/generic/gdi/freetypetextrender.cxx
index 2b39d878..ea8474e 100644
--- a/vcl/unx/generic/gdi/freetypetextrender.cxx
+++ b/vcl/unx/generic/gdi/freetypetextrender.cxx
@@ -93,7 +93,7 @@ FreeTypeTextRenderImpl::SetTextColor( Color nColor )
    }
}

bool FreeTypeTextRenderImpl::AddTempDevFont( PhysicalFontCollection* pFontCollection,
bool FreeTypeTextRenderImpl::AddTempDevFont( vcl::font::PhysicalFontCollection* pFontCollection,
                                     const OUString& rFileURL,
                                     const OUString& rFontName )
{
@@ -105,7 +105,7 @@ void FreeTypeTextRenderImpl::ClearDevFontCache()
    FreetypeManager::get().ClearFontCache();
}

void FreeTypeTextRenderImpl::GetDevFontList( PhysicalFontCollection* pFontCollection )
void FreeTypeTextRenderImpl::GetDevFontList( vcl::font::PhysicalFontCollection* pFontCollection )
{
    // prepare the FreetypeManager using psprint's font infos
    FreetypeManager& rFreetypeManager = FreetypeManager::get();
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index 645afdd..74e3d6f 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -36,7 +36,7 @@
#include <sal/log.hxx>

#include <langboost.hxx>
#include <PhysicalFontCollection.hxx>
#include <font/PhysicalFontCollection.hxx>
#include <sft.hxx>

#include <ft2build.h>
@@ -281,7 +281,7 @@ const unsigned char* FreetypeFontInfo::GetTable( const char* pTag, sal_uLong* pL
    return nullptr;
}

void FreetypeFontInfo::AnnounceFont( PhysicalFontCollection* pFontCollection )
void FreetypeFontInfo::AnnounceFont( vcl::font::PhysicalFontCollection* pFontCollection )
{
    rtl::Reference<FreetypeFontFace> pFD(new FreetypeFontFace( this, maDevFontAttributes ));
    pFontCollection->Add( pFD.get() );
@@ -358,7 +358,7 @@ void FreetypeManager::AddFontFile(const OString& rNormalizedName,
        m_nMaxFontId = nFontId;
}

void FreetypeManager::AnnounceFonts( PhysicalFontCollection* pToAdd ) const
void FreetypeManager::AnnounceFonts( vcl::font::PhysicalFontCollection* pToAdd ) const
{
    for (auto const& font : m_aFontInfoList)
    {
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 3ae0e8f..359c330 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -47,7 +47,7 @@
#include <fontattributes.hxx>
#include <impfontmetricdata.hxx>
#include <font/FontSelectPattern.hxx>
#include <PhysicalFontCollection.hxx>
#include <font/PhysicalFontCollection.hxx>
#include <font/PhysicalFontFace.hxx>
#include <sallayout.hxx>

@@ -232,12 +232,12 @@ void GenPspGraphics::SetTextColor( Color nColor )
    m_pPrinterGfx->SetTextColor (aColor);
}

bool GenPspGraphics::AddTempDevFont( PhysicalFontCollection*, const OUString&,const OUString& )
bool GenPspGraphics::AddTempDevFont( vcl::font::PhysicalFontCollection*, const OUString&,const OUString& )
{
    return false;
}

bool GenPspGraphics::AddTempDevFontHelper( PhysicalFontCollection* pFontCollection,
bool GenPspGraphics::AddTempDevFontHelper( vcl::font::PhysicalFontCollection* pFontCollection,
                                           const OUString& rFileURL,
                                           const OUString& rFontName)
{
@@ -271,7 +271,7 @@ bool GenPspGraphics::AddTempDevFontHelper( PhysicalFontCollection* pFontCollecti
    return true;
}

void GenPspGraphics::GetDevFontList( PhysicalFontCollection *pFontCollection )
void GenPspGraphics::GetDevFontList( vcl::font::PhysicalFontCollection *pFontCollection )
{
    ::std::vector< psp::fontID > aList;
    psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
@@ -406,7 +406,7 @@ namespace vcl
    }
}

void GenPspGraphics::AnnounceFonts( PhysicalFontCollection* pFontCollection, const psp::FastPrintFontInfo& aInfo )
void GenPspGraphics::AnnounceFonts( vcl::font::PhysicalFontCollection* pFontCollection, const psp::FastPrintFontInfo& aInfo )
{
    int nQuality = 0;

diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 522793f..f1c621c 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -53,8 +53,8 @@

#include <font/FontSelectPattern.hxx>
#include <fontsubset.hxx>
#include <font/PhysicalFontCollection.hxx>
#include <font/PhysicalFontFaceCollection.hxx>
#include <PhysicalFontCollection.hxx>
#include <font/PhysicalFontFace.hxx>
#include <font/fontsubstitution.hxx>
#include <sft.hxx>
@@ -243,7 +243,7 @@ bool WinGlyphFallbackSubstititution::HasMissingChars(vcl::font::PhysicalFontFace
namespace
{
    //used by 2-level font fallback
    vcl::font::PhysicalFontFamily* findDevFontListByLocale(const PhysicalFontCollection &rFontCollection,
    vcl::font::PhysicalFontFamily* findDevFontListByLocale(const vcl::font::PhysicalFontCollection &rFontCollection,
                                                const LanguageTag& rLanguageTag )
    {
        // get the default font for a specified locale
@@ -300,7 +300,7 @@ bool WinGlyphFallbackSubstititution::FindFontSubstitute(vcl::font::FontSelectPat

    // first level fallback:
    // try use the locale specific default fonts defined in VCL.xcu
    const PhysicalFontCollection* pFontCollection = ImplGetSVData()->maGDIData.mxScreenFontList.get();
    const vcl::font::PhysicalFontCollection* pFontCollection = ImplGetSVData()->maGDIData.mxScreenFontList.get();
    vcl::font::PhysicalFontFamily* pFontFamily = findDevFontListByLocale(*pFontCollection, aLanguageTag);
    if( pFontFamily )
    {
@@ -355,7 +355,7 @@ namespace {
struct ImplEnumInfo
{
    HDC                 mhDC;
    PhysicalFontCollection* mpList;
    vcl::font::PhysicalFontCollection* mpList;
    OUString*           mpName;
    LOGFONTW*           mpLogFont;
    bool                mbPrinter;
@@ -1116,7 +1116,7 @@ static OUString lcl_GetFontFamilyName(const OUString& rFontFileURL)
    return OUString(aBuffer + nNameOfs, nPos - nNameOfs, osl_getThreadTextEncoding());
}

bool WinSalGraphics::AddTempDevFont(PhysicalFontCollection* pFontCollection,
bool WinSalGraphics::AddTempDevFont(vcl::font::PhysicalFontCollection* pFontCollection,
                                    const OUString& rFontFileURL, const OUString& rFontName)
{
    OUString aFontFamily = lcl_GetFontFamilyName(rFontFileURL);
@@ -1158,7 +1158,7 @@ bool WinSalGraphics::AddTempDevFont(PhysicalFontCollection* pFontCollection,
    return true;
}

void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection )
void WinSalGraphics::GetDevFontList( vcl::font::PhysicalFontCollection* pFontCollection )
{
    // make sure all LO shared fonts are registered temporarily
    static std::once_flag init;