include/vcl/metric.hxx                         |    4 
 include/vcl/vcllayout.hxx                      |    5 
 solenv/clang-format/excludelist                |    4 
 vcl/CppunitTest_vcl_font.mk                    |    1 
 vcl/Library_vcl.mk                             |    2 
 vcl/headless/svptext.cxx                       |    6 
 vcl/inc/PhysicalFontCollection.hxx             |    2 
 vcl/inc/font/FontSelectPattern.hxx             |    1 
 vcl/inc/font/PhysicalFontFace.hxx              |    9 
 vcl/inc/font/PhysicalFontFaceCollection.hxx    |    2 
 vcl/inc/font/PhysicalFontFamily.hxx            |    5 
 vcl/inc/fontinstance.hxx                       |   10 
 vcl/inc/headless/svpgdi.hxx                    |    7 
 vcl/inc/outdev.h                               |    2 
 vcl/inc/pch/precompiled_vcl.hxx                |   24 +
 vcl/inc/pdf/pdfbuildin_fonts.hxx               |    6 
 vcl/inc/pdf/pdffontcache.hxx                   |    6 
 vcl/inc/pdf/pdfwriter_impl.hxx                 |   12 
 vcl/inc/qt5/QtFont.hxx                         |    2 
 vcl/inc/qt5/QtFontFace.hxx                     |    4 
 vcl/inc/qt5/QtGraphics.hxx                     |    7 
 vcl/inc/quartz/salgdi.h                        |   14 -
 vcl/inc/salgdi.hxx                             |   13 -
 vcl/inc/sallayout.hxx                          |   10 
 vcl/inc/textrender.hxx                         |    8 
 vcl/inc/unx/cairotextrender.hxx                |    2 
 vcl/inc/unx/freetype_glyphcache.hxx            |    8 
 vcl/inc/unx/freetypetextrender.hxx             |    6 
 vcl/inc/unx/genpspgraphics.h                   |    8 
 vcl/inc/unx/salgdi.h                           |    8 
 vcl/inc/win/salgdi.h                           |   14 -
 vcl/qa/cppunit/fontmocks.hxx                   |   14 -
 vcl/qa/cppunit/physicalfontface.cxx            |  301 +++++++++++++++++++++++++
 vcl/qa/cppunit/physicalfontfacecollection.cxx  |    4 
 vcl/qt5/QtFont.cxx                             |    2 
 vcl/qt5/QtFontFace.cxx                         |    2 
 vcl/qt5/QtGraphics_Text.cxx                    |    8 
 vcl/quartz/ctfonts.cxx                         |    2 
 vcl/quartz/salgdi.cxx                          |    8 
 vcl/quartz/salgdicommon.cxx                    |    2 
 vcl/source/font/FontSelectPattern.cxx          |    3 
 vcl/source/font/PhysicalFontCollection.cxx     |    2 
 vcl/source/font/PhysicalFontFace.cxx           |    6 
 vcl/source/font/fontcache.cxx                  |    5 
 vcl/source/font/fontinstance.cxx               |    6 
 vcl/source/font/fontmetric.cxx                 |    6 
 vcl/source/gdi/embeddedfontshelper.cxx         |    4 
 vcl/source/gdi/pdfbuildin_fonts.cxx            |    4 
 vcl/source/gdi/pdffontcache.cxx                |    8 
 vcl/source/gdi/pdfwriter_impl.cxx              |   18 -
 vcl/source/gdi/salgdilayout.cxx                |    4 
 vcl/source/gdi/sallayout.cxx                   |    6 
 vcl/unx/generic/gdi/font.cxx                   |    6 
 vcl/unx/generic/gdi/freetypetextrender.cxx     |    8 
 vcl/unx/generic/glyphs/freetype_glyphcache.cxx |    4 
 vcl/unx/generic/glyphs/glyphcache.cxx          |    2 
 vcl/unx/generic/print/genpspgraphics.cxx       |    9 
 vcl/win/gdi/salfont.cxx                        |   25 +-
 vcl/win/gdi/winlayout.cxx                      |    5 
 59 files changed, 516 insertions(+), 170 deletions(-)

New commits:
commit c817a5a4958c323eb189e1374072998b8b13ba8c
Author:     Chris Sherlock <chris.sherloc...@gmail.com>
AuthorDate: Sun Sep 12 14:41:19 2021 +1000
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Tue Oct 5 18:11:01 2021 +0200

    vcl: test PhysicalFontFace and move to vcl::font namespace
    
    - moved PhysicalFontFace.hxx to vcl/inc/font
    - added PhysicalFontFace to vcl::font namespace
    - had to regenerate precompiled_vcl.hxx
    - tested PhysicalFontFace, with some extensive tests for
      IsBetterMatch()
    
    Change-Id: I860022ac244f8a827f6f9cb7ed9018c5d9c328cb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121970
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx
index 7d5ddfd055fa..a89e8eedfb0c 100644
--- a/include/vcl/metric.hxx
+++ b/include/vcl/metric.hxx
@@ -28,7 +28,7 @@
 #include <vcl/font.hxx>
 
 class FontCharMap;
-class PhysicalFontFace;
+namespace vcl::font { class PhysicalFontFace; }
 
 typedef tools::SvRef<FontCharMap> FontCharMapRef;
 
@@ -37,7 +37,7 @@ class VCL_DLLPUBLIC FontMetric : public vcl::Font
 public:
     explicit            FontMetric();
                         FontMetric( const FontMetric& );  // TODO make this 
explicit
-                        FontMetric(PhysicalFontFace const& rFace);
+                        FontMetric(vcl::font::PhysicalFontFace const& rFace);
                         ~FontMetric() override;
 
     tools::Long                GetAscent() const                           { 
return mnAscent; }
diff --git a/include/vcl/vcllayout.hxx b/include/vcl/vcllayout.hxx
index 3b6254869f1b..34acb2fe733e 100644
--- a/include/vcl/vcllayout.hxx
+++ b/include/vcl/vcllayout.hxx
@@ -24,13 +24,14 @@
 #include <basegfx/polygon/b2dpolypolygon.hxx>
 #include <tools/gen.hxx>
 #include <tools/degree.hxx>
+
 #include <vcl/devicecoordinate.hxx>
 #include <vcl/glyphitem.hxx>
 #include <vcl/dllapi.h>
 
 class LogicalFontInstance;
 namespace vcl::text { class ImplLayoutArgs; }
-class PhysicalFontFace;
+namespace vcl::font { class PhysicalFontFace; }
 class SalGraphics;
 class GlyphItem;
 
@@ -93,7 +94,7 @@ public:
     // methods using glyph indexing
     virtual bool    GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int& 
nStart,
                                  const LogicalFontInstance** ppGlyphFont = 
nullptr,
-                                 const PhysicalFontFace** pFallbackFont = 
nullptr) const = 0;
+                                 const vcl::font::PhysicalFontFace** 
pFallbackFont = nullptr) const = 0;
     virtual bool GetOutline(basegfx::B2DPolyPolygonVector&) const;
     bool GetBoundRect(tools::Rectangle&) const;
 
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 6d590cd53040..9240bffc7064 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -14420,7 +14420,6 @@ vcl/headless/svpvd.cxx
 vcl/inc/IconThemeSelector.hxx
 vcl/inc/IPrioritable.hxx
 vcl/inc/PhysicalFontCollection.hxx
-vcl/inc/PhysicalFontFace.hxx
 vcl/inc/PhysicalFontFamily.hxx
 vcl/inc/ResampleKernel.hxx
 vcl/inc/WidgetThemeLibraryTypes.hxx
@@ -14440,6 +14439,7 @@ vcl/inc/dndlistenercontainer.hxx
 vcl/inc/factory.hxx
 vcl/inc/fltcall.hxx
 vcl/inc/font/FontSelectPattern.hxx
+vcl/inc/font/PhysicalFontFace.hxx
 vcl/inc/fontattributes.hxx
 vcl/inc/fontinstance.hxx
 vcl/inc/fontsubset.hxx
@@ -14940,6 +14940,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/FontSelectPattern.cxx
 vcl/source/font/PhysicalFontCollection.cxx
 vcl/source/font/PhysicalFontFace.cxx
 vcl/source/font/PhysicalFontFamily.cxx
@@ -14949,7 +14950,6 @@ vcl/source/font/fontcache.cxx
 vcl/source/font/fontcharmap.cxx
 vcl/source/font/fontinstance.cxx
 vcl/source/font/fontmetric.cxx
-vcl/source/font/fontselect.cxx
 vcl/source/fontsubset/cff.cxx
 vcl/source/fontsubset/fontsubset.cxx
 vcl/source/fontsubset/list.cxx
diff --git a/vcl/CppunitTest_vcl_font.mk b/vcl/CppunitTest_vcl_font.mk
index 456468557056..5c9da11d4f19 100644
--- a/vcl/CppunitTest_vcl_font.mk
+++ b/vcl/CppunitTest_vcl_font.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_CppunitTest_set_include,vcl_font,\
 
 $(eval $(call gb_CppunitTest_add_exception_objects,vcl_font, \
        vcl/qa/cppunit/font \
+       vcl/qa/cppunit/physicalfontface \
        vcl/qa/cppunit/physicalfontfacecollection \
        vcl/qa/cppunit/physicalfontfamily \
 ))
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index abd645216ab4..5c410de75bb0 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -473,12 +473,12 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
     vcl/source/font/Feature \
     vcl/source/font/FeatureCollector \
     vcl/source/font/FeatureParser \
+    vcl/source/font/FontSelectPattern \
     vcl/source/font/OpenTypeFeatureDefinitionList \
     vcl/source/font/PhysicalFontCollection \
     vcl/source/font/PhysicalFontFace \
     vcl/source/font/PhysicalFontFamily \
     vcl/source/font/fontattributes \
-    vcl/source/font/fontselect \
     vcl/source/font/fontinstance \
     vcl/source/font/fontcache \
     vcl/source/font/fontcharmap \
diff --git a/vcl/headless/svptext.cxx b/vcl/headless/svptext.cxx
index 4f64c7469aff..3822bac4070c 100644
--- a/vcl/headless/svptext.cxx
+++ b/vcl/headless/svptext.cxx
@@ -65,7 +65,7 @@ bool SvpSalGraphics::AddTempDevFont( PhysicalFontCollection* 
pFontCollection,
 
 bool SvpSalGraphics::CreateFontSubset(
     const OUString& rToFile,
-    const PhysicalFontFace* pFont,
+    const vcl::font::PhysicalFontFace* pFont,
     const sal_GlyphId* pGlyphIds,
     const sal_uInt8* pEncoding,
     sal_Int32* pWidths,
@@ -75,7 +75,7 @@ bool SvpSalGraphics::CreateFontSubset(
     return m_aTextRenderImpl.CreateFontSubset(rToFile, pFont, pGlyphIds, 
pEncoding, pWidths, nGlyphCount, rInfo);
 }
 
-const void* SvpSalGraphics::GetEmbedFontData(const PhysicalFontFace* pFont, 
tools::Long* pDataLen)
+const void* SvpSalGraphics::GetEmbedFontData(const 
vcl::font::PhysicalFontFace* pFont, tools::Long* pDataLen)
 {
     return m_aTextRenderImpl.GetEmbedFontData(pFont, pDataLen);
 }
@@ -85,7 +85,7 @@ void SvpSalGraphics::FreeEmbedFontData( const void* pData, 
tools::Long nLen )
     m_aTextRenderImpl.FreeEmbedFontData(pData, nLen);
 }
 
-void SvpSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
+void SvpSalGraphics::GetGlyphWidths( const vcl::font::PhysicalFontFace* pFont,
                                    bool bVertical,
                                    std::vector< sal_Int32 >& rWidths,
                                    Ucs2UIntMap& rUnicodeEnc )
diff --git a/vcl/inc/PhysicalFontCollection.hxx 
b/vcl/inc/PhysicalFontCollection.hxx
index 79358d6a49ae..ee1fdad285c9 100644
--- a/vcl/inc/PhysicalFontCollection.hxx
+++ b/vcl/inc/PhysicalFontCollection.hxx
@@ -43,7 +43,7 @@ public:
                             ~PhysicalFontCollection();
 
     // fill the list with device font faces
-    void                    Add( PhysicalFontFace* );
+    void                    Add( vcl::font::PhysicalFontFace* );
     void                    Clear();
     int                     Count() const { return 
maPhysicalFontFamilies.size(); }
 
diff --git a/vcl/inc/font/FontSelectPattern.hxx 
b/vcl/inc/font/FontSelectPattern.hxx
index 077c1c941996..78be730130f1 100644
--- a/vcl/inc/font/FontSelectPattern.hxx
+++ b/vcl/inc/font/FontSelectPattern.hxx
@@ -36,6 +36,7 @@ class Size;
 
 namespace vcl::font
 {
+class PhysicalFontFace;
 
 class VCL_DLLPUBLIC FontSelectPattern : public FontAttributes
 {
diff --git a/vcl/inc/PhysicalFontFace.hxx b/vcl/inc/font/PhysicalFontFace.hxx
similarity index 97%
rename from vcl/inc/PhysicalFontFace.hxx
rename to vcl/inc/font/PhysicalFontFace.hxx
index c2743e4c1ca1..0fa71de0af44 100644
--- a/vcl/inc/PhysicalFontFace.hxx
+++ b/vcl/inc/font/PhysicalFontFace.hxx
@@ -28,7 +28,7 @@
 #include <vcl/dllapi.h>
 #include <vcl/fontcharmap.hxx>
 
-#include "fontattributes.hxx"
+#include <fontattributes.hxx>
 
 class LogicalFontInstance;
 struct FontMatchStatus;
@@ -44,6 +44,10 @@ struct FontCapabilities;
 class PhysicalFontFamily;
 }
 
+namespace vcl::font
+{
+class FontSelectPattern;
+
 struct FontMatchStatus
 {
 public:
@@ -53,7 +57,6 @@ public:
     const OUString*     mpTargetStyleName;
 };
 
-
 // TODO: no more direct access to members
 // TODO: get rid of height/width for scalable fonts
 // TODO: make cloning cheaper
@@ -80,6 +83,8 @@ protected:
     explicit PhysicalFontFace(const FontAttributes&);
 };
 
+}
+
 #endif // INCLUDED_VCL_INC_PHYSICALFONTFACE_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/font/PhysicalFontFaceCollection.hxx 
b/vcl/inc/font/PhysicalFontFaceCollection.hxx
index 9b4622690bfb..c9e3e64b6640 100644
--- a/vcl/inc/font/PhysicalFontFaceCollection.hxx
+++ b/vcl/inc/font/PhysicalFontFaceCollection.hxx
@@ -23,7 +23,7 @@
 
 #include <vcl/dllapi.h>
 
-#include <PhysicalFontFace.hxx>
+#include "PhysicalFontFace.hxx"
 
 #include <vector>
 
diff --git a/vcl/inc/font/PhysicalFontFamily.hxx 
b/vcl/inc/font/PhysicalFontFamily.hxx
index d807c4f648e5..a3c4d0b90a31 100644
--- a/vcl/inc/font/PhysicalFontFamily.hxx
+++ b/vcl/inc/font/PhysicalFontFamily.hxx
@@ -28,9 +28,6 @@
 
 #include <unotools/fontcfg.hxx>
 
-#include <PhysicalFontFace.hxx>
-
-class PhysicalFontFace;
 class PhysicalFontCollection;
 
 namespace vcl::font
@@ -59,6 +56,8 @@ struct typed_flags<vcl::font::FontTypeFaces> : 
is_typed_flags<vcl::font::FontTyp
 
 namespace vcl::font
 {
+class FontSelectPattern;
+class PhysicalFontFace;
 class PhysicalFontFaceCollection;
 
 class VCL_PLUGIN_PUBLIC PhysicalFontFamily
diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index fa8fcba15806..aad22017e0d4 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -48,7 +48,7 @@ class VCL_PLUGIN_PUBLIC LogicalFontInstance : public 
salhelper::SimpleReferenceO
 {
     // just declaring the factory function doesn't work AKA
     // friend LogicalFontInstance* PhysicalFontFace::CreateFontInstance(const 
FontSelectPattern&) const;
-    friend class PhysicalFontFace;
+    friend class vcl::font::PhysicalFontFace;
     friend class ImplFontCache;
 
 public: // TODO: make data members private
@@ -72,8 +72,8 @@ public: // TODO: make data members private
     double GetAverageWidthFactor() const { return m_nAveWidthFactor; }
     const vcl::font::FontSelectPattern& GetFontSelectPattern() const { return 
m_aFontSelData; }
 
-    const PhysicalFontFace* GetFontFace() const { return m_pFontFace.get(); }
-    PhysicalFontFace* GetFontFace() { return m_pFontFace.get(); }
+    const vcl::font::PhysicalFontFace* GetFontFace() const { return 
m_pFontFace.get(); }
+    vcl::font::PhysicalFontFace* GetFontFace() { return m_pFontFace.get(); }
     const ImplFontCache* GetFontCache() const { return mpFontCache; }
 
     bool GetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const;
@@ -85,7 +85,7 @@ public: // TODO: make data members private
     static inline void DecodeOpenTypeTag(const uint32_t nTableTag, char* 
pTagName);
 
 protected:
-    explicit LogicalFontInstance(const PhysicalFontFace&, const 
vcl::font::FontSelectPattern&);
+    explicit LogicalFontInstance(const vcl::font::PhysicalFontFace&, const 
vcl::font::FontSelectPattern&);
 
     virtual bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) 
const = 0;
 
@@ -103,7 +103,7 @@ private:
     const vcl::font::FontSelectPattern m_aFontSelData;
     hb_font_t* m_pHbFont;
     double m_nAveWidthFactor;
-    rtl::Reference<PhysicalFontFace> m_pFontFace;
+    rtl::Reference<vcl::font::PhysicalFontFace> m_pFontFace;
     std::optional<bool> m_xbIsGraphiteFont;
 };
 
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 7be2f35e2cc1..e7c0c884e20f 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -31,6 +31,7 @@
 #include <vcl/sysdata.hxx>
 #include <config_cairo_canvas.h>
 
+#include <font/PhysicalFontFace.hxx>
 #include <salgdi.hxx>
 #include <sallayout.hxx>
 #include "svpcairotextrender.hxx"
@@ -183,16 +184,16 @@ public:
     virtual void ClearDevFontCache() override;
     virtual bool            AddTempDevFont( PhysicalFontCollection*, const 
OUString& rFileURL, const OUString& rFontName ) override;
     virtual bool        CreateFontSubset( const OUString& rToFile,
-                                              const PhysicalFontFace*,
+                                              const 
vcl::font::PhysicalFontFace*,
                                               const sal_GlyphId* pGlyphIds,
                                               const sal_uInt8* pEncoding,
                                               sal_Int32* pWidths,
                                               int nGlyphs,
                                               FontSubsetInfo& rInfo
                                               ) override;
-    virtual const void*     GetEmbedFontData(const PhysicalFontFace*, 
tools::Long* pDataLen) override;
+    virtual const void*     GetEmbedFontData(const 
vcl::font::PhysicalFontFace*, tools::Long* pDataLen) override;
     virtual void            FreeEmbedFontData( const void* pData, tools::Long 
nDataLen ) override;
-    virtual void            GetGlyphWidths( const PhysicalFontFace*,
+    virtual void            GetGlyphWidths( const vcl::font::PhysicalFontFace*,
                                             bool bVertical,
                                             std::vector< sal_Int32 >& rWidths,
                                             Ucs2UIntMap& rUnicodeEnc ) 
override;
diff --git a/vcl/inc/outdev.h b/vcl/inc/outdev.h
index 85b4ca601ac7..c9185bcc23fb 100644
--- a/vcl/inc/outdev.h
+++ b/vcl/inc/outdev.h
@@ -25,8 +25,8 @@
 #include <tools/gen.hxx>
 #include <vcl/vclptr.hxx>
 
+#include "font/PhysicalFontFace.hxx"
 #include "fontinstance.hxx"
-#include "PhysicalFontFace.hxx"
 #include "impfontcache.hxx"
 
 class Size;
diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx
index b42d7e50c2f5..9fea18da7661 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-08-04 20:14:15 using:
+ Generated on 2021-09-21 16:33:04 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:
@@ -33,9 +33,11 @@
 #include <deque>
 #include <float.h>
 #include <functional>
+#include <hb.h>
 #include <initializer_list>
 #include <iomanip>
 #include <limits>
+#include <list>
 #include <map>
 #include <math.h>
 #include <memory>
@@ -52,7 +54,6 @@
 #include <unordered_map>
 #include <utility>
 #include <vector>
-#include <boost/functional/hash.hpp>
 #include <boost/math/special_functions/sinc.hpp>
 #include <boost/multi_array.hpp>
 #include <boost/property_tree/json_parser.hpp>
@@ -80,6 +81,7 @@
 #include <rtl/bootstrap.hxx>
 #include <rtl/byteseq.hxx>
 #include <rtl/character.hxx>
+#include <rtl/cipher.h>
 #include <rtl/crc.h>
 #include <rtl/digest.h>
 #include <rtl/instance.hxx>
@@ -129,8 +131,6 @@
 #include <basegfx/vector/b2enums.hxx>
 #include <basegfx/vector/b2ivector.hxx>
 #include <bitmap/BitmapWriteAccess.hxx>
-#include <com/sun/star/awt/Key.hpp>
-#include <com/sun/star/awt/KeyGroup.hpp>
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/datatransfer/DataFlavor.hpp>
 #include <com/sun/star/datatransfer/XTransferable2.hpp>
@@ -146,8 +146,13 @@
 #include <com/sun/star/embed/Aspects.hpp>
 #include <com/sun/star/frame/XTerminateListener.hpp>
 #include <com/sun/star/i18n/Calendar2.hpp>
+#include <com/sun/star/i18n/DirectionProperty.hpp>
+#include <com/sun/star/i18n/KCharacterType.hpp>
+#include <com/sun/star/i18n/NativeNumberXmlAttributes.hpp>
+#include <com/sun/star/i18n/ParseResult.hpp>
 #include <com/sun/star/i18n/TransliterationModules.hpp>
 #include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
+#include <com/sun/star/i18n/UnicodeScript.hpp>
 #include <com/sun/star/lang/DisposedException.hpp>
 #include <com/sun/star/lang/EventObject.hpp>
 #include <com/sun/star/lang/Locale.hpp>
@@ -190,10 +195,14 @@
 #include <cppuhelper/weak.hxx>
 #include <cppuhelper/weakagg.hxx>
 #include <cppuhelper/weakref.hxx>
+#include <font/FontSelectPattern.hxx>
+#include <font/PhysicalFontFace.hxx>
+#include <font/PhysicalFontFaceCollection.hxx>
 #include <i18nlangtag/lang.h>
 #include <i18nlangtag/languagetag.hxx>
 #include <i18nlangtag/mslangid.hxx>
 #include <i18nutil/i18nutildllapi.h>
+#include <i18nutil/transliteration.hxx>
 #include <o3tl/cow_wrapper.hxx>
 #include <o3tl/safeint.hxx>
 #include <o3tl/sorted_vector.hxx>
@@ -246,18 +255,20 @@
 #include <uno/any2.h>
 #include <uno/data.h>
 #include <uno/sequence2.h>
+#include <unotools/calendarwrapper.hxx>
 #include <unotools/configmgr.hxx>
 #include <unotools/localedatawrapper.hxx>
+#include <unotools/resmgr.hxx>
 #include <unotools/syslocale.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <unotools/unotoolsdllapi.h>
 #endif // PCH_LEVEL >= 3
 #if PCH_LEVEL >= 4
 #include <PhysicalFontCollection.hxx>
-#include <PhysicalFontFace.hxx>
 #include <accel.hxx>
 #include <brdwin.hxx>
 #include <configsettings.hxx>
+#include <drawmode.hxx>
 #include <fontattributes.hxx>
 #include <impglyphitem.hxx>
 #include <outdev.h>
@@ -303,6 +314,8 @@
 #include <vcl/dllapi.h>
 #include <vcl/dockwin.hxx>
 #include <vcl/event.hxx>
+#include <vcl/filter/SvmReader.hxx>
+#include <vcl/filter/SvmWriter.hxx>
 #include <vcl/fntstyle.hxx>
 #include <vcl/font.hxx>
 #include <vcl/formatter.hxx>
@@ -354,6 +367,7 @@
 #include <vcl/unohelp.hxx>
 #include <vcl/vclenum.hxx>
 #include <vcl/vclevent.hxx>
+#include <vcl/vcllayout.hxx>
 #include <vcl/vclptr.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/weld.hxx>
diff --git a/vcl/inc/pdf/pdfbuildin_fonts.hxx b/vcl/inc/pdf/pdfbuildin_fonts.hxx
index 88629be914c3..fbcc04a9e6fa 100644
--- a/vcl/inc/pdf/pdfbuildin_fonts.hxx
+++ b/vcl/inc/pdf/pdfbuildin_fonts.hxx
@@ -21,7 +21,7 @@
 
 #include <sal/config.h>
 
-#include <PhysicalFontFace.hxx>
+#include <font/PhysicalFontFace.hxx>
 #include <fontinstance.hxx>
 
 namespace vcl::pdf
@@ -52,12 +52,12 @@ class BuildinFontInstance final : public LogicalFontInstance
     bool ImplGetGlyphBoundRect(sal_GlyphId nID, tools::Rectangle& rRect, bool) 
const override;
 
 public:
-    BuildinFontInstance(const PhysicalFontFace&, const 
vcl::font::FontSelectPattern&);
+    BuildinFontInstance(const vcl::font::PhysicalFontFace&, const 
vcl::font::FontSelectPattern&);
 
     bool GetGlyphOutline(sal_GlyphId nId, basegfx::B2DPolyPolygon& rPoly, 
bool) const override;
 };
 
-class BuildinFontFace final : public PhysicalFontFace
+class BuildinFontFace final : public vcl::font::PhysicalFontFace
 {
     static const BuildinFont m_aBuildinFonts[14];
     const BuildinFont& mrBuildin;
diff --git a/vcl/inc/pdf/pdffontcache.hxx b/vcl/inc/pdf/pdffontcache.hxx
index 094652fefe89..a6b58d8e7b00 100644
--- a/vcl/inc/pdf/pdffontcache.hxx
+++ b/vcl/inc/pdf/pdffontcache.hxx
@@ -37,7 +37,7 @@ namespace vcl
             bool            m_bVertical;
             std::type_info* m_typeFontFace;
 
-            FontIdentifier( const PhysicalFontFace*, bool bVertical );
+            FontIdentifier( const vcl::font::PhysicalFontFace*, bool bVertical 
);
 
             // Less than needed for std::set and std::map
             bool operator<( const FontIdentifier& rRight ) const
@@ -60,11 +60,11 @@ namespace vcl
         std::vector< FontData >     m_aFonts;
         FontToIndexMap              m_aFontToIndex;
 
-        FontData& getFont( const PhysicalFontFace*, bool bVertical );
+        FontData& getFont( const vcl::font::PhysicalFontFace*, bool bVertical 
);
         public:
         PDFFontCache() {}
 
-        sal_Int32 getGlyphWidth( const PhysicalFontFace*, sal_GlyphId, bool 
bVertical, SalGraphics* );
+        sal_Int32 getGlyphWidth( const vcl::font::PhysicalFontFace*, 
sal_GlyphId, bool bVertical, SalGraphics* );
     };
 }
 
diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx
index 21c2b799654b..c3f63be2693d 100644
--- a/vcl/inc/pdf/pdfwriter_impl.hxx
+++ b/vcl/inc/pdf/pdfwriter_impl.hxx
@@ -64,7 +64,7 @@ class FontSubsetInfo;
 class ZCodec;
 class EncHashTransporter;
 struct BitStreamState;
-class PhysicalFontFace;
+namespace vcl::font { class PhysicalFontFace; }
 class SvStream;
 class SvMemoryStream;
 
@@ -721,8 +721,8 @@ private:
     std::vector< TilingEmit >           m_aTilings;
     std::vector< TransparencyEmit >     m_aTransparentObjects;
     /*  contains all font subsets in use */
-    std::map<const PhysicalFontFace*, FontSubset> m_aSubsets;
-    std::map<const PhysicalFontFace*, EmbedFont> m_aSystemFonts;
+    std::map<const vcl::font::PhysicalFontFace*, FontSubset> m_aSubsets;
+    std::map<const vcl::font::PhysicalFontFace*, EmbedFont> m_aSystemFonts;
     sal_Int32                           m_nNextFID;
     PDFFontCache                        m_aFontCache;
 
@@ -807,7 +807,7 @@ i12626
     void appendLiteralStringEncrypt( std::string_view rInString, const 
sal_Int32 nInObjectNumber, OStringBuffer& rOutBuffer );
 
     /* creates fonts and subsets that will be emitted later */
-    void registerGlyph(const GlyphItem* pGlyph, const PhysicalFontFace* pFont, 
const std::vector<sal_Ucs>& rCodeUnits, sal_uInt8& nMappedGlyph, sal_Int32& 
nMappedFontObject);
+    void registerGlyph(const GlyphItem* pGlyph, const 
vcl::font::PhysicalFontFace* pFont, const std::vector<sal_Ucs>& rCodeUnits, 
sal_uInt8& nMappedGlyph, sal_Int32& nMappedFontObject);
 
     /*  emits a text object according to the passed layout */
     /* TODO: remove rText as soon as SalLayout will change so that rText is 
not necessary anymore */
@@ -852,9 +852,9 @@ i12626
     /* writes a builtin font object and returns its objectid (or 0 in case of 
failure ) */
     sal_Int32 emitBuildinFont( const pdf::BuildinFontFace*, sal_Int32 nObject 
);
     /* writes a type1 system font object and returns its mapping from font ids 
to object ids (or 0 in case of failure ) */
-    std::map< sal_Int32, sal_Int32 > emitSystemFont( const PhysicalFontFace*, 
EmbedFont const & );
+    std::map< sal_Int32, sal_Int32 > emitSystemFont(const 
vcl::font::PhysicalFontFace*, EmbedFont const &);
     /* writes a font descriptor and returns its object id (or 0) */
-    sal_Int32 emitFontDescriptor( const PhysicalFontFace*, FontSubsetInfo 
const &, sal_Int32 nSubsetID, sal_Int32 nStream );
+    sal_Int32 emitFontDescriptor(const vcl::font::PhysicalFontFace*, 
FontSubsetInfo const &, sal_Int32 nSubsetID, sal_Int32 nStream);
     /* writes a ToUnicode cmap, returns the corresponding stream object */
     sal_Int32 createToUnicodeCMap( sal_uInt8 const * pEncoding, const sal_Ucs* 
pCodeUnits, const sal_Int32* pCodeUnitsPerGlyph,
                                    const sal_Int32* pEncToUnicodeIndex, int 
nGlyphs );
diff --git a/vcl/inc/qt5/QtFont.hxx b/vcl/inc/qt5/QtFont.hxx
index f2b250f33d18..237523e2d10a 100644
--- a/vcl/inc/qt5/QtFont.hxx
+++ b/vcl/inc/qt5/QtFont.hxx
@@ -37,7 +37,7 @@ class QtFont final : public QFont, public LogicalFontInstance
 
     virtual hb_font_t* ImplInitHbFont() override;
 
-    explicit QtFont(const PhysicalFontFace&, const 
vcl::font::FontSelectPattern&);
+    explicit QtFont(const vcl::font::PhysicalFontFace&, const 
vcl::font::FontSelectPattern&);
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/qt5/QtFontFace.hxx b/vcl/inc/qt5/QtFontFace.hxx
index 6089a18b38c2..5b0460443e90 100644
--- a/vcl/inc/qt5/QtFontFace.hxx
+++ b/vcl/inc/qt5/QtFontFace.hxx
@@ -22,7 +22,7 @@
 #include <sal/config.h>
 
 #include <vclpluginapi.h>
-#include <PhysicalFontFace.hxx>
+#include <font/PhysicalFontFace.hxx>
 
 #include <tools/ref.hxx>
 #include <vcl/fontcapabilities.hxx>
@@ -37,7 +37,7 @@ namespace vcl::font
 class FontSelectPattern;
 }
 
-class QtFontFace final : public PhysicalFontFace
+class QtFontFace final : public vcl::font::PhysicalFontFace
 {
 public:
     static QtFontFace* fromQFont(const QFont& rFont);
diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx
index db08f8418844..a285f07bb353 100644
--- a/vcl/inc/qt5/QtGraphics.hxx
+++ b/vcl/inc/qt5/QtGraphics.hxx
@@ -228,16 +228,17 @@ public:
     virtual void ClearDevFontCache() override;
     virtual bool AddTempDevFont(PhysicalFontCollection*, const OUString& 
rFileURL,
                                 const OUString& rFontName) override;
-    virtual bool CreateFontSubset(const OUString& rToFile, const 
PhysicalFontFace* pFont,
+    virtual bool CreateFontSubset(const OUString& rToFile, const 
vcl::font::PhysicalFontFace* pFont,
                                   const sal_GlyphId* pGlyphIds, const 
sal_uInt8* pEncoding,
                                   sal_Int32* pWidths, int nGlyphs,
                                   FontSubsetInfo& rInfo // out parameter
                                   ) override;
 
-    virtual const void* GetEmbedFontData(const PhysicalFontFace*, tools::Long* 
pDataLen) override;
+    virtual const void* GetEmbedFontData(const vcl::font::PhysicalFontFace*,
+                                         tools::Long* pDataLen) override;
     virtual void FreeEmbedFontData(const void* pData, tools::Long nDataLen) 
override;
 
-    virtual void GetGlyphWidths(const PhysicalFontFace*, bool bVertical,
+    virtual void GetGlyphWidths(const vcl::font::PhysicalFontFace*, bool 
bVertical,
                                 std::vector<sal_Int32>& rWidths, Ucs2UIntMap& 
rUnicodeEnc) override;
 
     virtual std::unique_ptr<GenericSalLayout> GetTextLayout(int 
nFallbackLevel) override;
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index ffffe7f9a1f5..4210499c52d9 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -44,7 +44,7 @@
 
 #include <fontinstance.hxx>
 #include <impfontmetricdata.hxx>
-#include <PhysicalFontFace.hxx>
+#include <font/PhysicalFontFace.hxx>
 #include <salgdi.hxx>
 
 #include <quartz/salgdicommon.hxx>
@@ -58,7 +58,7 @@ class FontAttributes;
 class XorEmulation;
 
 // CoreText-specific physically available font face
-class CoreTextFontFace : public PhysicalFontFace
+class CoreTextFontFace : public vcl::font::PhysicalFontFace
 {
 public:
                                     CoreTextFontFace( const FontAttributes&, 
sal_IntPtr nFontID );
@@ -102,7 +102,7 @@ public:
     bool mbFauxBold;
 
 private:
-    explicit CoreTextStyle(const PhysicalFontFace&, const 
vcl::font::FontSelectPattern&);
+    explicit CoreTextStyle(const vcl::font::PhysicalFontFace&, const 
vcl::font::FontSelectPattern&);
 
     hb_font_t* ImplInitHbFont() override;
     bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const 
override;
@@ -552,7 +552,7 @@ public:
     // implementation note: encoding 0 with glyph id 0 should be added 
implicitly
     // as "undefined character"
     virtual bool            CreateFontSubset( const OUString& rToFile,
-                                                  const PhysicalFontFace* 
pFont,
+                                                  const 
vcl::font::PhysicalFontFace* pFont,
                                                   const sal_GlyphId* pGlyphIds,
                                                   const sal_uInt8* pEncoding,
                                                   sal_Int32* pWidths,
@@ -564,12 +564,12 @@ public:
     // embeddable by GetDevFontList or NULL in case of error
     // parameters: pFont: describes the font in question
     //             pDataLen: out parameter, contains the byte length of the 
returned buffer
-    virtual const void*     GetEmbedFontData(const PhysicalFontFace*, 
tools::Long* pDataLen)
+    virtual const void*     GetEmbedFontData(const 
vcl::font::PhysicalFontFace*, tools::Long* pDataLen)
         override;
     // frees the font data again
     virtual void            FreeEmbedFontData( const void* pData, tools::Long 
nDataLen ) override;
 
-    virtual void            GetGlyphWidths( const PhysicalFontFace*,
+    virtual void            GetGlyphWidths( const vcl::font::PhysicalFontFace*,
                                             bool bVertical,
                                             std::vector< sal_Int32 >& rWidths,
                                             Ucs2UIntMap& rUnicodeEnc ) 
override;
@@ -582,7 +582,7 @@ public:
                             GetGraphicsData() const override;
 
 private:
-    static bool             GetRawFontData( const PhysicalFontFace* pFontData,
+    static bool             GetRawFontData( const vcl::font::PhysicalFontFace* 
pFontData,
                                 std::vector<unsigned char>& rBuffer,
                                 bool* pJustCFF );
 };
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 99b9a55eb855..3abfbd726eb4 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -38,7 +38,10 @@
 class PhysicalFontCollection;
 class SalBitmap;
 class FontAttributes;
-class PhysicalFontFace;
+namespace vcl::font {
+    class FontSelectPattern;
+    class PhysicalFontFace;
+}
 class SalLayout;
 namespace tools { class Rectangle; }
 class FontSubsetInfo;
@@ -173,7 +176,7 @@ public:
     // as "undefined character"
     virtual bool                CreateFontSubset(
                                     const OUString& rToFile,
-                                    const PhysicalFontFace* pFont,
+                                    const vcl::font::PhysicalFontFace* pFont,
                                     const sal_GlyphId* pGlyphIDs,
                                     const sal_uInt8* pEncoding,
                                     sal_Int32* pWidths,
@@ -184,7 +187,7 @@ public:
     // embeddable by GetDevFontList or NULL in case of error
     // parameters: pFont: describes the font in question
     //             pDataLen: out parameter, contains the byte length of the 
returned buffer
-    virtual const void*         GetEmbedFontData(const PhysicalFontFace* 
pFont, tools::Long* pDataLen) = 0;
+    virtual const void*         GetEmbedFontData(const 
vcl::font::PhysicalFontFace* pFont, tools::Long* pDataLen) = 0;
 
     // free the font data again
     virtual void                FreeEmbedFontData( const void* pData, 
tools::Long nDataLen ) = 0;
@@ -194,7 +197,7 @@ public:
     // between unicode and glyph id
     // leave widths vector and mapping untouched in case of failure
     virtual void                GetGlyphWidths(
-                                    const PhysicalFontFace* pFont,
+                                    const vcl::font::PhysicalFontFace* pFont,
                                     bool bVertical,
                                     std::vector< sal_Int32 >& rWidths,
                                     Ucs2UIntMap& rUnicodeEnc ) = 0;
@@ -648,7 +651,7 @@ protected:
     vcl::WidgetDrawInterface* forWidget() { return m_pWidgetDraw ? 
m_pWidgetDraw.get() : this; }
 
     static void GetGlyphWidths(const vcl::AbstractTrueTypeFont& rTTF,
-                               const PhysicalFontFace& rFontFace, bool 
bVertical,
+                               const vcl::font::PhysicalFontFace& rFontFace, 
bool bVertical,
                                std::vector<sal_Int32>& rWidths, Ucs2UIntMap& 
rUnicodeEnc);
 
     static bool CreateTTFfontSubset(vcl::AbstractTrueTypeFont& aTTF, const 
OString& rSysPath,
diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index a3b33b6b3bc1..8dc16d9021c1 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -45,10 +45,14 @@
 
 #define MAX_FALLBACK 16
 
-class PhysicalFontFace;
 class GenericSalLayout;
 class SalGraphics;
 enum class SalLayoutFlags;
+
+namespace vcl::font {
+    class PhysicalFontFace;
+}
+
 namespace vcl::text {
     class TextLayoutCache;
 }
@@ -62,7 +66,7 @@ public:
     void            GetCaretPositions(int nArraySize, tools::Long* 
pCaretXArray) const override;
     bool            GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int& 
nStart,
                                  const LogicalFontInstance** ppGlyphFont = 
nullptr,
-                                 const PhysicalFontFace** pFallbackFont = 
nullptr) const override;
+                                 const vcl::font::PhysicalFontFace** 
pFallbackFont = nullptr) const override;
     bool            GetOutline(basegfx::B2DPolyPolygonVector&) const override;
     bool            IsKashidaPosValid(int nCharPos) const override;
     SalLayoutGlyphs GetGlyphs() const final override;
@@ -119,7 +123,7 @@ public:
 
     bool            GetNextGlyph(const GlyphItem** pGlyph, Point& rPos, int& 
nStart,
                                  const LogicalFontInstance** ppGlyphFont = 
nullptr,
-                                 const PhysicalFontFace** pFallbackFont = 
nullptr) const override;
+                                 const vcl::font::PhysicalFontFace** 
pFallbackFont = nullptr) const override;
 
     const SalLayoutGlyphsImpl& GlyphsImpl() const { return m_GlyphItems; }
 
diff --git a/vcl/inc/textrender.hxx b/vcl/inc/textrender.hxx
index aa2057ba62c1..7d9718b790a3 100644
--- a/vcl/inc/textrender.hxx
+++ b/vcl/inc/textrender.hxx
@@ -26,7 +26,7 @@
 
 class ImplFontMetricData;
 class PhysicalFontCollection;
-class PhysicalFontFace;
+namespace vcl::font { class PhysicalFontFace; }
 
 class TextRenderImpl
 {
@@ -45,17 +45,17 @@ public:
     virtual bool                    AddTempDevFont( PhysicalFontCollection*, 
const OUString& rFileURL, const OUString& rFontName ) = 0;
     virtual bool                    CreateFontSubset(
                                         const OUString& rToFile,
-                                        const PhysicalFontFace*,
+                                        const vcl::font::PhysicalFontFace*,
                                         const sal_GlyphId* pGlyphIDs,
                                         const sal_uInt8* pEncoding,
                                         sal_Int32* pWidths,
                                         int nGlyphs,
                                         FontSubsetInfo& rInfo) = 0;
 
-    virtual const void*             GetEmbedFontData(const PhysicalFontFace*, 
tools::Long* pDataLen) = 0;
+    virtual const void*             GetEmbedFontData(const 
vcl::font::PhysicalFontFace*, tools::Long* pDataLen) = 0;
     virtual void                    FreeEmbedFontData( const void* pData, 
tools::Long nDataLen ) = 0;
     virtual void                    GetGlyphWidths(
-                                        const PhysicalFontFace*,
+                                        const vcl::font::PhysicalFontFace*,
                                         bool bVertical,
                                         std::vector< sal_Int32 >& rWidths,
                                         Ucs2UIntMap& rUnicodeEnc ) = 0;
diff --git a/vcl/inc/unx/cairotextrender.hxx b/vcl/inc/unx/cairotextrender.hxx
index 3879bf5d975d..c046b00c9e49 100644
--- a/vcl/inc/unx/cairotextrender.hxx
+++ b/vcl/inc/unx/cairotextrender.hxx
@@ -22,6 +22,8 @@
 
 #include <unx/freetypetextrender.hxx>
 
+class GenericSalLayout;
+class SalGraphics;
 typedef struct _cairo cairo_t;
 
 class VCL_DLLPUBLIC CairoTextRender : public FreeTypeTextRenderImpl
diff --git a/vcl/inc/unx/freetype_glyphcache.hxx 
b/vcl/inc/unx/freetype_glyphcache.hxx
index 285a1ddd4a2f..d7b71514cd69 100644
--- a/vcl/inc/unx/freetype_glyphcache.hxx
+++ b/vcl/inc/unx/freetype_glyphcache.hxx
@@ -22,7 +22,7 @@
 #include <sal/config.h>
 
 #include <unx/glyphcache.hxx>
-#include <PhysicalFontFace.hxx>
+#include <font/PhysicalFontFace.hxx>
 #include <fontinstance.hxx>
 #include <vcl/glyphitem.hxx>
 
@@ -92,7 +92,7 @@ private:
     mutable FontCharMapRef mxFontCharMap;
 };
 
-class FreetypeFontFace : public PhysicalFontFace
+class FreetypeFontFace : public vcl::font::PhysicalFontFace
 {
 private:
     FreetypeFontInfo*             mpFreetypeFontInfo;
@@ -100,7 +100,7 @@ private:
 public:
                             FreetypeFontFace( FreetypeFontInfo*, const 
FontAttributes& );
 
-    virtual rtl::Reference<LogicalFontInstance> CreateFontInstance( const 
vcl::font::FontSelectPattern& ) const override;
+    virtual rtl::Reference<LogicalFontInstance> CreateFontInstance(const 
vcl::font::FontSelectPattern&) const override;
     virtual sal_IntPtr      GetFontId() const override { return 
mpFreetypeFontInfo->GetFontId(); }
 
     FontCharMapRef GetFontCharMap() const override { return 
mpFreetypeFontInfo->GetFontCharMap(); }
@@ -121,7 +121,7 @@ class SAL_DLLPUBLIC_RTTI FreetypeFontInstance final : 
public LogicalFontInstance
     virtual hb_font_t* ImplInitHbFont() override;
     virtual bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) 
const override;
 
-    explicit FreetypeFontInstance(const PhysicalFontFace& rPFF, const 
vcl::font::FontSelectPattern& rFSP);
+    explicit FreetypeFontInstance(const vcl::font::PhysicalFontFace& rPFF, 
const vcl::font::FontSelectPattern& rFSP);
 
 public:
     virtual ~FreetypeFontInstance() override;
diff --git a/vcl/inc/unx/freetypetextrender.hxx 
b/vcl/inc/unx/freetypetextrender.hxx
index 7866f966a196..6b17a15db06f 100644
--- a/vcl/inc/unx/freetypetextrender.hxx
+++ b/vcl/inc/unx/freetypetextrender.hxx
@@ -49,17 +49,17 @@ public:
     virtual bool                AddTempDevFont( PhysicalFontCollection*, const 
OUString& rFileURL, const OUString& rFontName ) override;
     virtual bool                CreateFontSubset(
                                     const OUString& rToFile,
-                                    const PhysicalFontFace*,
+                                    const vcl::font::PhysicalFontFace*,
                                     const sal_GlyphId* pGlyphIDs,
                                     const sal_uInt8* pEncoding,
                                     sal_Int32* pWidths,
                                     int nGlyphs,
                                     FontSubsetInfo& rInfo) override;
 
-    virtual const void*         GetEmbedFontData(const PhysicalFontFace*, 
tools::Long* pDataLen) override;
+    virtual const void*         GetEmbedFontData(const 
vcl::font::PhysicalFontFace*, tools::Long* pDataLen) override;
     virtual void                FreeEmbedFontData( const void* pData, 
tools::Long nDataLen ) override;
     virtual void                GetGlyphWidths(
-                                    const PhysicalFontFace*,
+                                    const vcl::font::PhysicalFontFace*,
                                     bool bVertical,
                                     std::vector< sal_Int32 >& rWidths,
                                     Ucs2UIntMap& rUnicodeEnc ) override;
diff --git a/vcl/inc/unx/genpspgraphics.h b/vcl/inc/unx/genpspgraphics.h
index cc8c346b862c..977083b948c2 100644
--- a/vcl/inc/unx/genpspgraphics.h
+++ b/vcl/inc/unx/genpspgraphics.h
@@ -30,7 +30,7 @@
 
 #include <unx/GenPspGfxBackend.hxx>
 
-class PhysicalFontFace;
+namespace vcl::font { class PhysicalFontFace; }
 class PhysicalFontCollection;
 
 namespace psp { struct JobData; class PrinterGfx; }
@@ -93,15 +93,15 @@ public:
                                                   const OUString& rFontName);
 
     virtual bool            CreateFontSubset( const OUString& rToFile,
-                                              const PhysicalFontFace*,
+                                              const 
vcl::font::PhysicalFontFace*,
                                               const sal_GlyphId* pGlyphIDs,
                                               const sal_uInt8* pEncoding,
                                               sal_Int32* pWidths,
                                               int nGlyphs,
                                               FontSubsetInfo& rInfo ) override;
-    virtual const void*     GetEmbedFontData(const PhysicalFontFace*, 
tools::Long* pDataLen) override;
+    virtual const void*     GetEmbedFontData(const 
vcl::font::PhysicalFontFace*, tools::Long* pDataLen) override;
     virtual void            FreeEmbedFontData( const void* pData, tools::Long 
nDataLen ) override;
-    virtual void            GetGlyphWidths( const PhysicalFontFace*,
+    virtual void            GetGlyphWidths( const vcl::font::PhysicalFontFace*,
                                             bool bVertical,
                                             std::vector< sal_Int32 >& rWidths,
                                             Ucs2UIntMap& rUnicodeEnc ) 
override;
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index af6642010546..bc5653e05c41 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -51,7 +51,7 @@ class X11SalVirtualDevice;
 class X11SalGraphicsImpl;
 class X11SkiaSalVirtualDevice;
 class PhysicalFontCollection;
-class PhysicalFontFace;
+namespace vcl::font { class PhysicalFontFace; }
 class SalGraphicsImpl;
 class TextRenderImpl;
 
@@ -122,18 +122,18 @@ public:
 
     virtual bool                    CreateFontSubset(
                                         const OUString& rToFile,
-                                        const PhysicalFontFace*,
+                                        const vcl::font::PhysicalFontFace*,
                                         const sal_GlyphId* pGlyphIDs,
                                         const sal_uInt8* pEncoding,
                                         sal_Int32* pWidths,
                                         int nGlyphs,
                                         FontSubsetInfo& rInfo ) override;
 
-    virtual const void*             GetEmbedFontData(const PhysicalFontFace*, 
tools::Long* pDataLen) override;
+    virtual const void*             GetEmbedFontData(const 
vcl::font::PhysicalFontFace*, tools::Long* pDataLen) override;
     virtual void                    FreeEmbedFontData( const void* pData, 
tools::Long nDataLen ) override;
 
     virtual void                    GetGlyphWidths(
-                                        const PhysicalFontFace*,
+                                        const vcl::font::PhysicalFontFace*,
                                         bool bVertical,
                                         std::vector< sal_Int32 >& rWidths,
                                         Ucs2UIntMap& rUnicodeEnc ) override;
diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h
index 4ea2546b9ae3..f02eadf60c14 100644
--- a/vcl/inc/win/salgdi.h
+++ b/vcl/inc/win/salgdi.h
@@ -26,7 +26,7 @@
 #include <salgdi.hxx>
 #include <fontinstance.hxx>
 #include <fontattributes.hxx>
-#include <PhysicalFontFace.hxx>
+#include <font/PhysicalFontFace.hxx>
 #include <impfont.hxx>
 #include <vcl/fontcapabilities.hxx>
 #include <vcl/fontcharmap.hxx>
@@ -58,7 +58,7 @@ class ImplFontMetricData;
 #define PALRGB_TO_RGB(nPalRGB)      ((nPalRGB)&0x00ffffff)
 
 // win32 specific physically available font face
-class WinFontFace : public PhysicalFontFace
+class WinFontFace : public vcl::font::PhysicalFontFace
 {
 public:
     explicit                WinFontFace( const FontAttributes&,
@@ -174,7 +174,7 @@ private:
     void DeInitGraphics();
 
 public:
-    HFONT ImplDoSetFont(vcl::font::FontSelectPattern const & i_rFont, const 
PhysicalFontFace * i_pFontFace, HFONT& o_rOldFont);
+    HFONT ImplDoSetFont(vcl::font::FontSelectPattern const & i_rFont, const 
vcl::font::PhysicalFontFace * i_pFontFace, HFONT& o_rOldFont);
 
     HDC getHDC() const { return mhLocalDC; }
     void setHDC(HDC aNew);
@@ -364,7 +364,7 @@ public:
     // implementation note: encoding 0 with glyph id 0 should be added 
implicitly
     // as "undefined character"
     virtual bool            CreateFontSubset( const OUString& rToFile,
-                                              const PhysicalFontFace*,
+                                              const 
vcl::font::PhysicalFontFace*,
                                               const sal_GlyphId* pGlyphIDs,
                                               const sal_uInt8* pEncoding,
                                               sal_Int32* pWidths,
@@ -376,10 +376,10 @@ public:
     // embeddable by GetDevFontList or NULL in case of error
     // parameters: pFont: describes the font in question
     //             pDataLen: out parameter, contains the byte length of the 
returned buffer
-    virtual const void* GetEmbedFontData(const PhysicalFontFace*, tools::Long* 
pDataLen) override;
+    virtual const void* GetEmbedFontData(const vcl::font::PhysicalFontFace*, 
tools::Long* pDataLen) override;
     // frees the font data again
     virtual void            FreeEmbedFontData( const void* pData, tools::Long 
nDataLen ) override;
-    virtual void            GetGlyphWidths( const PhysicalFontFace*,
+    virtual void            GetGlyphWidths( const vcl::font::PhysicalFontFace*,
                                             bool bVertical,
                                             std::vector< sal_Int32 >& rWidths,
                                             Ucs2UIntMap& rUnicodeEnc ) 
override;
@@ -400,7 +400,7 @@ public:
 void    ImplUpdateSysColorEntries();
 int     ImplIsSysColorEntry( Color nColor );
 void    ImplGetLogFontFromFontSelect( const vcl::font::FontSelectPattern&,
-            const PhysicalFontFace*, LOGFONTW& );
+            const vcl::font::PhysicalFontFace*, LOGFONTW& );
 
 #define MAX_64KSALPOINTS    ((((sal_uInt16)0xFFFF)-8)/sizeof(POINTS))
 
diff --git a/vcl/qa/cppunit/fontmocks.hxx b/vcl/qa/cppunit/fontmocks.hxx
index 8f3ad6eba5f1..7367acab69ee 100644
--- a/vcl/qa/cppunit/fontmocks.hxx
+++ b/vcl/qa/cppunit/fontmocks.hxx
@@ -7,18 +7,20 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#pragma once
+
 #include <sal/config.h>
 
-#include <PhysicalFontFace.hxx>
+#include <font/FontSelectPattern.hxx>
+#include <font/PhysicalFontFace.hxx>
 #include <font/PhysicalFontFaceCollection.hxx>
 #include <fontattributes.hxx>
 #include <fontinstance.hxx>
-#include <font/FontSelectPattern.hxx>
 
 class TestFontInstance : public LogicalFontInstance
 {
 public:
-    TestFontInstance(PhysicalFontFace const& rFontFace,
+    TestFontInstance(vcl::font::PhysicalFontFace const& rFontFace,
                      vcl::font::FontSelectPattern const& rFontSelectPattern)
         : LogicalFontInstance(rFontFace, rFontSelectPattern)
     {
@@ -33,17 +35,17 @@ protected:
     bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const 
override { return true; }
 };
 
-class TestFontFace : public PhysicalFontFace
+class TestFontFace : public vcl::font::PhysicalFontFace
 {
 public:
     TestFontFace(sal_uIntPtr nId)
-        : PhysicalFontFace(FontAttributes())
+        : vcl::font::PhysicalFontFace(FontAttributes())
         , mnFontId(nId)
     {
     }
 
     TestFontFace(FontAttributes const& rFontAttributes, sal_uIntPtr nId)
-        : PhysicalFontFace(rFontAttributes)
+        : vcl::font::PhysicalFontFace(rFontAttributes)
         , mnFontId(nId)
     {
     }
diff --git a/vcl/qa/cppunit/physicalfontface.cxx 
b/vcl/qa/cppunit/physicalfontface.cxx
new file mode 100644
index 000000000000..30fe616c1cd0
--- /dev/null
+++ b/vcl/qa/cppunit/physicalfontface.cxx
@@ -0,0 +1,301 @@
+/* -*- 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 <tools/degree.hxx>
+
+#include <vcl/font.hxx>
+
+#include <font/PhysicalFontFace.hxx>
+#include <fontattributes.hxx>
+
+#include "fontmocks.hxx"
+
+#include <memory>
+
+const sal_IntPtr FONTID = 1;
+
+class VclPhysicalFontFaceTest : public test::BootstrapFixture
+{
+public:
+    VclPhysicalFontFaceTest()
+        : BootstrapFixture(true, false)
+    {
+    }
+
+    void testShouldCompareAsLesserFontFaceWithShorterWidth();
+    void testShouldCompareAsGreaterFontFaceWithLongerWidth();
+    void testShouldCompareAsLesserFontFaceWithLighterWeight();
+    void testShouldCompareAsGreaterFontFaceWithHeavierWeight();
+    void testShouldCompareAsLesserFontFaceWithLesserItalics();
+    void testShouldCompareAsGreaterFontFaceWithGreaterItalics();
+    void testShouldCompareAsGreaterFontFaceWitHigherAlphabeticalFamilyName();
+    void testShouldCompareAsGreaterFontFaceWitLesserAlphabeticalFamilyName();
+    void testShouldCompareAsGreaterFontFaceWithHigherAlphabeticalStyleName();
+    void testShouldCompareAsGreaterFontFaceWithLesserAlphabeticalStyleName();
+    void testShouldCompareAsSameFontFace();
+    void testMatchStatusValue();
+
+    CPPUNIT_TEST_SUITE(VclPhysicalFontFaceTest);
+    CPPUNIT_TEST(testShouldCompareAsLesserFontFaceWithShorterWidth);
+    CPPUNIT_TEST(testShouldCompareAsGreaterFontFaceWithLongerWidth);
+    CPPUNIT_TEST(testShouldCompareAsLesserFontFaceWithLighterWeight);
+    CPPUNIT_TEST(testShouldCompareAsGreaterFontFaceWithHeavierWeight);
+    CPPUNIT_TEST(testShouldCompareAsLesserFontFaceWithLesserItalics);
+    CPPUNIT_TEST(testShouldCompareAsGreaterFontFaceWithGreaterItalics);
+    
CPPUNIT_TEST(testShouldCompareAsGreaterFontFaceWitHigherAlphabeticalFamilyName);
+    
CPPUNIT_TEST(testShouldCompareAsGreaterFontFaceWitLesserAlphabeticalFamilyName);
+    
CPPUNIT_TEST(testShouldCompareAsGreaterFontFaceWithHigherAlphabeticalStyleName);
+    
CPPUNIT_TEST(testShouldCompareAsGreaterFontFaceWithLesserAlphabeticalStyleName);
+    CPPUNIT_TEST(testShouldCompareAsSameFontFace);
+    CPPUNIT_TEST(testMatchStatusValue);
+
+    CPPUNIT_TEST_SUITE_END();
+};
+
+void 
VclPhysicalFontFaceTest::testShouldCompareAsLesserFontFaceWithShorterWidth()
+{
+    FontAttributes aFontAttrsShorterWidth;
+    aFontAttrsShorterWidth.SetWidthType(WIDTH_CONDENSED);
+    rtl::Reference<TestFontFace> aTestedFontFace(new 
TestFontFace(aFontAttrsShorterWidth, FONTID));
+
+    FontAttributes aFontAttrsLongerWidth;
+    aFontAttrsLongerWidth.SetWidthType(WIDTH_NORMAL);
+    rtl::Reference<TestFontFace> aComparedToFontFace(
+        new TestFontFace(aFontAttrsLongerWidth, FONTID));
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1),
+                         
aTestedFontFace->CompareIgnoreSize(*aComparedToFontFace));
+}
+
+void 
VclPhysicalFontFaceTest::testShouldCompareAsGreaterFontFaceWithLongerWidth()
+{
+    FontAttributes aFontAttrsLongerWidth;
+    aFontAttrsLongerWidth.SetWidthType(WIDTH_NORMAL);
+    rtl::Reference<TestFontFace> aTestedFontFace(new 
TestFontFace(aFontAttrsLongerWidth, FONTID));
+
+    FontAttributes aFontAttrsShorterWidth;
+    aFontAttrsShorterWidth.SetWidthType(WIDTH_CONDENSED);
+    rtl::Reference<TestFontFace> aComparedToFontFace(
+        new TestFontFace(aFontAttrsShorterWidth, FONTID));
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1),
+                         
aTestedFontFace->CompareIgnoreSize(*aComparedToFontFace));
+}
+
+void 
VclPhysicalFontFaceTest::testShouldCompareAsLesserFontFaceWithLighterWeight()
+{
+    FontAttributes aFontAttrsLighterWeight;
+    aFontAttrsLighterWeight.SetWidthType(WIDTH_NORMAL);
+    aFontAttrsLighterWeight.SetWeight(WEIGHT_THIN);
+    rtl::Reference<TestFontFace> aTestedFontFace(new 
TestFontFace(aFontAttrsLighterWeight, FONTID));
+
+    FontAttributes aFontAttrsHeavierWeight;
+    aFontAttrsHeavierWeight.SetWeight(WEIGHT_BOLD);
+    aFontAttrsHeavierWeight.SetWidthType(WIDTH_NORMAL);
+    rtl::Reference<TestFontFace> aComparedToFontFace(
+        new TestFontFace(aFontAttrsHeavierWeight, FONTID));
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1),
+                         
aTestedFontFace->CompareIgnoreSize(*aComparedToFontFace));
+}
+
+void 
VclPhysicalFontFaceTest::testShouldCompareAsGreaterFontFaceWithHeavierWeight()
+{
+    FontAttributes aFontAttrsHeavierWeight;
+    aFontAttrsHeavierWeight.SetWidthType(WIDTH_NORMAL);
+    aFontAttrsHeavierWeight.SetWeight(WEIGHT_BOLD);
+    rtl::Reference<TestFontFace> aTestedFontFace(new 
TestFontFace(aFontAttrsHeavierWeight, FONTID));
+
+    FontAttributes aFontAttrsLighterWeight;
+    aFontAttrsLighterWeight.SetWidthType(WIDTH_NORMAL);
+    aFontAttrsLighterWeight.SetWeight(WEIGHT_THIN);
+    rtl::Reference<TestFontFace> aComparedToFontFace(
+        new TestFontFace(aFontAttrsLighterWeight, FONTID));
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1),
+                         
aTestedFontFace->CompareIgnoreSize(*aComparedToFontFace));
+}
+
+void 
VclPhysicalFontFaceTest::testShouldCompareAsLesserFontFaceWithLesserItalics()
+{
+    FontAttributes aFontAttrsLesserItalics;
+    aFontAttrsLesserItalics.SetWidthType(WIDTH_NORMAL);
+    aFontAttrsLesserItalics.SetWeight(WEIGHT_THIN);
+    rtl::Reference<TestFontFace> aTestedFontFace(new 
TestFontFace(aFontAttrsLesserItalics, FONTID));
+
+    FontAttributes aFontAttrsGreaterItalics;
+    aFontAttrsGreaterItalics.SetWeight(WEIGHT_BOLD);
+    aFontAttrsGreaterItalics.SetWidthType(WIDTH_NORMAL);
+    rtl::Reference<TestFontFace> aComparedToFontFace(
+        new TestFontFace(aFontAttrsGreaterItalics, FONTID));
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1),
+                         
aTestedFontFace->CompareIgnoreSize(*aComparedToFontFace));
+}
+
+void 
VclPhysicalFontFaceTest::testShouldCompareAsGreaterFontFaceWithGreaterItalics()
+{
+    FontAttributes aFontAttrsGreaterItalics;
+    aFontAttrsGreaterItalics.SetWidthType(WIDTH_NORMAL);
+    aFontAttrsGreaterItalics.SetWeight(WEIGHT_BOLD);
+    rtl::Reference<TestFontFace> aTestedFontFace(
+        new TestFontFace(aFontAttrsGreaterItalics, FONTID));
+
+    FontAttributes aFontAttrsLesserItalics;
+    aFontAttrsLesserItalics.SetWidthType(WIDTH_NORMAL);
+    aFontAttrsLesserItalics.SetWeight(WEIGHT_THIN);
+    rtl::Reference<TestFontFace> aComparedToFontFace(
+        new TestFontFace(aFontAttrsLesserItalics, FONTID));
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1),
+                         
aTestedFontFace->CompareIgnoreSize(*aComparedToFontFace));
+}
+
+void 
VclPhysicalFontFaceTest::testShouldCompareAsGreaterFontFaceWitHigherAlphabeticalFamilyName()
+{
+    FontAttributes aFontAttrs1;
+    aFontAttrs1.SetWidthType(WIDTH_NORMAL);
+    aFontAttrs1.SetWeight(WEIGHT_NORMAL);
+    aFontAttrs1.SetFamilyName("B family");
+    rtl::Reference<TestFontFace> aTestedFontFace(new TestFontFace(aFontAttrs1, 
FONTID));
+
+    FontAttributes aFontAttrs2;
+    aFontAttrs2.SetWidthType(WIDTH_NORMAL);
+    aFontAttrs2.SetWeight(WEIGHT_NORMAL);
+    aFontAttrs2.SetFamilyName("A Family");
+    rtl::Reference<TestFontFace> aComparedToFontFace(new 
TestFontFace(aFontAttrs2, FONTID));
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1),
+                         
aTestedFontFace->CompareIgnoreSize(*aComparedToFontFace));
+}
+
+void 
VclPhysicalFontFaceTest::testShouldCompareAsGreaterFontFaceWitLesserAlphabeticalFamilyName()
+{
+    FontAttributes aFontAttrs1;
+    aFontAttrs1.SetWidthType(WIDTH_NORMAL);
+    aFontAttrs1.SetWeight(WEIGHT_NORMAL);
+    aFontAttrs1.SetFamilyName("A family");
+    rtl::Reference<TestFontFace> aTestedFontFace(new TestFontFace(aFontAttrs1, 
FONTID));
+
+    FontAttributes aFontAttrs2;
+    aFontAttrs2.SetWidthType(WIDTH_NORMAL);
+    aFontAttrs2.SetWeight(WEIGHT_NORMAL);
+    aFontAttrs2.SetFamilyName("B Family");
+    rtl::Reference<TestFontFace> aComparedToFontFace(new 
TestFontFace(aFontAttrs2, FONTID));
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1),
+                         
aTestedFontFace->CompareIgnoreSize(*aComparedToFontFace));
+}
+
+void 
VclPhysicalFontFaceTest::testShouldCompareAsGreaterFontFaceWithHigherAlphabeticalStyleName()
+{
+    FontAttributes aFontAttrs1;
+    aFontAttrs1.SetWidthType(WIDTH_NORMAL);
+    aFontAttrs1.SetWeight(WEIGHT_NORMAL);
+    aFontAttrs1.SetFamilyName("DejaVu Sans");
+    aFontAttrs1.SetStyleName("B Style");
+    rtl::Reference<TestFontFace> aTestedFontFace(new TestFontFace(aFontAttrs1, 
FONTID));
+
+    FontAttributes aFontAttrs2;
+    aFontAttrs2.SetWidthType(WIDTH_NORMAL);
+    aFontAttrs2.SetWeight(WEIGHT_NORMAL);
+    aFontAttrs2.SetFamilyName("DejaVu Sans");
+    aFontAttrs2.SetStyleName("A Style");
+    rtl::Reference<TestFontFace> aComparedToFontFace(new 
TestFontFace(aFontAttrs2, FONTID));
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1),
+                         
aTestedFontFace->CompareIgnoreSize(*aComparedToFontFace));
+}
+
+void 
VclPhysicalFontFaceTest::testShouldCompareAsGreaterFontFaceWithLesserAlphabeticalStyleName()
+{
+    FontAttributes aFontAttrs1;
+    aFontAttrs1.SetWidthType(WIDTH_NORMAL);
+    aFontAttrs1.SetWeight(WEIGHT_NORMAL);
+    aFontAttrs1.SetFamilyName("DejaVu Sans");
+    aFontAttrs1.SetStyleName("A Style");
+    rtl::Reference<TestFontFace> aTestedFontFace(new TestFontFace(aFontAttrs1, 
FONTID));
+
+    FontAttributes aFontAttrs2;
+    aFontAttrs2.SetWidthType(WIDTH_NORMAL);
+    aFontAttrs2.SetWeight(WEIGHT_NORMAL);
+    aFontAttrs2.SetFamilyName("DejaVu Sans");
+    aFontAttrs2.SetStyleName("B Style");
+    rtl::Reference<TestFontFace> aComparedToFontFace(new 
TestFontFace(aFontAttrs2, FONTID));
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1),
+                         
aTestedFontFace->CompareIgnoreSize(*aComparedToFontFace));
+}
+
+void VclPhysicalFontFaceTest::testShouldCompareAsSameFontFace()
+{
+    FontAttributes aFontAttrs1;
+    aFontAttrs1.SetWidthType(WIDTH_NORMAL);
+    aFontAttrs1.SetWeight(WEIGHT_NORMAL);
+    aFontAttrs1.SetFamilyName("DejaVu Sans");
+    aFontAttrs1.SetStyleName("Style");
+    rtl::Reference<TestFontFace> aTestedFontFace(new TestFontFace(aFontAttrs1, 
FONTID));
+
+    FontAttributes aFontAttrs2;
+    aFontAttrs2.SetWidthType(WIDTH_NORMAL);
+    aFontAttrs2.SetWeight(WEIGHT_NORMAL);
+    aFontAttrs2.SetFamilyName("DejaVu Sans");
+    aFontAttrs2.SetStyleName("Style");
+    rtl::Reference<TestFontFace> aComparedToFontFace(new 
TestFontFace(aFontAttrs2, FONTID));
+
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0),
+                         
aTestedFontFace->CompareIgnoreSize(*aComparedToFontFace));
+}
+
+void VclPhysicalFontFaceTest::testMatchStatusValue()
+{
+    FontAttributes aFontAttrs;
+    aFontAttrs.SetFamilyName("DejaVu Sans");
+    aFontAttrs.SetStyleName("Book");
+    aFontAttrs.SetPitch(FontPitch::PITCH_VARIABLE);
+    aFontAttrs.SetWidthType(WIDTH_NORMAL);
+    aFontAttrs.SetWeight(WEIGHT_BOLD);
+    rtl::Reference<TestFontFace> aTestedFontFace(new TestFontFace(aFontAttrs, 
FONTID));
+
+    std::unique_ptr<OUString> pTargetStyleName(new OUString("Book"));
+    vcl::font::FontMatchStatus aFontMatchStatus = { 0, 0, 0, 
pTargetStyleName.get() };
+
+    vcl::Font aTestFont("DejaVu Sans", "Book", Size(0, 36));
+
+    vcl::font::FontSelectPattern aFSP(aTestFont, "DejaVu Sans", Size(0, 36), 
36, true);
+    aFSP.mbEmbolden = false;
+    aFSP.mnOrientation = Degree10(10);
+    aFSP.SetWeight(WEIGHT_BOLD);
+    aFSP.SetPitch(FontPitch::PITCH_VARIABLE);
+    aFSP.maTargetName = "DejaVu Sans";
+
+    const int EXPECTED_FAMILY = 240'000;
+    const int EXPECTED_STYLE = 120'000;
+    const int EXPECTED_PITCH = 20'000;
+    const int EXPECTED_WIDTHTYPE = 400;
+    const int EXPECTED_WEIGHT = 1'000;
+    const int EXPECTED_ITALIC = 900;
+    const int EXPECTED_ORIENTATION = 80;
+
+    const int EXPECTED_MATCH = EXPECTED_FAMILY + EXPECTED_STYLE + 
EXPECTED_PITCH
+                               + EXPECTED_WIDTHTYPE + EXPECTED_WEIGHT + 
EXPECTED_ITALIC
+                               + EXPECTED_ORIENTATION;
+
+    CPPUNIT_ASSERT(aTestedFontFace->IsBetterMatch(aFSP, aFontMatchStatus));
+    CPPUNIT_ASSERT_EQUAL(EXPECTED_MATCH, aFontMatchStatus.mnFaceMatch);
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(VclPhysicalFontFaceTest);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/qa/cppunit/physicalfontfacecollection.cxx 
b/vcl/qa/cppunit/physicalfontfacecollection.cxx
index 56f44d2b39b9..3a8cedde76d5 100644
--- a/vcl/qa/cppunit/physicalfontfacecollection.cxx
+++ b/vcl/qa/cppunit/physicalfontfacecollection.cxx
@@ -42,8 +42,8 @@ void VclPhysicalFontFaceCollectionTest::testShouldGetFontId()
     vcl::font::PhysicalFontFaceCollection aCollection;
     aCollection.Add(new TestFontFace(1988756));
 
-    rtl::Reference<PhysicalFontFace> pActual(new TestFontFace(1988756));
-    rtl::Reference<PhysicalFontFace> pExpected = aCollection.Get(0);
+    rtl::Reference<vcl::font::PhysicalFontFace> pActual(new 
TestFontFace(1988756));
+    rtl::Reference<vcl::font::PhysicalFontFace> pExpected = aCollection.Get(0);
 
     CPPUNIT_ASSERT_EQUAL(pExpected->GetFontId(), pActual->GetFontId());
     CPPUNIT_ASSERT_EQUAL(1, aCollection.Count());
diff --git a/vcl/qt5/QtFont.cxx b/vcl/qt5/QtFont.cxx
index 8079576f156f..a9d84e897c1b 100644
--- a/vcl/qt5/QtFont.cxx
+++ b/vcl/qt5/QtFont.cxx
@@ -120,7 +120,7 @@ static inline void applyStyle(QtFont& rFont, FontItalic 
eItalic)
     }
 }
 
-QtFont::QtFont(const PhysicalFontFace& rPFF, const 
vcl::font::FontSelectPattern& rFSP)
+QtFont::QtFont(const vcl::font::PhysicalFontFace& rPFF, const 
vcl::font::FontSelectPattern& rFSP)
     : LogicalFontInstance(rPFF, rFSP)
 {
     setFamily(toQString(rPFF.GetFamilyName()));
diff --git a/vcl/qt5/QtFontFace.cxx b/vcl/qt5/QtFontFace.cxx
index 0eb51bf850b6..ffe88f242835 100644
--- a/vcl/qt5/QtFontFace.cxx
+++ b/vcl/qt5/QtFontFace.cxx
@@ -39,7 +39,7 @@
 using namespace vcl;
 
 QtFontFace::QtFontFace(const QtFontFace& rSrc)
-    : PhysicalFontFace(rSrc)
+    : vcl::font::PhysicalFontFace(rSrc)
     , m_aFontId(rSrc.m_aFontId)
     , m_eFontIdType(rSrc.m_eFontIdType)
 {
diff --git a/vcl/qt5/QtGraphics_Text.cxx b/vcl/qt5/QtGraphics_Text.cxx
index 3f1e196d6d7a..457338888323 100644
--- a/vcl/qt5/QtGraphics_Text.cxx
+++ b/vcl/qt5/QtGraphics_Text.cxx
@@ -216,7 +216,8 @@ const sal_uInt8* QtTrueTypeFont::table(sal_uInt32 ord, 
sal_uInt32& size) const
 }
 }
 
-bool QtGraphics::CreateFontSubset(const OUString& rToFile, const 
PhysicalFontFace* pFontFace,
+bool QtGraphics::CreateFontSubset(const OUString& rToFile,
+                                  const vcl::font::PhysicalFontFace* pFontFace,
                                   const sal_GlyphId* pGlyphIds, const 
sal_uInt8* pEncoding,
                                   sal_Int32* pGlyphWidths, int nGlyphCount, 
FontSubsetInfo& rInfo)
 {
@@ -254,14 +255,15 @@ bool QtGraphics::CreateFontSubset(const OUString& 
rToFile, const PhysicalFontFac
                                             pGlyphIds, pEncoding, 
pGlyphWidths, nGlyphCount);
 }
 
-const void* QtGraphics::GetEmbedFontData(const PhysicalFontFace*, tools::Long* 
/*pDataLen*/)
+const void* QtGraphics::GetEmbedFontData(const vcl::font::PhysicalFontFace*,
+                                         tools::Long* /*pDataLen*/)
 {
     return nullptr;
 }
 
 void QtGraphics::FreeEmbedFontData(const void* /*pData*/, tools::Long 
/*nDataLen*/) {}
 
-void QtGraphics::GetGlyphWidths(const PhysicalFontFace* pFontFace, bool 
bVertical,
+void QtGraphics::GetGlyphWidths(const vcl::font::PhysicalFontFace* pFontFace, 
bool bVertical,
                                 std::vector<sal_Int32>& rWidths, Ucs2UIntMap& 
rUnicodeEnc)
 {
     const QtFontFace* pQtFontFace = static_cast<const QtFontFace*>(pFontFace);
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index 5a9a8f27e0d6..5e958f73c35a 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -46,7 +46,7 @@ static double toRadian(int nDegree)
     return nDegree * (M_PI / 1800.0);
 }
 
-CoreTextStyle::CoreTextStyle(const PhysicalFontFace& rPFF, const 
vcl::font::FontSelectPattern& rFSP)
+CoreTextStyle::CoreTextStyle(const vcl::font::PhysicalFontFace& rPFF, const 
vcl::font::FontSelectPattern& rFSP)
     : LogicalFontInstance(rPFF, rFSP)
     , mfFontStretch( 1.0 )
     , mfFontRotation( 0.0 )
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 3cfa39cc98fc..ab67e851612a 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -109,7 +109,7 @@ bool 
CoreTextGlyphFallbackSubstititution::FindFontSubstitute(vcl::font::FontSele
 }
 
 CoreTextFontFace::CoreTextFontFace( const FontAttributes& rDFA, sal_IntPtr 
nFontId )
-  : PhysicalFontFace( rDFA )
+  : vcl::font::PhysicalFontFace( rDFA )
   , mnFontId( nFontId )
   , mbFontCapabilitiesRead( false )
 {
@@ -556,7 +556,7 @@ static void FakeDirEntry( const char aTag[5], ByteCount 
nOfs, ByteCount nLen,
 
 // fake a TTF or CFF font as directly accessing font file is not possible
 // when only the fontid is known. This approach also handles *.font fonts.
-bool AquaSalGraphics::GetRawFontData( const PhysicalFontFace* pFontData,
+bool AquaSalGraphics::GetRawFontData( const vcl::font::PhysicalFontFace* 
pFontData,
                                       std::vector<unsigned char>& rBuffer, 
bool* pJustCFF )
 {
     const CoreTextFontFace* pMacFont = static_cast<const 
CoreTextFontFace*>(pFontData);
@@ -742,7 +742,7 @@ bool AquaSalGraphics::GetRawFontData( const 
PhysicalFontFace* pFontData,
     return true;
 }
 
-void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool 
bVertical,
+void AquaSalGraphics::GetGlyphWidths( const vcl::font::PhysicalFontFace* 
pFontData, bool bVertical,
     std::vector< sal_Int32 >& rGlyphWidths, Ucs2UIntMap& rUnicodeEnc )
 {
     rGlyphWidths.clear();
@@ -768,7 +768,7 @@ void AquaSalGraphics::GetGlyphWidths( const 
PhysicalFontFace* pFontData, bool bV
     ::CloseTTFont( pSftFont );
 }
 
-const void* AquaSalGraphics::GetEmbedFontData(const PhysicalFontFace*, 
tools::Long* /*pDataLen*/)
+const void* AquaSalGraphics::GetEmbedFontData(const 
vcl::font::PhysicalFontFace*, tools::Long* /*pDataLen*/)
 {
     return nullptr;
 }
diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index 4061aefb4a40..b4b24d4e5f4d 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -47,7 +47,7 @@
 using namespace vcl;
 
 bool AquaSalGraphics::CreateFontSubset( const OUString& rToFile,
-                                        const PhysicalFontFace* pFontData,
+                                        const vcl::font::PhysicalFontFace* 
pFontData,
                                         const sal_GlyphId* pGlyphIds, const 
sal_uInt8* pEncoding,
                                         sal_Int32* pGlyphWidths, const int 
nGlyphCount,
                                         FontSubsetInfo& rInfo )
diff --git a/vcl/source/font/fontselect.cxx 
b/vcl/source/font/FontSelectPattern.cxx
similarity index 99%
rename from vcl/source/font/fontselect.cxx
rename to vcl/source/font/FontSelectPattern.cxx
index 3ea89bde90e1..23e7673c8da2 100644
--- a/vcl/source/font/fontselect.cxx
+++ b/vcl/source/font/FontSelectPattern.cxx
@@ -20,10 +20,11 @@
 #include <sal/config.h>
 #include <o3tl/safeint.hxx>
 #include <tools/gen.hxx>
+
 #include <vcl/font.hxx>
 
-#include <PhysicalFontFace.hxx>
 #include <font/FontSelectPattern.hxx>
+#include <font/PhysicalFontFace.hxx>
 
 namespace vcl::font
 {
diff --git a/vcl/source/font/PhysicalFontCollection.cxx 
b/vcl/source/font/PhysicalFontCollection.cxx
index c97beb478c79..42dc11d303e2 100644
--- a/vcl/source/font/PhysicalFontCollection.cxx
+++ b/vcl/source/font/PhysicalFontCollection.cxx
@@ -276,7 +276,7 @@ vcl::font::PhysicalFontFamily* 
PhysicalFontCollection::GetGlyphFallbackFont( vcl
     return pFallbackData;
 }
 
-void PhysicalFontCollection::Add( PhysicalFontFace* pNewData )
+void PhysicalFontCollection::Add( vcl::font::PhysicalFontFace* pNewData )
 {
     OUString aSearchName = GetEnglishSearchFontName( pNewData->GetFamilyName() 
);
 
diff --git a/vcl/source/font/PhysicalFontFace.cxx 
b/vcl/source/font/PhysicalFontFace.cxx
index 7d278df9871d..6acfe3da1575 100644
--- a/vcl/source/font/PhysicalFontFace.cxx
+++ b/vcl/source/font/PhysicalFontFace.cxx
@@ -24,9 +24,12 @@
 #include <unotools/fontdefs.hxx>
 
 #include <fontattributes.hxx>
+
 #include <font/FontSelectPattern.hxx>
+#include <font/PhysicalFontFace.hxx>
 
-#include <PhysicalFontFace.hxx>
+namespace vcl::font
+{
 
 PhysicalFontFace::PhysicalFontFace( const FontAttributes& rDFA )
     : FontAttributes( rDFA )
@@ -176,5 +179,6 @@ bool PhysicalFontFace::IsBetterMatch( const 
vcl::font::FontSelectPattern& rFSD,
     rStatus.mnWidthMatch = nWidthMatch;
     return true;
 }
+}
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/vcl/source/font/fontcache.cxx b/vcl/source/font/fontcache.cxx
index 5e94441466b0..c125d49f0d1b 100644
--- a/vcl/source/font/fontcache.cxx
+++ b/vcl/source/font/fontcache.cxx
@@ -18,10 +18,11 @@
  */
 
 #include <sal/config.h>
+
 #include <sal/log.hxx>
 
 #include <PhysicalFontCollection.hxx>
-#include <PhysicalFontFace.hxx>
+#include <font/PhysicalFontFace.hxx>
 #include <font/PhysicalFontFamily.hxx>
 #include <fontinstance.hxx>
 #include <impfontcache.hxx>
@@ -143,7 +144,7 @@ rtl::Reference<LogicalFontInstance> 
ImplFontCache::GetFontInstance( PhysicalFont
 
     if( !pFontInstance && pFontFamily) // still no cache hit => create a new 
font instance
     {
-        PhysicalFontFace* pFontData = 
pFontFamily->FindBestFontFace(aFontSelData);
+        vcl::font::PhysicalFontFace* pFontData = 
pFontFamily->FindBestFontFace(aFontSelData);
 
         // create a new logical font instance from this physical font face
         pFontInstance = pFontData->CreateFontInstance( aFontSelData );
diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/fontinstance.cxx
index 672ac82e1bdb..49b0593ce592 100644
--- a/vcl/source/font/fontinstance.cxx
+++ b/vcl/source/font/fontinstance.cxx
@@ -22,9 +22,9 @@
 #include <hb-ot.h>
 #include <hb-graphite2.h>
 
+#include <font/PhysicalFontFace.hxx>
 #include <fontinstance.hxx>
 #include <impfontcache.hxx>
-#include <PhysicalFontFace.hxx>
 
 #include <o3tl/hash_combine.hxx>
 
@@ -45,7 +45,7 @@ namespace std
 }
 
 
-LogicalFontInstance::LogicalFontInstance(const PhysicalFontFace& rFontFace, 
const vcl::font::FontSelectPattern& rFontSelData )
+LogicalFontInstance::LogicalFontInstance(const vcl::font::PhysicalFontFace& 
rFontFace, const vcl::font::FontSelectPattern& rFontSelData )
     : mxFontMetric( new ImplFontMetricData( rFontSelData ))
     , mpConversion( nullptr )
     , mnLineHeight( 0 )
@@ -56,7 +56,7 @@ LogicalFontInstance::LogicalFontInstance(const 
PhysicalFontFace& rFontFace, cons
     , m_aFontSelData(rFontSelData)
     , m_pHbFont(nullptr)
     , m_nAveWidthFactor(1.0f)
-    , m_pFontFace(&const_cast<PhysicalFontFace&>(rFontFace))
+    , m_pFontFace(&const_cast<vcl::font::PhysicalFontFace&>(rFontFace))
 {
 }
 
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index 2e3859b1f941..000523941813 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -26,9 +26,9 @@
 #include <vcl/outdev.hxx>
 #include <sal/log.hxx>
 
-#include <PhysicalFontFace.hxx>
-#include <fontinstance.hxx>
 #include <font/FontSelectPattern.hxx>
+#include <font/PhysicalFontFace.hxx>
+#include <fontinstance.hxx>
 #include <impfontmetricdata.hxx>
 #include <sft.hxx>
 
@@ -53,7 +53,7 @@ FontMetric::FontMetric()
 
 FontMetric::FontMetric( const FontMetric& rFontMetric ) = default;
 
-FontMetric::FontMetric(PhysicalFontFace const& rFace)
+FontMetric::FontMetric(vcl::font::PhysicalFontFace const& rFace)
     : FontMetric()
 {
     SetFamilyName(rFace.GetFamilyName());
diff --git a/vcl/source/gdi/embeddedfontshelper.cxx 
b/vcl/source/gdi/embeddedfontshelper.cxx
index ebcedb45b6a4..03c80ccb885b 100644
--- a/vcl/source/gdi/embeddedfontshelper.cxx
+++ b/vcl/source/gdi/embeddedfontshelper.cxx
@@ -260,12 +260,12 @@ OUString EmbeddedFontsHelper::fontFileUrl( 
std::u16string_view familyName, FontF
     PhysicalFontCollection fonts;
     graphics->GetDevFontList( &fonts );
     std::unique_ptr< vcl::font::PhysicalFontFaceCollection > fontInfo( 
fonts.GetFontFaceCollection());
-    PhysicalFontFace* selected = nullptr;
+    vcl::font::PhysicalFontFace* selected = nullptr;
     for( int i = 0;
          i < fontInfo->Count();
          ++i )
     {
-        PhysicalFontFace* f = fontInfo->Get( i );
+        vcl::font::PhysicalFontFace* f = fontInfo->Get( i );
         if( f->GetFamilyName() == familyName )
         {
             // Ignore comparing text encodings, at least for now. They cannot 
be trivially compared
diff --git a/vcl/source/gdi/pdfbuildin_fonts.cxx 
b/vcl/source/gdi/pdfbuildin_fonts.cxx
index 688b608de2e1..d6504c5c0fb7 100644
--- a/vcl/source/gdi/pdfbuildin_fonts.cxx
+++ b/vcl/source/gdi/pdfbuildin_fonts.cxx
@@ -731,7 +731,7 @@ const BuildinFont BuildinFontFace::m_aBuildinFonts[14]
 
       };
 
-BuildinFontInstance::BuildinFontInstance(const PhysicalFontFace& rFontFace,
+BuildinFontInstance::BuildinFontInstance(const vcl::font::PhysicalFontFace& 
rFontFace,
                                          const vcl::font::FontSelectPattern& 
rFSP)
     : LogicalFontInstance(rFontFace, rFSP)
 {
@@ -748,7 +748,7 @@ bool BuildinFontInstance::GetGlyphOutline(sal_GlyphId, 
basegfx::B2DPolyPolygon&,
 }
 
 BuildinFontFace::BuildinFontFace(int nId)
-    : PhysicalFontFace(m_aBuildinFonts[nId].GetFontAttributes())
+    : vcl::font::PhysicalFontFace(m_aBuildinFonts[nId].GetFontAttributes())
     , mrBuildin(m_aBuildinFonts[nId])
 {
 }
diff --git a/vcl/source/gdi/pdffontcache.cxx b/vcl/source/gdi/pdffontcache.cxx
index dadcb03048e2..e4646f8777bd 100644
--- a/vcl/source/gdi/pdffontcache.cxx
+++ b/vcl/source/gdi/pdffontcache.cxx
@@ -21,7 +21,7 @@
 
 #include <sal/types.h>
 
-#include <PhysicalFontFace.hxx>
+#include <font/PhysicalFontFace.hxx>
 #include <pdf/pdffontcache.hxx>
 #include <salgdi.hxx>
 
@@ -29,14 +29,14 @@
 
 using namespace vcl;
 
-PDFFontCache::FontIdentifier::FontIdentifier( const PhysicalFontFace* pFont, 
bool bVertical ) :
+PDFFontCache::FontIdentifier::FontIdentifier( const 
vcl::font::PhysicalFontFace* pFont, bool bVertical ) :
     m_nFontId( pFont->GetFontId() ),
     m_bVertical( bVertical ),
     m_typeFontFace( const_cast<std::type_info*>(&typeid(pFont)) )
 {
 }
 
-PDFFontCache::FontData& PDFFontCache::getFont( const PhysicalFontFace* pFont, 
bool bVertical )
+PDFFontCache::FontData& PDFFontCache::getFont( const 
vcl::font::PhysicalFontFace* pFont, bool bVertical )
 {
     FontIdentifier aId( pFont, bVertical );
     FontToIndexMap::iterator it = m_aFontToIndex.find( aId );
@@ -47,7 +47,7 @@ PDFFontCache::FontData& PDFFontCache::getFont( const 
PhysicalFontFace* pFont, bo
     return m_aFonts.back();
 }
 
-sal_Int32 PDFFontCache::getGlyphWidth( const PhysicalFontFace* pFont, 
sal_GlyphId nGlyph, bool bVertical, SalGraphics* pGraphics )
+sal_Int32 PDFFontCache::getGlyphWidth( const vcl::font::PhysicalFontFace* 
pFont, sal_GlyphId nGlyph, bool bVertical, SalGraphics* pGraphics )
 {
     sal_Int32 nWidth = 0;
     FontData& rFontData( getFont( pFont, bVertical ) );
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 6b02a6d384fc..7718cbd39f9c 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -72,7 +72,7 @@
 #include <svdata.hxx>
 #include <bitmap/BitmapWriteAccess.hxx>
 #include <fontsubset.hxx>
-#include <PhysicalFontFace.hxx>
+#include <font/PhysicalFontFace.hxx>
 #include <salgdi.hxx>
 #include <textlayout.hxx>
 #include <textlineinfo.hxx>
@@ -2310,7 +2310,7 @@ sal_Int32 PDFWriterImpl::emitBuildinFont(const 
pdf::BuildinFontFace* pFD, sal_In
     return nFontObject;
 }
 
-std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const 
PhysicalFontFace* pFont, EmbedFont const & rEmbed )
+std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const 
vcl::font::PhysicalFontFace* pFont, EmbedFont const & rEmbed )
 {
     std::map< sal_Int32, sal_Int32 > aRet;
 
@@ -2549,7 +2549,7 @@ sal_Int32 PDFWriterImpl::createToUnicodeCMap( sal_uInt8 
const * pEncoding,
     return nStream;
 }
 
-sal_Int32 PDFWriterImpl::emitFontDescriptor( const PhysicalFontFace* pFont, 
FontSubsetInfo const & rInfo, sal_Int32 nSubsetID, sal_Int32 nFontStream )
+sal_Int32 PDFWriterImpl::emitFontDescriptor( const 
vcl::font::PhysicalFontFace* pFont, FontSubsetInfo const & rInfo, sal_Int32 
nSubsetID, sal_Int32 nFontStream )
 {
     OStringBuffer aLine( 1024 );
     // get font flags, see PDF reference 1.4 p. 358
@@ -2854,7 +2854,7 @@ bool PDFWriterImpl::emitFonts()
             }
             else
             {
-                const PhysicalFontFace* pFont = subset.first;
+                const vcl::font::PhysicalFontFace* pFont = subset.first;
                 OStringBuffer aErrorComment( 256 );
                 aErrorComment.append( "CreateFontSubset failed for font \"" );
                 aErrorComment.append( OUStringToOString( 
pFont->GetFamilyName(), RTL_TEXTENCODING_UTF8 ) );
@@ -3889,7 +3889,7 @@ void PDFWriterImpl::createDefaultCheckBoxAppearance( 
PDFWidget& rBox, const PDFW
     FontCharMapRef pMap;
     GetFontCharMap(pMap);
     const LogicalFontInstance* pFontInstance = GetFontInstance();
-    const PhysicalFontFace* pDevFont = pFontInstance->GetFontFace();
+    const vcl::font::PhysicalFontFace* pDevFont = pFontInstance->GetFontFace();
     Pop();
 
     // make sure OpenSymbol is embedded, and includes our checkmark
@@ -5676,7 +5676,7 @@ sal_Int32 PDFWriterImpl::getSystemFont( const vcl::Font& 
i_rFont )
 
     SetFont( i_rFont );
 
-    const PhysicalFontFace* pDevFont = GetFontInstance()->GetFontFace();
+    const vcl::font::PhysicalFontFace* pDevFont = 
GetFontInstance()->GetFontFace();
     sal_Int32 nFontID = 0;
     auto it = m_aSystemFonts.find( pDevFont );
     if( it != m_aSystemFonts.end() )
@@ -5693,7 +5693,7 @@ sal_Int32 PDFWriterImpl::getSystemFont( const vcl::Font& 
i_rFont )
 }
 
 void PDFWriterImpl::registerGlyph(const GlyphItem* pGlyph,
-                                  const PhysicalFontFace* pFont,
+                                  const vcl::font::PhysicalFontFace* pFont,
                                   const std::vector<sal_Ucs>& rCodeUnits,
                                   sal_uInt8& nMappedGlyph,
                                   sal_Int32& nMappedFontObject)
@@ -6123,9 +6123,9 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const 
OUString& rText, bool
     }
 
     FontMetric aRefDevFontMetric = GetFontMetric();
-    const PhysicalFontFace* pDevFont = GetFontInstance()->GetFontFace();
+    const vcl::font::PhysicalFontFace* pDevFont = 
GetFontInstance()->GetFontFace();
     const GlyphItem* pGlyph = nullptr;
-    const PhysicalFontFace* pFallbackFont = nullptr;
+    const vcl::font::PhysicalFontFace* pFallbackFont = nullptr;
 
     // collect the glyphs into a single array
     std::vector< PDFGlyph > aGlyphs;
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index 9a327dd5312f..aafa8f157e70 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -22,7 +22,7 @@
 #include <memory>
 #include <config_features.h>
 #include <sal/log.hxx>
-#include <PhysicalFontFace.hxx>
+#include <font/PhysicalFontFace.hxx>
 #include <fontsubset.hxx>
 #include <salgdi.hxx>
 #include <salframe.hxx>
@@ -885,7 +885,7 @@ OUString SalGraphics::getRenderBackendName() const
 }
 
 void SalGraphics::GetGlyphWidths(const vcl::AbstractTrueTypeFont& rTTF,
-                                 const PhysicalFontFace& rFontFace, const bool 
bVertical,
+                                 const vcl::font::PhysicalFontFace& rFontFace, 
const bool bVertical,
                                  std::vector<sal_Int32>& rWidths, Ucs2UIntMap& 
rUnicodeEnc)
 {
     rWidths.clear();
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 445e2cddba07..bdd6deaaa49e 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -493,7 +493,7 @@ sal_Int32 GenericSalLayout::GetTextBreak( DeviceCoordinate 
nMaxWidth, DeviceCoor
 bool GenericSalLayout::GetNextGlyph(const GlyphItem** pGlyph,
                                     Point& rPos, int& nStart,
                                     const LogicalFontInstance** ppGlyphFont,
-                                    const PhysicalFontFace**) const
+                                    const vcl::font::PhysicalFontFace**) const
 {
     std::vector<GlyphItem>::const_iterator pGlyphIter = m_GlyphItems.begin();
     std::vector<GlyphItem>::const_iterator pGlyphIterEnd = m_GlyphItems.end();
@@ -1107,7 +1107,7 @@ void MultiSalLayout::GetCaretPositions( int nMaxIndex, 
tools::Long* pCaretXArray
 bool MultiSalLayout::GetNextGlyph(const GlyphItem** pGlyph,
                                   Point& rPos, int& nStart,
                                   const LogicalFontInstance** ppGlyphFont,
-                                  const PhysicalFontFace** pFallbackFont) const
+                                  const vcl::font::PhysicalFontFace** 
pFallbackFont) const
 {
     // NOTE: nStart is tagged with current font index
     int nLevel = static_cast<unsigned>(nStart) >> GF_FONTSHIFT;
@@ -1116,7 +1116,7 @@ bool MultiSalLayout::GetNextGlyph(const GlyphItem** 
pGlyph,
     {
         GenericSalLayout& rLayout = *mpLayouts[ nLevel ];
         rLayout.InitFont();
-        const PhysicalFontFace* pFontFace = rLayout.GetFont().GetFontFace();
+        const vcl::font::PhysicalFontFace* pFontFace = 
rLayout.GetFont().GetFontFace();
         if (rLayout.GetNextGlyph(pGlyph, rPos, nStart, ppGlyphFont))
         {
             int nFontTag = nLevel << GF_FONTSHIFT;
diff --git a/vcl/unx/generic/gdi/font.cxx b/vcl/unx/generic/gdi/font.cxx
index 36618829279c..bc56b56286c5 100644
--- a/vcl/unx/generic/gdi/font.cxx
+++ b/vcl/unx/generic/gdi/font.cxx
@@ -83,7 +83,7 @@ std::unique_ptr<GenericSalLayout> 
X11SalGraphics::GetTextLayout(int nFallbackLev
 
 bool X11SalGraphics::CreateFontSubset(
                                    const OUString& rToFile,
-                                   const PhysicalFontFace* pFont,
+                                   const vcl::font::PhysicalFontFace* pFont,
                                    const sal_GlyphId* pGlyphIds,
                                    const sal_uInt8* pEncoding,
                                    sal_Int32* pWidths,
@@ -95,7 +95,7 @@ bool X11SalGraphics::CreateFontSubset(
             pGlyphIds, pEncoding, pWidths, nGlyphCount, rInfo);
 }
 
-const void* X11SalGraphics::GetEmbedFontData(const PhysicalFontFace* pFont, 
tools::Long* pDataLen)
+const void* X11SalGraphics::GetEmbedFontData(const 
vcl::font::PhysicalFontFace* pFont, tools::Long* pDataLen)
 {
     return mxTextRenderImpl->GetEmbedFontData(pFont, pDataLen);
 }
@@ -105,7 +105,7 @@ void X11SalGraphics::FreeEmbedFontData( const void* pData, 
tools::Long nLen )
     mxTextRenderImpl->FreeEmbedFontData(pData, nLen);
 }
 
-void X11SalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
+void X11SalGraphics::GetGlyphWidths( const vcl::font::PhysicalFontFace* pFont,
                                    bool bVertical,
                                    std::vector< sal_Int32 >& rWidths,
                                    Ucs2UIntMap& rUnicodeEnc )
diff --git a/vcl/unx/generic/gdi/freetypetextrender.cxx 
b/vcl/unx/generic/gdi/freetypetextrender.cxx
index 9f66c5f5f536..2b39d8787605 100644
--- a/vcl/unx/generic/gdi/freetypetextrender.cxx
+++ b/vcl/unx/generic/gdi/freetypetextrender.cxx
@@ -33,7 +33,7 @@
 #include <unx/glyphcache.hxx>
 #include <unx/fc_fontoptions.hxx>
 #include <unx/freetype_glyphcache.hxx>
-#include <PhysicalFontFace.hxx>
+#include <font/PhysicalFontFace.hxx>
 #include <impfontmetricdata.hxx>
 
 #include <sallayout.hxx>
@@ -157,7 +157,7 @@ std::unique_ptr<GenericSalLayout> 
FreeTypeTextRenderImpl::GetTextLayout(int nFal
 
 bool FreeTypeTextRenderImpl::CreateFontSubset(
                                    const OUString& rToFile,
-                                   const PhysicalFontFace* pFont,
+                                   const vcl::font::PhysicalFontFace* pFont,
                                    const sal_GlyphId* pGlyphIds,
                                    const sal_uInt8* pEncoding,
                                    sal_Int32* pWidths,
@@ -183,7 +183,7 @@ bool FreeTypeTextRenderImpl::CreateFontSubset(
     return bSuccess;
 }
 
-const void* FreeTypeTextRenderImpl::GetEmbedFontData(const PhysicalFontFace* 
pFont, tools::Long* pDataLen)
+const void* FreeTypeTextRenderImpl::GetEmbedFontData(const 
vcl::font::PhysicalFontFace* pFont, tools::Long* pDataLen)
 {
     // in this context the pFont->GetFontId() is a valid PSP
     // font since they are the only ones left after the PDF
@@ -199,7 +199,7 @@ void FreeTypeTextRenderImpl::FreeEmbedFontData( const void* 
pData, tools::Long n
     GenPspGraphics::DoFreeEmbedFontData( pData, nLen );
 }
 
-void FreeTypeTextRenderImpl::GetGlyphWidths( const PhysicalFontFace* pFont,
+void FreeTypeTextRenderImpl::GetGlyphWidths( const 
vcl::font::PhysicalFontFace* pFont,
                                    bool bVertical,
                                    std::vector< sal_Int32 >& rWidths,
                                    Ucs2UIntMap& rUnicodeEnc )
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx 
b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index 77c1566727d4..645afddabc73 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -373,7 +373,7 @@ FreetypeFont* 
FreetypeManager::CreateFont(FreetypeFontInstance* pFontInstance)
     if (!pFontInstance)
         return nullptr;
 
-    const PhysicalFontFace* pFontFace = pFontInstance->GetFontFace();
+    const vcl::font::PhysicalFontFace* pFontFace = 
pFontInstance->GetFontFace();
     if (!pFontFace)
         return nullptr;
 
@@ -387,7 +387,7 @@ FreetypeFont* 
FreetypeManager::CreateFont(FreetypeFontInstance* pFontInstance)
 }
 
 FreetypeFontFace::FreetypeFontFace( FreetypeFontInfo* pFI, const 
FontAttributes& rDFA )
-:   PhysicalFontFace( rDFA ),
+:   vcl::font::PhysicalFontFace( rDFA ),
     mpFreetypeFontInfo( pFI )
 {
 }
diff --git a/vcl/unx/generic/glyphs/glyphcache.cxx 
b/vcl/unx/generic/glyphs/glyphcache.cxx
index ec2afc4db8f3..79db2d87bdb0 100644
--- a/vcl/unx/generic/glyphs/glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/glyphcache.cxx
@@ -66,7 +66,7 @@ FreetypeFontFile* FreetypeManager::FindFontFile(const 
OString& rNativeFileName)
     return pFontFile;
 }
 
-FreetypeFontInstance::FreetypeFontInstance(const PhysicalFontFace& rPFF, const 
vcl::font::FontSelectPattern& rFSP)
+FreetypeFontInstance::FreetypeFontInstance(const vcl::font::PhysicalFontFace& 
rPFF, const vcl::font::FontSelectPattern& rFSP)
     : LogicalFontInstance(rPFF, rFSP)
     , mxFreetypeFont(FreetypeManager::get().CreateFont(this))
 {
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx 
b/vcl/unx/generic/print/genpspgraphics.cxx
index 48b5ca8af32b..3ae0e8fa40af 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -46,8 +46,9 @@
 #include <fontinstance.hxx>
 #include <fontattributes.hxx>
 #include <impfontmetricdata.hxx>
+#include <font/FontSelectPattern.hxx>
 #include <PhysicalFontCollection.hxx>
-#include <PhysicalFontFace.hxx>
+#include <font/PhysicalFontFace.hxx>
 #include <sallayout.hxx>
 
 using namespace psp;
@@ -309,7 +310,7 @@ std::unique_ptr<GenericSalLayout> 
GenPspGraphics::GetTextLayout(int nFallbackLev
 
 bool GenPspGraphics::CreateFontSubset(
                                    const OUString& rToFile,
-                                   const PhysicalFontFace* pFont,
+                                   const vcl::font::PhysicalFontFace* pFont,
                                    const sal_GlyphId* pGlyphIds,
                                    const sal_uInt8* pEncoding,
                                    sal_Int32* pWidths,
@@ -335,7 +336,7 @@ bool GenPspGraphics::CreateFontSubset(
     return bSuccess;
 }
 
-void GenPspGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
+void GenPspGraphics::GetGlyphWidths( const vcl::font::PhysicalFontFace* pFont,
                                   bool bVertical,
                                   std::vector< sal_Int32 >& rWidths,
                                   Ucs2UIntMap& rUnicodeEnc )
@@ -504,7 +505,7 @@ void GenPspGraphics::FreeEmbedFontData( const void* pData, 
tools::Long nLen )
     DoFreeEmbedFontData( pData, nLen );
 }
 
-const void* GenPspGraphics::GetEmbedFontData(const PhysicalFontFace* pFont, 
tools::Long* pDataLen)
+const void* GenPspGraphics::GetEmbedFontData(const 
vcl::font::PhysicalFontFace* pFont, tools::Long* pDataLen)
 {
     // in this context the pFont->GetFontId() is a valid PSP
     // font since they are the only ones left after the PDF
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 6dd8365e6955..842f5ed8830f 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -51,11 +51,12 @@
 #include <vcl/fontcharmap.hxx>
 #include <comphelper/scopeguard.hxx>
 
+#include <font/FontSelectPattern.hxx>
 #include <fontsubset.hxx>
 #include <outdev.h>
 #include <font/PhysicalFontFaceCollection.hxx>
 #include <PhysicalFontCollection.hxx>
-#include <PhysicalFontFace.hxx>
+#include <font/PhysicalFontFace.hxx>
 #include <sft.hxx>
 #include <win/saldata.hxx>
 #include <win/salgdi.h>
@@ -180,13 +181,13 @@ public:
     bool FindFontSubstitute(vcl::font::FontSelectPattern&, 
LogicalFontInstance* pLogicalFont, OUString& rMissingChars) const override;
 private:
     HDC mhDC;
-    bool HasMissingChars(PhysicalFontFace*, OUString& rMissingChars) const;
+    bool HasMissingChars(vcl::font::PhysicalFontFace*, OUString& 
rMissingChars) const;
 };
 
 }
 
 // does a font face hold the given missing characters?
-bool WinGlyphFallbackSubstititution::HasMissingChars(PhysicalFontFace* pFace, 
OUString& rMissingChars) const
+bool 
WinGlyphFallbackSubstititution::HasMissingChars(vcl::font::PhysicalFontFace* 
pFace, OUString& rMissingChars) const
 {
     WinFontFace* pWinFont = static_cast< WinFontFace* >(pFace);
     FontCharMapRef xFontCharMap = pWinFont->GetFontCharMap();
@@ -303,7 +304,7 @@ bool 
WinGlyphFallbackSubstititution::FindFontSubstitute(vcl::font::FontSelectPat
     vcl::font::PhysicalFontFamily* pFontFamily = 
findDevFontListByLocale(*pFontCollection, aLanguageTag);
     if( pFontFamily )
     {
-        PhysicalFontFace* pFace = pFontFamily->FindBestFontFace( rFontSelData 
);
+        vcl::font::PhysicalFontFace* pFace = pFontFamily->FindBestFontFace( 
rFontSelData );
         if( HasMissingChars( pFace, rMissingChars ) )
         {
             rFontSelData.maSearchName = pFontFamily->GetSearchName();
@@ -319,7 +320,7 @@ bool 
WinGlyphFallbackSubstititution::FindFontSubstitute(vcl::font::FontSelectPat
                                                      rFontSelData.maSearchName 
);
     if( pFontFamily )
     {
-        PhysicalFontFace* pFace = pFontFamily->FindBestFontFace( rFontSelData 
);
+        vcl::font::PhysicalFontFace* pFace = pFontFamily->FindBestFontFace( 
rFontSelData );
         if( HasMissingChars( pFace, rMissingChars ) )
         {
             rFontSelData.maSearchName = pFontFamily->GetSearchName();
@@ -338,7 +339,7 @@ bool 
WinGlyphFallbackSubstititution::FindFontSubstitute(vcl::font::FontSelectPat
     bool bFound = false;
     for( int i = 0; i < nTestFontCount; ++i )
     {
-        PhysicalFontFace* pFace = pTestFontList->Get( i );
+        vcl::font::PhysicalFontFace* pFace = pTestFontList->Get( i );
         bFound = HasMissingChars( pFace, rMissingChars );
         if( !bFound )
             continue;
@@ -626,7 +627,7 @@ void ImplSalLogFontToFontW( HDC hDC, const LOGFONTW& 
rLogFont, Font& rFont )
 
 WinFontFace::WinFontFace( const FontAttributes& rDFS,
     BYTE eWinCharSet, BYTE nPitchAndFamily )
-:   PhysicalFontFace( rDFS ),
+:   vcl::font::PhysicalFontFace( rDFS ),
     mnId( 0 ),
     mbFontCapabilitiesRead( false ),
     meWinCharSet( eWinCharSet ),
@@ -762,7 +763,7 @@ void WinSalGraphics::SetTextColor( Color nColor )
 }
 
 void ImplGetLogFontFromFontSelect( const vcl::font::FontSelectPattern& rFont,
-                                   const PhysicalFontFace* pFontFace,
+                                   const vcl::font::PhysicalFontFace* 
pFontFace,
                                    LOGFONTW& rLogFont )
 {
     OUString aName;
@@ -811,7 +812,7 @@ void ImplGetLogFontFromFontSelect( const 
vcl::font::FontSelectPattern& rFont,
 }
 
 HFONT WinSalGraphics::ImplDoSetFont(vcl::font::FontSelectPattern const & 
i_rFont,
-                                    const PhysicalFontFace * i_pFontFace,
+                                    const vcl::font::PhysicalFontFace * 
i_pFontFace,
                                     HFONT& o_rOldFont)
 {
     HFONT hNewFont = nullptr;
@@ -1535,7 +1536,7 @@ SFErrCodes ScopedTrueTypeFont::open(void const * pBuffer, 
sal_uInt32 nLen,
 }
 
 bool WinSalGraphics::CreateFontSubset( const OUString& rToFile,
-    const PhysicalFontFace* pFont, const sal_GlyphId* pGlyphIds, const 
sal_uInt8* pEncoding,
+    const vcl::font::PhysicalFontFace* pFont, const sal_GlyphId* pGlyphIds, 
const sal_uInt8* pEncoding,
     sal_Int32* pGlyphWidths, int nGlyphCount, FontSubsetInfo& rInfo )
 {
     // TODO: use more of the central font-subsetting code, move stuff there if 
needed
@@ -1604,7 +1605,7 @@ bool WinSalGraphics::CreateFontSubset( const OUString& 
rToFile,
                                             pEncoding, pGlyphWidths, 
nGlyphCount);
 }
 
-const void* WinSalGraphics::GetEmbedFontData(const PhysicalFontFace* pFont, 
tools::Long* pDataLen)
+const void* WinSalGraphics::GetEmbedFontData(const 
vcl::font::PhysicalFontFace* pFont, tools::Long* pDataLen)
 {
     // create matching FontSelectPattern
     // we need just enough to get to the font file data
@@ -1630,7 +1631,7 @@ void WinSalGraphics::FreeEmbedFontData( const void* 
pData, tools::Long /*nLen*/
     delete[] static_cast<char const *>(pData);
 }
 
-void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
+void WinSalGraphics::GetGlyphWidths( const vcl::font::PhysicalFontFace* pFont,
                                      bool bVertical,
                                      std::vector< sal_Int32 >& rWidths,
                                      Ucs2UIntMap& rUnicodeEnc )
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index 749b9c96ec4f..0db736c256c0 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -163,7 +163,7 @@ struct BlobReference
 };
 }
 
-using BlobCacheKey = std::pair<rtl::Reference<PhysicalFontFace>, hb_tag_t>;
+using BlobCacheKey = std::pair<rtl::Reference<vcl::font::PhysicalFontFace>, 
hb_tag_t>;
 
 namespace
 {
@@ -189,7 +189,8 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, 
hb_tag_t nTableTag, void* pU
     assert(hDC);
     assert(hFont);
 
-    BlobCacheKey cacheKey{ 
rtl::Reference<PhysicalFontFace>(pFont->GetFontFace()), nTableTag };
+    BlobCacheKey cacheKey{ 
rtl::Reference<vcl::font::PhysicalFontFace>(pFont->GetFontFace()),
+                           nTableTag };
     auto it = gCache.find(cacheKey);
     if (it != gCache.end())
     {

Reply via email to