solenv/clang-format/excludelist | 2 - vcl/inc/PhysicalFontCollection.hxx | 4 +-- vcl/inc/PhysicalFontFace.hxx | 7 ++++-- vcl/inc/font/FontSelectPattern.hxx | 9 ++++++-- vcl/inc/font/PhysicalFontFamily.hxx | 2 - vcl/inc/fontinstance.hxx | 12 +++++------ vcl/inc/impfont.hxx | 2 - vcl/inc/impfontcache.hxx | 12 +++++------ vcl/inc/impfontmetricdata.hxx | 5 +++- vcl/inc/outdev.h | 5 ++-- vcl/inc/pdf/pdfbuildin_fonts.hxx | 4 +-- vcl/inc/pdf/pdfwriter_impl.hxx | 1 vcl/inc/qt5/Qt5Font.hxx | 4 +-- vcl/inc/qt5/Qt5FontFace.hxx | 5 +++- vcl/inc/quartz/salgdi.h | 6 ++--- vcl/inc/salgdi.hxx | 1 vcl/inc/skia/win/font.hxx | 2 - vcl/inc/unx/fontmanager.hxx | 5 +++- vcl/inc/unx/freetype_glyphcache.hxx | 6 ++--- vcl/inc/unx/glyphcache.hxx | 2 - vcl/inc/win/salgdi.h | 9 +++++--- vcl/inc/win/winlayout.hxx | 4 +-- vcl/qa/cppunit/fontmocks.hxx | 7 +++--- vcl/qt5/Qt5Font.cxx | 2 - vcl/qt5/Qt5FontFace.cxx | 4 +-- vcl/quartz/ctfonts.cxx | 4 +-- vcl/quartz/salgdi.cxx | 6 ++--- vcl/skia/osx/gdiimpl.cxx | 2 - vcl/skia/win/gdiimpl.cxx | 2 - vcl/skia/x11/textrender.cxx | 2 - vcl/source/font/PhysicalFontCollection.cxx | 8 +++---- vcl/source/font/PhysicalFontFace.cxx | 4 +-- vcl/source/font/PhysicalFontFamily.cxx | 2 - vcl/source/font/fontcache.cxx | 14 ++++++------- vcl/source/font/fontinstance.cxx | 2 - vcl/source/font/fontmetric.cxx | 4 +-- vcl/source/font/fontselect.cxx | 6 ++++- vcl/source/gdi/CommonSalLayout.cxx | 4 +-- vcl/source/gdi/pdfbuildin_fonts.cxx | 4 +-- vcl/source/outdev/font.cxx | 2 - vcl/source/outdev/text.cxx | 2 - vcl/unx/generic/fontmanager/fontconfig.cxx | 4 +-- vcl/unx/generic/fontmanager/fontsubst.cxx | 26 ++++++++++++------------- vcl/unx/generic/gdi/cairotextrender.cxx | 2 - vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 6 ++--- vcl/unx/generic/glyphs/glyphcache.cxx | 2 - vcl/unx/generic/print/genpspgraphics.cxx | 2 - vcl/win/gdi/salfont.cxx | 24 +++++++++++------------ vcl/win/gdi/winlayout.cxx | 6 ++--- 49 files changed, 142 insertions(+), 120 deletions(-)
New commits: commit 2f51bf35daa7d2e1612647e1768c443028e87c39 Author: Chris Sherlock <chris.sherloc...@gmail.com> AuthorDate: Sun Sep 26 08:17:26 2021 +1000 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Mon Sep 27 22:13:02 2021 +0200 vcl: move FontSelectPattern to own file and into vcl::font namespace Change-Id: I2f01a8e67c52ece9b434777203aa9fbc9ac8be02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122613 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 5e98016da5ec..674268f27c75 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -14440,9 +14440,9 @@ vcl/inc/dndeventdispatcher.hxx vcl/inc/dndlistenercontainer.hxx vcl/inc/factory.hxx vcl/inc/fltcall.hxx +vcl/inc/font/FontSelectPattern.hxx vcl/inc/fontattributes.hxx vcl/inc/fontinstance.hxx -vcl/inc/fontselect.hxx vcl/inc/fontsubset.hxx vcl/inc/graphic/UnoGraphic.hxx vcl/inc/graphic/UnoGraphicDescriptor.hxx diff --git a/vcl/inc/PhysicalFontCollection.hxx b/vcl/inc/PhysicalFontCollection.hxx index eca540dd9c55..79358d6a49ae 100644 --- a/vcl/inc/PhysicalFontCollection.hxx +++ b/vcl/inc/PhysicalFontCollection.hxx @@ -50,13 +50,13 @@ public: // find the device font family vcl::font::PhysicalFontFamily* FindFontFamily( const OUString& rFontName ) const; vcl::font::PhysicalFontFamily* FindOrCreateFontFamily( const OUString &rFamilyName ); - vcl::font::PhysicalFontFamily* FindFontFamily( FontSelectPattern& ) const; + vcl::font::PhysicalFontFamily* FindFontFamily( vcl::font::FontSelectPattern& ) const; vcl::font::PhysicalFontFamily* FindFontFamilyByTokenNames(const OUString& rTokenStr) const; vcl::font::PhysicalFontFamily* FindFontFamilyByAttributes(ImplFontAttrs nSearchType, FontWeight, FontWidth, FontItalic, const OUString& rSearchFamily) const; // suggest fonts for glyph fallback - vcl::font::PhysicalFontFamily* GetGlyphFallbackFont( FontSelectPattern&, + vcl::font::PhysicalFontFamily* GetGlyphFallbackFont( vcl::font::FontSelectPattern&, LogicalFontInstance* pLogicalFont, OUString& rMissingCodes, int nFallbackLevel ) const; diff --git a/vcl/inc/PhysicalFontFace.hxx b/vcl/inc/PhysicalFontFace.hxx index 476043921995..c2743e4c1ca1 100644 --- a/vcl/inc/PhysicalFontFace.hxx +++ b/vcl/inc/PhysicalFontFace.hxx @@ -32,7 +32,10 @@ class LogicalFontInstance; struct FontMatchStatus; +namespace vcl::font +{ class FontSelectPattern; +} class PhysicalFontFace; namespace vcl @@ -64,13 +67,13 @@ public: class VCL_PLUGIN_PUBLIC PhysicalFontFace : public FontAttributes, public salhelper::SimpleReferenceObject { public: - virtual rtl::Reference<LogicalFontInstance> CreateFontInstance(const FontSelectPattern&) const = 0; + virtual rtl::Reference<LogicalFontInstance> CreateFontInstance(const vcl::font::FontSelectPattern&) const = 0; virtual sal_IntPtr GetFontId() const = 0; virtual FontCharMapRef GetFontCharMap() const = 0; virtual bool GetFontCapabilities(vcl::FontCapabilities&) const = 0; - bool IsBetterMatch( const FontSelectPattern&, FontMatchStatus& ) const; + bool IsBetterMatch( const vcl::font::FontSelectPattern&, FontMatchStatus& ) const; sal_Int32 CompareIgnoreSize( const PhysicalFontFace& ) const; protected: diff --git a/vcl/inc/fontselect.hxx b/vcl/inc/font/FontSelectPattern.hxx similarity index 95% rename from vcl/inc/fontselect.hxx rename to vcl/inc/font/FontSelectPattern.hxx index 5a334ed75366..077c1c941996 100644 --- a/vcl/inc/fontselect.hxx +++ b/vcl/inc/font/FontSelectPattern.hxx @@ -21,9 +21,10 @@ #include <i18nlangtag/lang.h> #include <tools/degree.hxx> + #include <vcl/vclenum.hxx> -#include "fontattributes.hxx" +#include <fontattributes.hxx> #include <ostream> @@ -33,6 +34,9 @@ class LogicalFontInstance; class PhysicalFontFace; class Size; +namespace vcl::font +{ + class VCL_DLLPUBLIC FontSelectPattern : public FontAttributes { public: @@ -67,10 +71,11 @@ public: bool mbEmbolden; // Force emboldening ItalicMatrix maItalicMatrix; // Force matrix for slant }; +} template< typename charT, typename traits > inline std::basic_ostream<charT, traits> & operator <<( - std::basic_ostream<charT, traits> & stream, const FontSelectPattern & rFSP) + std::basic_ostream<charT, traits> & stream, const vcl::font::FontSelectPattern & rFSP) { stream << (rFSP.maTargetName.isEmpty() ? "<default>" : rFSP.maTargetName) << " (" << rFSP.maSearchName << ") w: " << rFSP.mnWidth << " h: " diff --git a/vcl/inc/font/PhysicalFontFamily.hxx b/vcl/inc/font/PhysicalFontFamily.hxx index 0d5436d3170b..d807c4f648e5 100644 --- a/vcl/inc/font/PhysicalFontFamily.hxx +++ b/vcl/inc/font/PhysicalFontFamily.hxx @@ -81,7 +81,7 @@ public: void AddFontFace(PhysicalFontFace*); - PhysicalFontFace* FindBestFontFace(const FontSelectPattern& rFSD) const; + PhysicalFontFace* FindBestFontFace(const vcl::font::FontSelectPattern& rFSD) const; void UpdateDevFontList(PhysicalFontFaceCollection&) const; void UpdateCloneFontList(PhysicalFontCollection&) const; diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx index e2a98f00ac77..fa8fcba15806 100644 --- a/vcl/inc/fontinstance.hxx +++ b/vcl/inc/fontinstance.hxx @@ -21,9 +21,6 @@ #include <sal/config.h> -#include "fontselect.hxx" -#include "impfontmetricdata.hxx" - #include <basegfx/polygon/b2dpolypolygon.hxx> #include <rtl/ref.hxx> #include <salhelper/simplereferenceobject.hxx> @@ -32,6 +29,9 @@ #include <tools/degree.hxx> #include <vcl/glyphitem.hxx> +#include "font/FontSelectPattern.hxx" +#include "impfontmetricdata.hxx" + #include <optional> #include <unordered_map> #include <memory> @@ -70,7 +70,7 @@ public: // TODO: make data members private bool IsGraphiteFont(); void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = std::abs(nFactor); } double GetAverageWidthFactor() const { return m_nAveWidthFactor; } - const FontSelectPattern& GetFontSelectPattern() const { return m_aFontSelData; } + const vcl::font::FontSelectPattern& GetFontSelectPattern() const { return m_aFontSelData; } const PhysicalFontFace* GetFontFace() const { return m_pFontFace.get(); } PhysicalFontFace* GetFontFace() { return m_pFontFace.get(); } @@ -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 FontSelectPattern&); + explicit LogicalFontInstance(const PhysicalFontFace&, const vcl::font::FontSelectPattern&); virtual bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const = 0; @@ -100,7 +100,7 @@ private: typedef ::std::unordered_map< ::std::pair<sal_UCS4,FontWeight>, OUString > UnicodeFallbackList; std::unique_ptr<UnicodeFallbackList> mpUnicodeFallbackList; mutable ImplFontCache * mpFontCache; - const FontSelectPattern m_aFontSelData; + const vcl::font::FontSelectPattern m_aFontSelData; hb_font_t* m_pHbFont; double m_nAveWidthFactor; rtl::Reference<PhysicalFontFace> m_pFontFace; diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx index 3f3b89f0e969..dc90f6d48bd5 100644 --- a/vcl/inc/impfont.hxx +++ b/vcl/inc/impfont.hxx @@ -28,8 +28,6 @@ #include <i18nlangtag/languagetag.hxx> #include <vcl/fntstyle.hxx> -#include "fontselect.hxx" - /* The following class is extraordinarily similar to FontAttributes. */ class ImplFont diff --git a/vcl/inc/impfontcache.hxx b/vcl/inc/impfontcache.hxx index f3d8736add41..72e7a44dc9a2 100644 --- a/vcl/inc/impfontcache.hxx +++ b/vcl/inc/impfontcache.hxx @@ -27,7 +27,7 @@ #include <tools/gen.hxx> #include <vcl/glyphitem.hxx> -#include "fontselect.hxx" +#include "font/FontSelectPattern.hxx" class Size; namespace vcl { class Font; } @@ -66,15 +66,15 @@ class ImplFontCache { private: // cache of recently used font instances - struct IFSD_Equal { bool operator()( const FontSelectPattern&, const FontSelectPattern& ) const; }; - struct IFSD_Hash { size_t operator()( const FontSelectPattern& ) const; }; - typedef o3tl::lru_map<FontSelectPattern, rtl::Reference<LogicalFontInstance>, IFSD_Hash, IFSD_Equal> FontInstanceList; + struct IFSD_Equal { bool operator()( const vcl::font::FontSelectPattern&, const vcl::font::FontSelectPattern& ) const; }; + struct IFSD_Hash { size_t operator()( const vcl::font::FontSelectPattern& ) const; }; + typedef o3tl::lru_map<vcl::font::FontSelectPattern, rtl::Reference<LogicalFontInstance>, IFSD_Hash, IFSD_Equal> FontInstanceList; LogicalFontInstance* mpLastHitCacheEntry; ///< keeps the last hit cache entry FontInstanceList maFontInstanceList; GlyphBoundRectCache m_aBoundRectCache; - rtl::Reference<LogicalFontInstance> GetFontInstance(PhysicalFontCollection const*, FontSelectPattern&); + rtl::Reference<LogicalFontInstance> GetFontInstance(PhysicalFontCollection const*, vcl::font::FontSelectPattern&); public: ImplFontCache(); @@ -82,7 +82,7 @@ public: rtl::Reference<LogicalFontInstance> GetFontInstance(PhysicalFontCollection const *, const vcl::Font&, const Size& rPixelSize, float fExactHeight, bool bNonAntialias = false); - rtl::Reference<LogicalFontInstance> GetGlyphFallbackFont( PhysicalFontCollection const *, FontSelectPattern&, + rtl::Reference<LogicalFontInstance> GetGlyphFallbackFont( PhysicalFontCollection const *, vcl::font::FontSelectPattern&, LogicalFontInstance* pLogicalFont, int nFallbackLevel, OUString& rMissingCodes ); diff --git a/vcl/inc/impfontmetricdata.hxx b/vcl/inc/impfontmetricdata.hxx index fb493e99eed3..bbba9330bd3b 100644 --- a/vcl/inc/impfontmetricdata.hxx +++ b/vcl/inc/impfontmetricdata.hxx @@ -33,13 +33,16 @@ class ImplFontMetricData; typedef tools::SvRef<ImplFontMetricData> ImplFontMetricDataRef; class OutputDevice; +namespace vcl::font +{ class FontSelectPattern; +} class LogicalFontInstance; class VCL_DLLPUBLIC ImplFontMetricData final : public FontAttributes, public SvRefBase { public: - explicit ImplFontMetricData( const FontSelectPattern& ); + explicit ImplFontMetricData( const vcl::font::FontSelectPattern& ); // font instance attributes from the font request tools::Long GetWidth() const { return mnWidth; } diff --git a/vcl/inc/outdev.h b/vcl/inc/outdev.h index 4e050cf52665..85b4ca601ac7 100644 --- a/vcl/inc/outdev.h +++ b/vcl/inc/outdev.h @@ -31,6 +31,7 @@ class Size; namespace vcl { class Font; } +namespace vcl::font { class FontSelectPattern; } class VirtualDevice; class PhysicalFontCollection; enum class AddFontSubstituteFlags; @@ -95,7 +96,7 @@ class ImplPreMatchFontSubstitution : public ImplFontSubstitution { public: - virtual bool FindFontSubstitute(FontSelectPattern&) const = 0; + virtual bool FindFontSubstitute(vcl::font::FontSelectPattern&) const = 0; }; // ImplGlyphFallbackFontSubstitution @@ -104,7 +105,7 @@ class ImplGlyphFallbackFontSubstitution : public ImplFontSubstitution { public: - virtual bool FindFontSubstitute(FontSelectPattern&, LogicalFontInstance* pLogicalFont, OUString& rMissingCodes) const = 0; + virtual bool FindFontSubstitute(vcl::font::FontSelectPattern&, LogicalFontInstance* pLogicalFont, OUString& rMissingCodes) const = 0; }; namespace vcl { struct ControlLayoutData; } diff --git a/vcl/inc/pdf/pdfbuildin_fonts.hxx b/vcl/inc/pdf/pdfbuildin_fonts.hxx index 0ca4f9bdc492..88629be914c3 100644 --- a/vcl/inc/pdf/pdfbuildin_fonts.hxx +++ b/vcl/inc/pdf/pdfbuildin_fonts.hxx @@ -52,7 +52,7 @@ class BuildinFontInstance final : public LogicalFontInstance bool ImplGetGlyphBoundRect(sal_GlyphId nID, tools::Rectangle& rRect, bool) const override; public: - BuildinFontInstance(const PhysicalFontFace&, const FontSelectPattern&); + BuildinFontInstance(const PhysicalFontFace&, const vcl::font::FontSelectPattern&); bool GetGlyphOutline(sal_GlyphId nId, basegfx::B2DPolyPolygon& rPoly, bool) const override; }; @@ -63,7 +63,7 @@ class BuildinFontFace final : public PhysicalFontFace const BuildinFont& mrBuildin; rtl::Reference<LogicalFontInstance> - CreateFontInstance(const FontSelectPattern& rFSD) const override; + CreateFontInstance(const vcl::font::FontSelectPattern& rFSD) const override; public: explicit BuildinFontFace(int nId); diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx index 598c124f36b9..3cef119c78c3 100644 --- a/vcl/inc/pdf/pdfwriter_impl.hxx +++ b/vcl/inc/pdf/pdfwriter_impl.hxx @@ -60,7 +60,6 @@ #include <pdf/pdffontcache.hxx> class StyleSettings; -class FontSelectPattern; class FontSubsetInfo; class ZCodec; class EncHashTransporter; diff --git a/vcl/inc/qt5/Qt5Font.hxx b/vcl/inc/qt5/Qt5Font.hxx index 33243538fcaf..3f7520e64c4c 100644 --- a/vcl/inc/qt5/Qt5Font.hxx +++ b/vcl/inc/qt5/Qt5Font.hxx @@ -30,14 +30,14 @@ class Qt5Font final : public QFont, public LogicalFontInstance { friend rtl::Reference<LogicalFontInstance> - Qt5FontFace::CreateFontInstance(const FontSelectPattern&) const; + Qt5FontFace::CreateFontInstance(const vcl::font::FontSelectPattern&) const; bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override; bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override; virtual hb_font_t* ImplInitHbFont() override; - explicit Qt5Font(const PhysicalFontFace&, const FontSelectPattern&); + explicit Qt5Font(const PhysicalFontFace&, const vcl::font::FontSelectPattern&); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/qt5/Qt5FontFace.hxx b/vcl/inc/qt5/Qt5FontFace.hxx index 4c2b654a8442..19ced75acca3 100644 --- a/vcl/inc/qt5/Qt5FontFace.hxx +++ b/vcl/inc/qt5/Qt5FontFace.hxx @@ -32,7 +32,10 @@ #include <QtGui/QFont> class FontAttributes; +namespace vcl::font +{ class FontSelectPattern; +} class Qt5FontFace final : public PhysicalFontFace { @@ -55,7 +58,7 @@ public: bool HasChar(sal_uInt32 cChar) const; rtl::Reference<LogicalFontInstance> - CreateFontInstance(const FontSelectPattern& rFSD) const override; + CreateFontInstance(const vcl::font::FontSelectPattern& rFSD) const override; private: typedef enum { Font, FontDB } FontIdType; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 270c6dd6a426..ffffe7f9a1f5 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -73,7 +73,7 @@ public: bool GetFontCapabilities(vcl::FontCapabilities&) const override; bool HasChar( sal_uInt32 cChar ) const; - rtl::Reference<LogicalFontInstance> CreateFontInstance(const FontSelectPattern&) const override; + rtl::Reference<LogicalFontInstance> CreateFontInstance(const vcl::font::FontSelectPattern&) const override; private: const sal_IntPtr mnFontId; @@ -84,7 +84,7 @@ private: class CoreTextStyle final : public LogicalFontInstance { - friend rtl::Reference<LogicalFontInstance> CoreTextFontFace::CreateFontInstance(const FontSelectPattern&) const; + friend rtl::Reference<LogicalFontInstance> CoreTextFontFace::CreateFontInstance(const vcl::font::FontSelectPattern&) const; public: ~CoreTextStyle() override; @@ -102,7 +102,7 @@ public: bool mbFauxBold; private: - explicit CoreTextStyle(const PhysicalFontFace&, const FontSelectPattern&); + explicit CoreTextStyle(const PhysicalFontFace&, const vcl::font::FontSelectPattern&); hb_font_t* ImplInitHbFont() override; bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override; diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 24ea4b3ebda7..99b9a55eb855 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -37,7 +37,6 @@ class PhysicalFontCollection; class SalBitmap; -class FontSelectPattern; class FontAttributes; class PhysicalFontFace; class SalLayout; diff --git a/vcl/inc/skia/win/font.hxx b/vcl/inc/skia/win/font.hxx index 2a746dc48e37..b63c5cba4730 100644 --- a/vcl/inc/skia/win/font.hxx +++ b/vcl/inc/skia/win/font.hxx @@ -20,7 +20,7 @@ class SkiaWinFontInstance : public WinFontInstance { friend rtl::Reference<LogicalFontInstance> - WinFontFace::CreateFontInstance(const FontSelectPattern&) const; + WinFontFace::CreateFontInstance(const vcl::font::FontSelectPattern&) const; public: sk_sp<SkTypeface> GetSkiaTypeface() const { return m_skiaTypeface; } diff --git a/vcl/inc/unx/fontmanager.hxx b/vcl/inc/unx/fontmanager.hxx index bd960f11109f..a4676a5a585c 100644 --- a/vcl/inc/unx/fontmanager.hxx +++ b/vcl/inc/unx/fontmanager.hxx @@ -44,7 +44,10 @@ class FontAttributes; class FontSubsetInfo; class FontConfigFontOptions; +namespace vcl::font +{ class FontSelectPattern; +} class GenericUnixSalData; namespace psp { @@ -320,7 +323,7 @@ public: static std::unique_ptr<FontConfigFontOptions> getFontOptions(const FontAttributes& rFontAttributes, int nSize); - void Substitute(FontSelectPattern &rPattern, OUString& rMissingCodes); + void Substitute(vcl::font::FontSelectPattern &rPattern, OUString& rMissingCodes); }; diff --git a/vcl/inc/unx/freetype_glyphcache.hxx b/vcl/inc/unx/freetype_glyphcache.hxx index 0f18d63091a9..285a1ddd4a2f 100644 --- a/vcl/inc/unx/freetype_glyphcache.hxx +++ b/vcl/inc/unx/freetype_glyphcache.hxx @@ -100,7 +100,7 @@ private: public: FreetypeFontFace( FreetypeFontInfo*, const FontAttributes& ); - virtual rtl::Reference<LogicalFontInstance> CreateFontInstance( const 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(); } @@ -114,14 +114,14 @@ bool FreetypeFontFace::GetFontCapabilities(vcl::FontCapabilities& rFontCapabilit class SAL_DLLPUBLIC_RTTI FreetypeFontInstance final : public LogicalFontInstance { - friend rtl::Reference<LogicalFontInstance> FreetypeFontFace::CreateFontInstance(const FontSelectPattern&) const; + friend rtl::Reference<LogicalFontInstance> FreetypeFontFace::CreateFontInstance(const vcl::font::FontSelectPattern&) const; std::unique_ptr<FreetypeFont> mxFreetypeFont; virtual hb_font_t* ImplInitHbFont() override; virtual bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override; - explicit FreetypeFontInstance(const PhysicalFontFace& rPFF, const FontSelectPattern& rFSP); + explicit FreetypeFontInstance(const PhysicalFontFace& rPFF, const vcl::font::FontSelectPattern& rFSP); public: virtual ~FreetypeFontInstance() override; diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx index 40f2d4636e1f..228351fbe046 100644 --- a/vcl/inc/unx/glyphcache.hxx +++ b/vcl/inc/unx/glyphcache.hxx @@ -136,7 +136,7 @@ public: // in starmath at a fairly low stretch ratio. This appears fixed in 2.9 with // https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=91015cb41d8f56777f93394f5a60914bc0c0f330 // "Improve complex rendering at high ppem" - static bool AlmostHorizontalDrainsRenderingPool(int nRatio, const FontSelectPattern& rFSD); + static bool AlmostHorizontalDrainsRenderingPool(int nRatio, const vcl::font::FontSelectPattern& rFSD); private: friend class FreetypeFontInstance; diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index ec7f4fe13fff..4ea2546b9ae3 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -43,7 +43,10 @@ #include <hb-ot.h> #include <dwrite.h> +namespace vcl::font +{ class FontSelectPattern; +} class WinFontInstance; class ImplFontAttrCache; class PhysicalFontCollection; @@ -63,7 +66,7 @@ public: BYTE nPitchAndFamily ); virtual ~WinFontFace() override; - virtual rtl::Reference<LogicalFontInstance> CreateFontInstance( const FontSelectPattern& ) const override; + virtual rtl::Reference<LogicalFontInstance> CreateFontInstance( const vcl::font::FontSelectPattern& ) const override; virtual sal_IntPtr GetFontId() const override; void SetFontId( sal_IntPtr nId ) { mnId = nId; } void UpdateFromHDC( HDC ) const; @@ -171,7 +174,7 @@ private: void DeInitGraphics(); public: - HFONT ImplDoSetFont(FontSelectPattern const & i_rFont, const PhysicalFontFace * i_pFontFace, HFONT& o_rOldFont); + HFONT ImplDoSetFont(vcl::font::FontSelectPattern const & i_rFont, const PhysicalFontFace * i_pFontFace, HFONT& o_rOldFont); HDC getHDC() const { return mhLocalDC; } void setHDC(HDC aNew); @@ -396,7 +399,7 @@ public: // Init/Deinit Graphics void ImplUpdateSysColorEntries(); int ImplIsSysColorEntry( Color nColor ); -void ImplGetLogFontFromFontSelect( const FontSelectPattern&, +void ImplGetLogFontFromFontSelect( const vcl::font::FontSelectPattern&, const PhysicalFontFace*, LOGFONTW& ); #define MAX_64KSALPOINTS ((((sal_uInt16)0xFFFF)-8)/sizeof(POINTS)) diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx index 57e25134a2c7..93aa0a3d00de 100644 --- a/vcl/inc/win/winlayout.hxx +++ b/vcl/inc/win/winlayout.hxx @@ -31,7 +31,7 @@ // win32 specific logical font instance class WinFontInstance : public LogicalFontInstance { - friend rtl::Reference<LogicalFontInstance> WinFontFace::CreateFontInstance(const FontSelectPattern&) const; + friend rtl::Reference<LogicalFontInstance> WinFontFace::CreateFontInstance(const vcl::font::FontSelectPattern&) const; public: ~WinFontInstance() override; @@ -55,7 +55,7 @@ public: bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const override; private: - explicit WinFontInstance(const WinFontFace&, const FontSelectPattern&); + explicit WinFontInstance(const WinFontFace&, const vcl::font::FontSelectPattern&); hb_font_t* ImplInitHbFont() override; bool ImplGetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const override; diff --git a/vcl/qa/cppunit/fontmocks.hxx b/vcl/qa/cppunit/fontmocks.hxx index 703f03957de6..8f3ad6eba5f1 100644 --- a/vcl/qa/cppunit/fontmocks.hxx +++ b/vcl/qa/cppunit/fontmocks.hxx @@ -13,12 +13,13 @@ #include <font/PhysicalFontFaceCollection.hxx> #include <fontattributes.hxx> #include <fontinstance.hxx> -#include <fontselect.hxx> +#include <font/FontSelectPattern.hxx> class TestFontInstance : public LogicalFontInstance { public: - TestFontInstance(PhysicalFontFace const& rFontFace, FontSelectPattern const& rFontSelectPattern) + TestFontInstance(PhysicalFontFace const& rFontFace, + vcl::font::FontSelectPattern const& rFontSelectPattern) : LogicalFontInstance(rFontFace, rFontSelectPattern) { } @@ -48,7 +49,7 @@ public: } rtl::Reference<LogicalFontInstance> - CreateFontInstance(FontSelectPattern const& rFontSelectPattern) const override + CreateFontInstance(vcl::font::FontSelectPattern const& rFontSelectPattern) const override { return new TestFontInstance(*this, rFontSelectPattern); } diff --git a/vcl/qt5/Qt5Font.cxx b/vcl/qt5/Qt5Font.cxx index 83d290bb7ff1..bbf99f92ef61 100644 --- a/vcl/qt5/Qt5Font.cxx +++ b/vcl/qt5/Qt5Font.cxx @@ -120,7 +120,7 @@ static inline void applyStyle(Qt5Font& rFont, FontItalic eItalic) } } -Qt5Font::Qt5Font(const PhysicalFontFace& rPFF, const FontSelectPattern& rFSP) +Qt5Font::Qt5Font(const PhysicalFontFace& rPFF, const vcl::font::FontSelectPattern& rFSP) : LogicalFontInstance(rPFF, rFSP) { setFamily(toQString(rPFF.GetFamilyName())); diff --git a/vcl/qt5/Qt5FontFace.cxx b/vcl/qt5/Qt5FontFace.cxx index e8f13c412e91..6168811daea8 100644 --- a/vcl/qt5/Qt5FontFace.cxx +++ b/vcl/qt5/Qt5FontFace.cxx @@ -28,7 +28,7 @@ #include <sft.hxx> #include <impfontcharmap.hxx> #include <fontinstance.hxx> -#include <fontselect.hxx> +#include <font/FontSelectPattern.hxx> #include <PhysicalFontCollection.hxx> #include <QtGui/QFont> @@ -185,7 +185,7 @@ QFont Qt5FontFace::CreateFont() const } rtl::Reference<LogicalFontInstance> -Qt5FontFace::CreateFontInstance(const FontSelectPattern& rFSD) const +Qt5FontFace::CreateFontInstance(const vcl::font::FontSelectPattern& rFSD) const { return new Qt5Font(*this, rFSD); } diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 56408f4f9891..5a9a8f27e0d6 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 FontSelectPattern& rFSP) +CoreTextStyle::CoreTextStyle(const PhysicalFontFace& rPFF, const vcl::font::FontSelectPattern& rFSP) : LogicalFontInstance(rPFF, rFSP) , mfFontStretch( 1.0 ) , mfFontRotation( 0.0 ) @@ -262,7 +262,7 @@ hb_font_t* CoreTextStyle::ImplInitHbFont() return InitHbFont(pHbFace); } -rtl::Reference<LogicalFontInstance> CoreTextFontFace::CreateFontInstance(const FontSelectPattern& rFSD) const +rtl::Reference<LogicalFontInstance> CoreTextFontFace::CreateFontInstance(const vcl::font::FontSelectPattern& rFSD) const { return new CoreTextStyle(*this, rFSD); } diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 358ae3881983..3cfa39cc98fc 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -70,12 +70,12 @@ class CoreTextGlyphFallbackSubstititution : public ImplGlyphFallbackFontSubstitution { public: - bool FindFontSubstitute(FontSelectPattern&, LogicalFontInstance* pLogicalFont, OUString&) const override; + bool FindFontSubstitute(vcl::font::FontSelectPattern&, LogicalFontInstance* pLogicalFont, OUString&) const override; }; } -bool CoreTextGlyphFallbackSubstititution::FindFontSubstitute(FontSelectPattern& rPattern, LogicalFontInstance* pLogicalFont, +bool CoreTextGlyphFallbackSubstititution::FindFontSubstitute(vcl::font::FontSelectPattern& rPattern, LogicalFontInstance* pLogicalFont, OUString& rMissingChars) const { bool bFound = false; @@ -377,7 +377,7 @@ void AquaGraphicsBackend::drawTextLayout(const GenericSalLayout& rLayout) #endif const CoreTextStyle& rStyle = *static_cast<const CoreTextStyle*>(&rLayout.GetFont()); - const FontSelectPattern& rFontSelect = rStyle.GetFontSelectPattern(); + const vcl::font::FontSelectPattern& rFontSelect = rStyle.GetFontSelectPattern(); if (rFontSelect.mnHeight == 0) { SAL_WARN("vcl.quartz", "AquaSalGraphics::DrawTextLayout(): rFontSelect.mnHeight is zero!?"); diff --git a/vcl/skia/osx/gdiimpl.cxx b/vcl/skia/osx/gdiimpl.cxx index 6a6e3b10d4f3..f4e2a63bee80 100644 --- a/vcl/skia/osx/gdiimpl.cxx +++ b/vcl/skia/osx/gdiimpl.cxx @@ -209,7 +209,7 @@ bool AquaSkiaSalGraphicsImpl::drawNativeControl(ControlType nType, ControlPart n void AquaSkiaSalGraphicsImpl::drawTextLayout(const GenericSalLayout& rLayout) { const CoreTextStyle& rStyle = *static_cast<const CoreTextStyle*>(&rLayout.GetFont()); - const FontSelectPattern& rFontSelect = rStyle.GetFontSelectPattern(); + const vcl::font::FontSelectPattern& rFontSelect = rStyle.GetFontSelectPattern(); int nHeight = rFontSelect.mnHeight; int nWidth = rFontSelect.mnWidth ? rFontSelect.mnWidth : nHeight; if (nWidth == 0 || nHeight == 0) diff --git a/vcl/skia/win/gdiimpl.cxx b/vcl/skia/win/gdiimpl.cxx index d65ad2a1b3f5..a10351888eac 100644 --- a/vcl/skia/win/gdiimpl.cxx +++ b/vcl/skia/win/gdiimpl.cxx @@ -234,7 +234,7 @@ bool WinSkiaSalGraphicsImpl::DrawTextLayout(const GenericSalLayout& rLayout) font.setEdging(logFont.lfQuality == NONANTIALIASED_QUALITY ? SkFont::Edging::kAlias : fontEdging); - const FontSelectPattern& rFSD = pWinFont->GetFontSelectPattern(); + const vcl::font::FontSelectPattern& rFSD = pWinFont->GetFontSelectPattern(); int nHeight = rFSD.mnHeight; int nWidth = rFSD.mnWidth ? rFSD.mnWidth : nHeight; if (nWidth == 0 || nHeight == 0) diff --git a/vcl/skia/x11/textrender.cxx b/vcl/skia/x11/textrender.cxx index 9592260cdba3..a2d0dcbb36f6 100644 --- a/vcl/skia/x11/textrender.cxx +++ b/vcl/skia/x11/textrender.cxx @@ -34,7 +34,7 @@ void SkiaTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalGr { const FreetypeFontInstance& rInstance = static_cast<FreetypeFontInstance&>(rLayout.GetFont()); const FreetypeFont& rFont = rInstance.GetFreetypeFont(); - const FontSelectPattern& rFSD = rInstance.GetFontSelectPattern(); + const vcl::font::FontSelectPattern& rFSD = rInstance.GetFontSelectPattern(); int nHeight = rFSD.mnHeight; int nWidth = rFSD.mnWidth ? rFSD.mnWidth : nHeight; if (nWidth == 0 || nHeight == 0) diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx index b0baf5f40ddf..c97beb478c79 100644 --- a/vcl/source/font/PhysicalFontCollection.cxx +++ b/vcl/source/font/PhysicalFontCollection.cxx @@ -174,7 +174,7 @@ void PhysicalFontCollection::ImplInitGenericGlyphFallback() const mpFallbackList = std::move(pFallbackList); } -vcl::font::PhysicalFontFamily* PhysicalFontCollection::GetGlyphFallbackFont( FontSelectPattern& rFontSelData, +vcl::font::PhysicalFontFamily* PhysicalFontCollection::GetGlyphFallbackFont( vcl::font::FontSelectPattern& rFontSelData, LogicalFontInstance* pFontInstance, OUString& rMissingCodes, int nFallbackLevel ) const @@ -914,7 +914,7 @@ const std::vector<std::pair<OUString, OUString>> aMetricCompatibleMap = { "Calibri", "Carlito" }, }; -static bool FindMetricCompatibleFont(FontSelectPattern& rFontSelData) +static bool FindMetricCompatibleFont(vcl::font::FontSelectPattern& rFontSelData) { for (const auto& aSub : aMetricCompatibleMap) { @@ -928,7 +928,7 @@ static bool FindMetricCompatibleFont(FontSelectPattern& rFontSelData) return false; } -vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( FontSelectPattern& rFSD ) const +vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( vcl::font::FontSelectPattern& rFSD ) const { // give up if no fonts are available if( !Count() ) @@ -956,7 +956,7 @@ vcl::font::PhysicalFontFamily* PhysicalFontCollection::FindFontFamily( FontSelec // Until features are properly supported, they are appended to the // font name, so we need to strip them off so the font is found. - sal_Int32 nFeat = aSearchName.indexOf(FontSelectPattern::FEAT_PREFIX); + sal_Int32 nFeat = aSearchName.indexOf(vcl::font::FontSelectPattern::FEAT_PREFIX); OUString aOrigName = rFSD.maTargetName; OUString aBaseFontName = aSearchName.copy( 0, (nFeat != -1) ? nFeat : aSearchName.getLength() ); diff --git a/vcl/source/font/PhysicalFontFace.cxx b/vcl/source/font/PhysicalFontFace.cxx index f230d5c6d4f5..7d278df9871d 100644 --- a/vcl/source/font/PhysicalFontFace.cxx +++ b/vcl/source/font/PhysicalFontFace.cxx @@ -24,7 +24,7 @@ #include <unotools/fontdefs.hxx> #include <fontattributes.hxx> -#include <fontselect.hxx> +#include <font/FontSelectPattern.hxx> #include <PhysicalFontFace.hxx> @@ -65,7 +65,7 @@ sal_Int32 PhysicalFontFace::CompareIgnoreSize( const PhysicalFontFace& rOther ) return nRet; } -bool PhysicalFontFace::IsBetterMatch( const FontSelectPattern& rFSD, FontMatchStatus& rStatus ) const +bool PhysicalFontFace::IsBetterMatch( const vcl::font::FontSelectPattern& rFSD, FontMatchStatus& rStatus ) const { int nMatch = 0; diff --git a/vcl/source/font/PhysicalFontFamily.cxx b/vcl/source/font/PhysicalFontFamily.cxx index ccfbb1d7ed64..798b36b45ebc 100644 --- a/vcl/source/font/PhysicalFontFamily.cxx +++ b/vcl/source/font/PhysicalFontFamily.cxx @@ -203,7 +203,7 @@ void PhysicalFontFamily::InitMatchData( const utl::FontSubstConfiguration& rFont mnMatchType |= lcl_IsCJKFont( maFamilyName ); } -PhysicalFontFace* PhysicalFontFamily::FindBestFontFace( const FontSelectPattern& rFSD ) const +PhysicalFontFace* PhysicalFontFamily::FindBestFontFace( const vcl::font::FontSelectPattern& rFSD ) const { if( maFontFaces.empty() ) return nullptr; diff --git a/vcl/source/font/fontcache.cxx b/vcl/source/font/fontcache.cxx index 18d191bb0f7b..5e94441466b0 100644 --- a/vcl/source/font/fontcache.cxx +++ b/vcl/source/font/fontcache.cxx @@ -28,12 +28,12 @@ using namespace vcl::font; -size_t ImplFontCache::IFSD_Hash::operator()( const FontSelectPattern& rFSD ) const +size_t ImplFontCache::IFSD_Hash::operator()( const vcl::font::FontSelectPattern& rFSD ) const { return rFSD.hashCode(); } -bool ImplFontCache::IFSD_Equal::operator()(const FontSelectPattern& rA, const FontSelectPattern& rB) const +bool ImplFontCache::IFSD_Equal::operator()(const vcl::font::FontSelectPattern& rA, const vcl::font::FontSelectPattern& rB) const { // check normalized font family name if( rA.maSearchName != rB.maSearchName ) @@ -70,9 +70,9 @@ bool ImplFontCache::IFSD_Equal::operator()(const FontSelectPattern& rA, const Fo } // check for features - if ((rA.maTargetName.indexOf(FontSelectPattern::FEAT_PREFIX) + if ((rA.maTargetName.indexOf(vcl::font::FontSelectPattern::FEAT_PREFIX) != -1 || - rB.maTargetName.indexOf(FontSelectPattern::FEAT_PREFIX) + rB.maTargetName.indexOf(vcl::font::FontSelectPattern::FEAT_PREFIX) != -1) && rA.maTargetName != rB.maTargetName) return false; @@ -104,12 +104,12 @@ rtl::Reference<LogicalFontInstance> ImplFontCache::GetFontInstance( PhysicalFont const vcl::Font& rFont, const Size& rSize, float fExactHeight, bool bNonAntialias ) { // initialize internal font request object - FontSelectPattern aFontSelData(rFont, rFont.GetFamilyName(), rSize, fExactHeight, bNonAntialias); + vcl::font::FontSelectPattern aFontSelData(rFont, rFont.GetFamilyName(), rSize, fExactHeight, bNonAntialias); return GetFontInstance( pFontList, aFontSelData ); } rtl::Reference<LogicalFontInstance> ImplFontCache::GetFontInstance( PhysicalFontCollection const * pFontList, - FontSelectPattern& aFontSelData ) + vcl::font::FontSelectPattern& aFontSelData ) { rtl::Reference<LogicalFontInstance> pFontInstance; PhysicalFontFamily* pFontFamily = nullptr; @@ -203,7 +203,7 @@ rtl::Reference<LogicalFontInstance> ImplFontCache::GetFontInstance( PhysicalFont } rtl::Reference<LogicalFontInstance> ImplFontCache::GetGlyphFallbackFont( PhysicalFontCollection const * pFontCollection, - FontSelectPattern& rFontSelData, LogicalFontInstance* pFontInstance, int nFallbackLevel, OUString& rMissingCodes ) + vcl::font::FontSelectPattern& rFontSelData, LogicalFontInstance* pFontInstance, int nFallbackLevel, OUString& rMissingCodes ) { // get a candidate font for glyph fallback // unless the previously selected font got a device specific substitution diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/fontinstance.cxx index 6b084b12125e..672ac82e1bdb 100644 --- a/vcl/source/font/fontinstance.cxx +++ b/vcl/source/font/fontinstance.cxx @@ -45,7 +45,7 @@ namespace std } -LogicalFontInstance::LogicalFontInstance(const PhysicalFontFace& rFontFace, const FontSelectPattern& rFontSelData ) +LogicalFontInstance::LogicalFontInstance(const PhysicalFontFace& rFontFace, const vcl::font::FontSelectPattern& rFontSelData ) : mxFontMetric( new ImplFontMetricData( rFontSelData )) , mpConversion( nullptr ) , mnLineHeight( 0 ) diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx index e3baa35f36ca..b0904eea6b3a 100644 --- a/vcl/source/font/fontmetric.cxx +++ b/vcl/source/font/fontmetric.cxx @@ -28,7 +28,7 @@ #include <PhysicalFontFace.hxx> #include <fontinstance.hxx> -#include <fontselect.hxx> +#include <font/FontSelectPattern.hxx> #include <impfontmetricdata.hxx> #include <sft.hxx> @@ -96,7 +96,7 @@ bool FontMetric::operator==( const FontMetric& r ) const return true; } -ImplFontMetricData::ImplFontMetricData( const FontSelectPattern& rFontSelData ) +ImplFontMetricData::ImplFontMetricData( const vcl::font::FontSelectPattern& rFontSelData ) : FontAttributes( rFontSelData ) , mnHeight ( rFontSelData.mnHeight ) , mnWidth ( rFontSelData.mnWidth ) diff --git a/vcl/source/font/fontselect.cxx b/vcl/source/font/fontselect.cxx index b592c71670a2..3ea89bde90e1 100644 --- a/vcl/source/font/fontselect.cxx +++ b/vcl/source/font/fontselect.cxx @@ -23,7 +23,10 @@ #include <vcl/font.hxx> #include <PhysicalFontFace.hxx> -#include <fontselect.hxx> +#include <font/FontSelectPattern.hxx> + +namespace vcl::font +{ // These mustn't conflict with font name lists which use ; and , const char FontSelectPattern::FEAT_PREFIX = ':'; @@ -146,5 +149,6 @@ bool FontSelectPattern::operator==(const FontSelectPattern& rOther) const return true; } +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index ad22c3415cc0..2028a4587695 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -29,7 +29,7 @@ #include <ImplLayoutArgs.hxx> #include <TextLayoutCache.hxx> -#include <fontselect.hxx> +#include <font/FontSelectPattern.hxx> #include <salgdi.hxx> #include <sallayout.hxx> @@ -312,7 +312,7 @@ bool GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay hb_buffer_set_unicode_funcs(pHbBuffer, pHbUnicodeFuncs); #endif - const FontSelectPattern& rFontSelData = GetFont().GetFontSelectPattern(); + const vcl::font::FontSelectPattern& rFontSelData = GetFont().GetFontSelectPattern(); if (rArgs.mnFlags & SalLayoutFlags::DisableKerning) { SAL_INFO("vcl.harfbuzz", "Disabling kerning for font: " << rFontSelData.maTargetName); diff --git a/vcl/source/gdi/pdfbuildin_fonts.cxx b/vcl/source/gdi/pdfbuildin_fonts.cxx index ab747d024c80..688b608de2e1 100644 --- a/vcl/source/gdi/pdfbuildin_fonts.cxx +++ b/vcl/source/gdi/pdfbuildin_fonts.cxx @@ -732,7 +732,7 @@ const BuildinFont BuildinFontFace::m_aBuildinFonts[14] }; BuildinFontInstance::BuildinFontInstance(const PhysicalFontFace& rFontFace, - const FontSelectPattern& rFSP) + const vcl::font::FontSelectPattern& rFSP) : LogicalFontInstance(rFontFace, rFSP) { } @@ -754,7 +754,7 @@ BuildinFontFace::BuildinFontFace(int nId) } rtl::Reference<LogicalFontInstance> -BuildinFontFace::CreateFontInstance(const FontSelectPattern& rFSP) const +BuildinFontFace::CreateFontInstance(const vcl::font::FontSelectPattern& rFSP) const { return new BuildinFontInstance(*this, rFSP); } diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index 5270204aa339..dd73cfb4007d 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -1255,7 +1255,7 @@ std::unique_ptr<SalLayout> OutputDevice::ImplGlyphFallbackLayout( std::unique_pt rLayoutArgs.ResetPos(); OUString aMissingCodes = aMissingCodeBuf.makeStringAndClear(); - FontSelectPattern aFontSelData(mpFontInstance->GetFontSelectPattern()); + vcl::font::FontSelectPattern aFontSelData(mpFontInstance->GetFontSelectPattern()); SalLayoutGlyphsImpl* pGlyphsImpl = pGlyphs ? pGlyphs->Impl(1) : nullptr; // try if fallback fonts support the missing code units diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 0b607c0d7ce8..c62ab819759b 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -248,7 +248,7 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout ) if( !pVDev->SetOutputSizePixel( aBoundRect.GetSize() ) ) return false; - const FontSelectPattern& rPattern = mpFontInstance->GetFontSelectPattern(); + const vcl::font::FontSelectPattern& rPattern = mpFontInstance->GetFontSelectPattern(); vcl::Font aFont( GetFont() ); aFont.SetOrientation( 0_deg10 ); aFont.SetFontSize( Size( rPattern.mnWidth, rPattern.mnHeight ) ); diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index 527cea29b627..3c0f8052bd6e 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -35,7 +35,7 @@ #include <comphelper/sequence.hxx> #include <vcl/svapp.hxx> #include <vcl/vclenum.hxx> -#include <fontselect.hxx> +#include <font/FontSelectPattern.hxx> #include <i18nlangtag/languagetag.hxx> #include <i18nutil/unicode.hxx> #include <rtl/strbuf.hxx> @@ -974,7 +974,7 @@ IMPL_LINK_NOARG(PrintFontManager, autoInstallFontLangSupport, Timer *, void) m_aCurrentRequests.clear(); } -void PrintFontManager::Substitute(FontSelectPattern &rPattern, OUString& rMissingCodes) +void PrintFontManager::Substitute(vcl::font::FontSelectPattern &rPattern, OUString& rMissingCodes) { FontCfgWrapper& rWrapper = FontCfgWrapper::get(); diff --git a/vcl/unx/generic/fontmanager/fontsubst.cxx b/vcl/unx/generic/fontmanager/fontsubst.cxx index 6a363fd79f53..9559a252b089 100644 --- a/vcl/unx/generic/fontmanager/fontsubst.cxx +++ b/vcl/unx/generic/fontmanager/fontsubst.cxx @@ -32,8 +32,8 @@ class FcPreMatchSubstitution : public ImplPreMatchFontSubstitution { public: - bool FindFontSubstitute( FontSelectPattern& ) const override; - typedef ::std::pair<FontSelectPattern, FontSelectPattern> value_type; + bool FindFontSubstitute( vcl::font::FontSelectPattern& ) const override; + typedef ::std::pair<vcl::font::FontSelectPattern, vcl::font::FontSelectPattern> value_type; private: typedef ::std::list<value_type> CachedFontMapType; mutable CachedFontMapType maCachedFontMap; @@ -44,7 +44,7 @@ class FcGlyphFallbackSubstitution { // TODO: add a cache public: - bool FindFontSubstitute(FontSelectPattern&, LogicalFontInstance* pLogicalFont, OUString& rMissingCodes) const override; + bool FindFontSubstitute(vcl::font::FontSelectPattern&, LogicalFontInstance* pLogicalFont, OUString& rMissingCodes) const override; }; } @@ -60,9 +60,9 @@ void SalGenericInstance::RegisterFontSubstitutors( PhysicalFontCollection* pFont pFontCollection->SetFallbackHook( &aSubstFallback ); } -static FontSelectPattern GetFcSubstitute(const FontSelectPattern &rFontSelData, OUString& rMissingCodes) +static vcl::font::FontSelectPattern GetFcSubstitute(const vcl::font::FontSelectPattern &rFontSelData, OUString& rMissingCodes) { - FontSelectPattern aSubstituted(rFontSelData); + vcl::font::FontSelectPattern aSubstituted(rFontSelData); psp::PrintFontManager& rMgr = psp::PrintFontManager::get(); rMgr.Substitute(aSubstituted, rMissingCodes); return aSubstituted; @@ -70,7 +70,7 @@ static FontSelectPattern GetFcSubstitute(const FontSelectPattern &rFontSelData, namespace { - bool uselessmatch(const FontSelectPattern &rOrig, const FontSelectPattern &rNew) + bool uselessmatch(const vcl::font::FontSelectPattern &rOrig, const vcl::font::FontSelectPattern &rNew) { return ( @@ -85,9 +85,9 @@ namespace class equal { private: - const FontSelectPattern& mrAttributes; + const vcl::font::FontSelectPattern& mrAttributes; public: - explicit equal(const FontSelectPattern& rAttributes) + explicit equal(const vcl::font::FontSelectPattern& rAttributes) : mrAttributes(rAttributes) { } @@ -96,7 +96,7 @@ namespace }; } -bool FcPreMatchSubstitution::FindFontSubstitute(FontSelectPattern &rFontSelData) const +bool FcPreMatchSubstitution::FindFontSubstitute(vcl::font::FontSelectPattern &rFontSelData) const { // We don't actually want to talk to Fontconfig at all for symbol fonts if( rFontSelData.IsSymbolFont() ) @@ -110,7 +110,7 @@ bool FcPreMatchSubstitution::FindFontSubstitute(FontSelectPattern &rFontSelData) //different fonts depending on fontsize, bold, etc settings so don't cache //just on the name, cache map all the input and all the output not just map //from original selection to output fontname - FontSelectPattern& rPatternAttributes = rFontSelData; + vcl::font::FontSelectPattern& rPatternAttributes = rFontSelData; CachedFontMapType &rCachedFontMap = maCachedFontMap; CachedFontMapType::iterator itr = std::find_if(rCachedFontMap.begin(), rCachedFontMap.end(), equal(rPatternAttributes)); if (itr != rCachedFontMap.end()) @@ -126,7 +126,7 @@ bool FcPreMatchSubstitution::FindFontSubstitute(FontSelectPattern &rFontSelData) } OUString aDummy; - const FontSelectPattern aOut = GetFcSubstitute( rFontSelData, aDummy ); + const vcl::font::FontSelectPattern aOut = GetFcSubstitute( rFontSelData, aDummy ); if( aOut.maSearchName.isEmpty() ) return false; @@ -170,7 +170,7 @@ bool FcPreMatchSubstitution::FindFontSubstitute(FontSelectPattern &rFontSelData) return bHaveSubstitute; } -bool FcGlyphFallbackSubstitution::FindFontSubstitute(FontSelectPattern& rFontSelData, +bool FcGlyphFallbackSubstitution::FindFontSubstitute(vcl::font::FontSelectPattern& rFontSelData, LogicalFontInstance* /*pLogicalFont*/, OUString& rMissingCodes ) const { @@ -181,7 +181,7 @@ bool FcGlyphFallbackSubstitution::FindFontSubstitute(FontSelectPattern& rFontSel if ( IsStarSymbol(rFontSelData.maSearchName) ) return false; - const FontSelectPattern aOut = GetFcSubstitute( rFontSelData, rMissingCodes ); + const vcl::font::FontSelectPattern aOut = GetFcSubstitute( rFontSelData, rMissingCodes ); // TODO: cache the unicode + srcfont specific result // FC doing it would be preferable because it knows the invariables // e.g. FC knows the FC rule that all Arial gets replaced by LiberationSans diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx index bcb78b08804d..35e352555a10 100644 --- a/vcl/unx/generic/gdi/cairotextrender.cxx +++ b/vcl/unx/generic/gdi/cairotextrender.cxx @@ -145,7 +145,7 @@ void CairoTextRender::DrawTextLayout(const GenericSalLayout& rLayout, const SalG if (cairo_glyphs.empty()) return; - const FontSelectPattern& rFSD = rInstance.GetFontSelectPattern(); + const vcl::font::FontSelectPattern& rFSD = rInstance.GetFontSelectPattern(); int nHeight = rFSD.mnHeight; int nWidth = rFSD.mnWidth ? rFSD.mnWidth : nHeight; if (nWidth == 0 || nHeight == 0) diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 0881913c040c..9b11ced5ec83 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -315,7 +315,7 @@ namespace } } -bool FreetypeFont::AlmostHorizontalDrainsRenderingPool(int nRatio, const FontSelectPattern& rFSD) +bool FreetypeFont::AlmostHorizontalDrainsRenderingPool(int nRatio, const vcl::font::FontSelectPattern& rFSD) { static bool bAlmostHorizontalDrainsRenderingPool = DoesAlmostHorizontalDrainRenderingPool(); if (nRatio > 100 && rFSD.maTargetName == "OpenSymbol" && bAlmostHorizontalDrainsRenderingPool) @@ -392,7 +392,7 @@ FreetypeFontFace::FreetypeFontFace( FreetypeFontInfo* pFI, const FontAttributes& { } -rtl::Reference<LogicalFontInstance> FreetypeFontFace::CreateFontInstance(const FontSelectPattern& rFSD) const +rtl::Reference<LogicalFontInstance> FreetypeFontFace::CreateFontInstance(const vcl::font::FontSelectPattern& rFSD) const { return new FreetypeFontInstance(*this, rFSD); } @@ -416,7 +416,7 @@ FreetypeFont::FreetypeFont(FreetypeFontInstance& rFontInstance, const std::share maFaceFT = mxFontInfo->GetFaceFT(); - const FontSelectPattern& rFSD = rFontInstance.GetFontSelectPattern(); + const vcl::font::FontSelectPattern& rFSD = rFontInstance.GetFontSelectPattern(); if( rFSD.mnOrientation ) { diff --git a/vcl/unx/generic/glyphs/glyphcache.cxx b/vcl/unx/generic/glyphs/glyphcache.cxx index 20bfca32488d..ec2afc4db8f3 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 FontSelectPattern& rFSP) +FreetypeFontInstance::FreetypeFontInstance(const 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 92baa37f1011..48b5ca8af32b 100644 --- a/vcl/unx/generic/print/genpspgraphics.cxx +++ b/vcl/unx/generic/print/genpspgraphics.cxx @@ -185,7 +185,7 @@ void GenPspGraphics::SetFont(LogicalFontInstance *pFontInstance, int nFallbackLe sal_IntPtr nID = pFontInstance->GetFontFace()->GetFontId(); - const FontSelectPattern& rEntry = pFontInstance->GetFontSelectPattern(); + const vcl::font::FontSelectPattern& rEntry = pFontInstance->GetFontSelectPattern(); // determine which font attributes need to be emulated bool bArtItalic = false; diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index d830c421b063..c3ad1eb5817d 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -160,7 +160,7 @@ class WinPreMatchFontSubstititution : public ImplPreMatchFontSubstitution { public: - bool FindFontSubstitute(FontSelectPattern&) const override; + bool FindFontSubstitute(vcl::font::FontSelectPattern&) const override; }; class WinGlyphFallbackSubstititution @@ -177,7 +177,7 @@ public: ReleaseDC(nullptr, mhDC); }; - bool FindFontSubstitute(FontSelectPattern&, LogicalFontInstance* pLogicalFont, OUString& rMissingChars) const override; + bool FindFontSubstitute(vcl::font::FontSelectPattern&, LogicalFontInstance* pLogicalFont, OUString& rMissingChars) const override; private: HDC mhDC; bool HasMissingChars(PhysicalFontFace*, OUString& rMissingChars) const; @@ -193,7 +193,7 @@ bool WinGlyphFallbackSubstititution::HasMissingChars(PhysicalFontFace* pFace, OU if( !xFontCharMap.is() ) { // create a FontSelectPattern object for getting s LOGFONT - const FontSelectPattern aFSD( *pFace, Size(), 0.0, 0, false ); + const vcl::font::FontSelectPattern aFSD( *pFace, Size(), 0.0, 0, false ); // construct log font LOGFONTW aLogFont; ImplGetLogFontFromFontSelect( aFSD, pFace, aLogFont ); @@ -268,7 +268,7 @@ const std::map<OUString, OUString> aBitmapFontSubs = }; // TODO: See if Windows have API that we can use here to improve font fallback. -bool WinPreMatchFontSubstititution::FindFontSubstitute(FontSelectPattern& rFontSelData) const +bool WinPreMatchFontSubstititution::FindFontSubstitute(vcl::font::FontSelectPattern& rFontSelData) const { if (rFontSelData.IsSymbolFont() || IsStarSymbol(rFontSelData.maSearchName)) return false; @@ -287,7 +287,7 @@ bool WinPreMatchFontSubstititution::FindFontSubstitute(FontSelectPattern& rFontS // find a fallback font for missing characters // TODO: should stylistic matches be searched and preferred? -bool WinGlyphFallbackSubstititution::FindFontSubstitute(FontSelectPattern& rFontSelData, LogicalFontInstance* /*pLogicalFont*/, OUString& rMissingChars) const +bool WinGlyphFallbackSubstititution::FindFontSubstitute(vcl::font::FontSelectPattern& rFontSelData, LogicalFontInstance* /*pLogicalFont*/, OUString& rMissingChars) const { // guess a locale matching to the missing chars LanguageType eLang = rFontSelData.meLanguage; @@ -666,7 +666,7 @@ sal_IntPtr WinFontFace::GetFontId() const return mnId; } -rtl::Reference<LogicalFontInstance> WinFontFace::CreateFontInstance(const FontSelectPattern& rFSD) const +rtl::Reference<LogicalFontInstance> WinFontFace::CreateFontInstance(const vcl::font::FontSelectPattern& rFSD) const { #if HAVE_FEATURE_SKIA if (SkiaHelper::isVCLSkiaEnabled()) @@ -761,7 +761,7 @@ void WinSalGraphics::SetTextColor( Color nColor ) ::SetTextColor( getHDC(), aCol ); } -void ImplGetLogFontFromFontSelect( const FontSelectPattern& rFont, +void ImplGetLogFontFromFontSelect( const vcl::font::FontSelectPattern& rFont, const PhysicalFontFace* pFontFace, LOGFONTW& rLogFont ) { @@ -810,7 +810,7 @@ void ImplGetLogFontFromFontSelect( const FontSelectPattern& rFont, } -HFONT WinSalGraphics::ImplDoSetFont(FontSelectPattern const & i_rFont, +HFONT WinSalGraphics::ImplDoSetFont(vcl::font::FontSelectPattern const & i_rFont, const PhysicalFontFace * i_pFontFace, HFONT& o_rOldFont) { @@ -1238,7 +1238,7 @@ bool WinFontInstance::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& r // use unity matrix MAT2 aMat; - const FontSelectPattern& rFSD = GetFontSelectPattern(); + const vcl::font::FontSelectPattern& rFSD = GetFontSelectPattern(); // Use identity matrix for fonts requested in horizontal // writing (LTR or RTL), or rotated glyphs in vertical writing. @@ -1537,7 +1537,7 @@ bool WinSalGraphics::CreateFontSubset( const OUString& rToFile, // create matching FontSelectPattern // we need just enough to get to the font file data // use height=1000 for easier debugging (to match psprint's font units) - FontSelectPattern aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); + vcl::font::FontSelectPattern aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); // TODO: much better solution: move SetFont and restoration of old font to caller ScopedFont aOldFont(*this); @@ -1602,7 +1602,7 @@ const void* WinSalGraphics::GetEmbedFontData(const PhysicalFontFace* pFont, tool { // create matching FontSelectPattern // we need just enough to get to the font file data - FontSelectPattern aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); + vcl::font::FontSelectPattern aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); ScopedFont aOldFont(*this); @@ -1631,7 +1631,7 @@ void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont, { // create matching FontSelectPattern // we need just enough to get to the font file data - FontSelectPattern aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); + vcl::font::FontSelectPattern aIFSD( *pFont, Size(0,1000), 1000.0, 0, false ); // TODO: much better solution: move SetFont and restoration of old font to caller ScopedFont aOldFont(*this); diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index 9633de9d4cca..749b9c96ec4f 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -105,7 +105,7 @@ std::unique_ptr<GenericSalLayout> WinSalGraphics::GetTextLayout(int nFallbackLev return std::make_unique<GenericSalLayout>(*mpWinFontEntry[nFallbackLevel]); } -WinFontInstance::WinFontInstance(const WinFontFace& rPFF, const FontSelectPattern& rFSP) +WinFontInstance::WinFontInstance(const WinFontFace& rPFF, const vcl::font::FontSelectPattern& rFSP) : LogicalFontInstance(rPFF, rFSP) , m_pGraphics(nullptr) , m_hFont(nullptr) @@ -121,7 +121,7 @@ WinFontInstance::~WinFontInstance() bool WinFontInstance::hasHScale() const { - const FontSelectPattern& rPattern = GetFontSelectPattern(); + const vcl::font::FontSelectPattern& rPattern = GetFontSelectPattern(); int nHeight(rPattern.mnHeight); int nWidth(rPattern.mnWidth ? rPattern.mnWidth * GetAverageWidthFactor() : nHeight); return nWidth != nHeight; @@ -129,7 +129,7 @@ bool WinFontInstance::hasHScale() const float WinFontInstance::getHScale() const { - const FontSelectPattern& rPattern = GetFontSelectPattern(); + const vcl::font::FontSelectPattern& rPattern = GetFontSelectPattern(); int nHeight(rPattern.mnHeight); if (!nHeight) return 1.0;