diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/Library_vcl.mk | 2 | ||||
-rw-r--r-- | vcl/inc/font/LogicalFontInstance.hxx (renamed from vcl/inc/fontinstance.hxx) | 61 | ||||
-rw-r--r-- | vcl/inc/font/PhysicalFontCollection.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/impglyphitem.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/pdf/pdfbuildin_fonts.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/qt5/QtFont.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/quartz/salgdi.h | 2 | ||||
-rw-r--r-- | vcl/inc/unx/freetype_glyphcache.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/unx/glyphcache.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/win/salgdi.h | 2 | ||||
-rw-r--r-- | vcl/qa/cppunit/fontmocks.hxx | 2 | ||||
-rw-r--r-- | vcl/qt5/QtFontFace.cxx | 2 | ||||
-rw-r--r-- | vcl/quartz/ctfonts.cxx | 2 | ||||
-rw-r--r-- | vcl/source/font/LogicalFontInstance.cxx (renamed from vcl/source/font/fontinstance.cxx) | 63 | ||||
-rw-r--r-- | vcl/source/font/fontcache.cxx | 2 | ||||
-rw-r--r-- | vcl/source/font/fontmetric.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/glyphs/freetype_glyphcache.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/glyphs/glyphcache.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/print/genpspgraphics.cxx | 2 |
19 files changed, 86 insertions, 72 deletions
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 1faaa57cf336..5416cbb361c5 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -481,12 +481,12 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/font/FeatureCollector \ vcl/source/font/FeatureParser \ vcl/source/font/FontSelectPattern \ + vcl/source/font/LogicalFontInstance \ vcl/source/font/OpenTypeFeatureDefinitionList \ vcl/source/font/PhysicalFontCollection \ vcl/source/font/PhysicalFontFace \ vcl/source/font/PhysicalFontFamily \ vcl/source/font/fontattributes \ - vcl/source/font/fontinstance \ vcl/source/font/fontcache \ vcl/source/font/fontcharmap \ vcl/source/font/fontmetric \ diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/font/LogicalFontInstance.hxx index 2b382009e263..8187ccc2e7e0 100644 --- a/vcl/inc/fontinstance.hxx +++ b/vcl/inc/font/LogicalFontInstance.hxx @@ -29,9 +29,9 @@ #include <tools/fontenum.hxx> #include <tools/degree.hxx> -#include "font/FontSelectPattern.hxx" -#include "impfontmetricdata.hxx" -#include "glyphid.hxx" +#include <font/FontSelectPattern.hxx> +#include <impfontmetricdata.hxx> +#include <glyphid.hxx> #include <optional> #include <unordered_map> @@ -46,16 +46,16 @@ class ImplFontCache; namespace std { - template <> struct hash< pair< sal_UCS4, FontWeight > > +template <> struct hash<pair<sal_UCS4, FontWeight>> +{ + size_t operator()(const pair<sal_UCS4, FontWeight>& rData) const { - size_t operator()(const pair< sal_UCS4, FontWeight >& rData) const - { - std::size_t seed = 0; - o3tl::hash_combine(seed, rData.first); - o3tl::hash_combine(seed, rData.second); - return seed; - } - }; + std::size_t seed = 0; + o3tl::hash_combine(seed, rData.first); + o3tl::hash_combine(seed, rData.second); + return seed; + } +}; } // TODO: allow sharing of metrics for related fonts @@ -70,19 +70,19 @@ class VCL_PLUGIN_PUBLIC LogicalFontInstance : public salhelper::SimpleReferenceO public: // TODO: make data members private virtual ~LogicalFontInstance() override; - ImplFontMetricDataRef mxFontMetric; // Font attributes - const ConvertChar* mpConversion; // used e.g. for StarBats->StarSymbol + ImplFontMetricDataRef mxFontMetric; // Font attributes + const ConvertChar* mpConversion; // used e.g. for StarBats->StarSymbol - tools::Long mnLineHeight; - Degree10 mnOwnOrientation; // text angle if lower layers don't rotate text themselves - Degree10 mnOrientation; // text angle in 3600 system - bool mbInit; // true if maFontMetric member is valid + tools::Long mnLineHeight; + Degree10 mnOwnOrientation; // text angle if lower layers don't rotate text themselves + Degree10 mnOrientation; // text angle in 3600 system + bool mbInit; // true if maFontMetric member is valid - void AddFallbackForUnicode(sal_UCS4 cChar, FontWeight eWeight, const OUString& rFontName, - bool bEmbolden, const ItalicMatrix& rMatrix); - bool GetFallbackForUnicode(sal_UCS4 cInChar, FontWeight eInWeight, - OUString* pOutFontName, bool* pOutEmbolden, ItalicMatrix* pOutItalicMatrix) const; - void IgnoreFallbackForUnicode( sal_UCS4, FontWeight eWeight, std::u16string_view rFontName ); + void AddFallbackForUnicode(sal_UCS4 cChar, FontWeight eWeight, const OUString& rFontName, + bool bEmbolden, const ItalicMatrix& rMatrix); + bool GetFallbackForUnicode(sal_UCS4 cInChar, FontWeight eInWeight, OUString* pOutFontName, + bool* pOutEmbolden, ItalicMatrix* pOutItalicMatrix) const; + void IgnoreFallbackForUnicode(sal_UCS4, FontWeight eWeight, std::u16string_view rFontName); inline hb_font_t* GetHbFont(); bool IsGraphiteFont(); @@ -105,12 +105,13 @@ public: // TODO: make data members private void GetScale(double* nXScale, double* nYScale) const; protected: - explicit LogicalFontInstance(const vcl::font::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; hb_font_t* InitHbFont(); - virtual void ImplInitHbFont(hb_font_t*) { } + virtual void ImplInitHbFont(hb_font_t*) {} private: struct MapEntry @@ -122,16 +123,20 @@ private: // cache of Unicode characters and replacement font names and attributes // TODO: a fallback map can be shared with many other ImplFontEntries // TODO: at least the ones which just differ in orientation, stretching or height - typedef ::std::unordered_map< ::std::pair<sal_UCS4,FontWeight>, MapEntry > UnicodeFallbackList; + typedef ::std::unordered_map<::std::pair<sal_UCS4, FontWeight>, MapEntry> UnicodeFallbackList; UnicodeFallbackList maUnicodeFallbackList; - mutable ImplFontCache * mpFontCache; + mutable ImplFontCache* mpFontCache; const vcl::font::FontSelectPattern m_aFontSelData; hb_font_t* m_pHbFont; double m_nAveWidthFactor; rtl::Reference<vcl::font::PhysicalFontFace> m_pFontFace; std::optional<bool> m_xbIsGraphiteFont; - enum class FontFamilyEnum { Unclassified, DFKaiSB }; + enum class FontFamilyEnum + { + Unclassified, + DFKaiSB + }; // The value is initialized and used in NeedOffsetCorrection(). std::optional<FontFamilyEnum> m_xeFontFamilyEnum; diff --git a/vcl/inc/font/PhysicalFontCollection.hxx b/vcl/inc/font/PhysicalFontCollection.hxx index 22ceaf8f0904..595e9568d1af 100644 --- a/vcl/inc/font/PhysicalFontCollection.hxx +++ b/vcl/inc/font/PhysicalFontCollection.hxx @@ -23,7 +23,7 @@ #include <vcl/dllapi.h> -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> #include "PhysicalFontFamily.hxx" diff --git a/vcl/inc/impglyphitem.hxx b/vcl/inc/impglyphitem.hxx index f43ef0e99e61..8bc8f19b9176 100644 --- a/vcl/inc/impglyphitem.hxx +++ b/vcl/inc/impglyphitem.hxx @@ -26,7 +26,7 @@ #include <vcl/outdev.hxx> #include <vector> -#include "fontinstance.hxx" +#include "font/LogicalFontInstance.hxx" #include "glyphid.hxx" enum class GlyphItemFlags : sal_uInt16 diff --git a/vcl/inc/pdf/pdfbuildin_fonts.hxx b/vcl/inc/pdf/pdfbuildin_fonts.hxx index fbcc04a9e6fa..8cb34e74922b 100644 --- a/vcl/inc/pdf/pdfbuildin_fonts.hxx +++ b/vcl/inc/pdf/pdfbuildin_fonts.hxx @@ -22,7 +22,7 @@ #include <sal/config.h> #include <font/PhysicalFontFace.hxx> -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> namespace vcl::pdf { diff --git a/vcl/inc/qt5/QtFont.hxx b/vcl/inc/qt5/QtFont.hxx index 2ba6f49e557f..e19d6de21aa2 100644 --- a/vcl/inc/qt5/QtFont.hxx +++ b/vcl/inc/qt5/QtFont.hxx @@ -21,7 +21,7 @@ #include <sal/config.h> -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> #include <QtGui/QFont> diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 732587a09551..6ec586ac1bdd 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -42,7 +42,7 @@ #include <vcl/metric.hxx> -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> #include <impfontmetricdata.hxx> #include <font/PhysicalFontFace.hxx> #include <salgdi.hxx> diff --git a/vcl/inc/unx/freetype_glyphcache.hxx b/vcl/inc/unx/freetype_glyphcache.hxx index a5876344a055..ca35beccc211 100644 --- a/vcl/inc/unx/freetype_glyphcache.hxx +++ b/vcl/inc/unx/freetype_glyphcache.hxx @@ -23,7 +23,7 @@ #include <unx/glyphcache.hxx> #include <font/PhysicalFontFace.hxx> -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> #include <glyphid.hxx> diff --git a/vcl/inc/unx/glyphcache.hxx b/vcl/inc/unx/glyphcache.hxx index 81bf645626d5..255a5216d49b 100644 --- a/vcl/inc/unx/glyphcache.hxx +++ b/vcl/inc/unx/glyphcache.hxx @@ -33,7 +33,7 @@ #include <vcl/outdev.hxx> #include <fontattributes.hxx> -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> #include <impfontmetricdata.hxx> #include <unordered_map> diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 74f5617d9156..ef7cdf210c94 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -24,7 +24,7 @@ #include <sallayout.hxx> #include <salgeom.hxx> #include <salgdi.hxx> -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> #include <fontattributes.hxx> #include <font/PhysicalFontFace.hxx> #include <impfont.hxx> diff --git a/vcl/qa/cppunit/fontmocks.hxx b/vcl/qa/cppunit/fontmocks.hxx index 7367acab69ee..7e33ce8e7e13 100644 --- a/vcl/qa/cppunit/fontmocks.hxx +++ b/vcl/qa/cppunit/fontmocks.hxx @@ -15,7 +15,7 @@ #include <font/PhysicalFontFace.hxx> #include <font/PhysicalFontFaceCollection.hxx> #include <fontattributes.hxx> -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> class TestFontInstance : public LogicalFontInstance { diff --git a/vcl/qt5/QtFontFace.cxx b/vcl/qt5/QtFontFace.cxx index 5a0183bbc809..9fd2eb56b2fb 100644 --- a/vcl/qt5/QtFontFace.cxx +++ b/vcl/qt5/QtFontFace.cxx @@ -25,7 +25,7 @@ #include <QtFont.hxx> #include <QtTools.hxx> -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> #include <font/FontSelectPattern.hxx> #include <font/PhysicalFontCollection.hxx> diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 5e3e014c3cd4..83412955c0a4 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -32,7 +32,7 @@ #include <osx/saldata.hxx> #include <osx/salinst.h> #endif -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> #include <fontattributes.hxx> #include <impglyphitem.hxx> #include <font/PhysicalFontCollection.hxx> diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/LogicalFontInstance.cxx index 6b9f9b16ed26..0936bb7286b9 100644 --- a/vcl/source/font/fontinstance.cxx +++ b/vcl/source/font/LogicalFontInstance.cxx @@ -23,17 +23,18 @@ #include <hb-graphite2.h> #include <font/PhysicalFontFace.hxx> -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> #include <impfontcache.hxx> -LogicalFontInstance::LogicalFontInstance(const vcl::font::PhysicalFontFace& rFontFace, const vcl::font::FontSelectPattern& rFontSelData ) - : mxFontMetric( new ImplFontMetricData( rFontSelData )) - , mpConversion( nullptr ) - , mnLineHeight( 0 ) - , mnOwnOrientation( 0 ) - , mnOrientation( 0 ) - , mbInit( false ) - , mpFontCache( nullptr ) +LogicalFontInstance::LogicalFontInstance(const vcl::font::PhysicalFontFace& rFontFace, + const vcl::font::FontSelectPattern& rFontSelData) + : mxFontMetric(new ImplFontMetricData(rFontSelData)) + , mpConversion(nullptr) + , mnLineHeight(0) + , mnOwnOrientation(0) + , mnOrientation(0) + , mbInit(false) + , mpFontCache(nullptr) , m_aFontSelData(rFontSelData) , m_pHbFont(nullptr) , m_nAveWidthFactor(1.0f) @@ -99,20 +100,23 @@ void LogicalFontInstance::GetScale(double* nXScale, double* nYScale) const *nXScale = nWidth / nUPEM; } -void LogicalFontInstance::AddFallbackForUnicode(sal_UCS4 cChar, FontWeight eWeight, const OUString& rFontName, - bool bEmbolden, const ItalicMatrix& rMatrix) +void LogicalFontInstance::AddFallbackForUnicode(sal_UCS4 cChar, FontWeight eWeight, + const OUString& rFontName, bool bEmbolden, + const ItalicMatrix& rMatrix) { - MapEntry& rEntry = maUnicodeFallbackList[ std::pair< sal_UCS4, FontWeight >(cChar,eWeight) ]; + MapEntry& rEntry = maUnicodeFallbackList[std::pair<sal_UCS4, FontWeight>(cChar, eWeight)]; rEntry.sFontName = rFontName; rEntry.bEmbolden = bEmbolden; rEntry.aItalicMatrix = rMatrix; } bool LogicalFontInstance::GetFallbackForUnicode(sal_UCS4 cChar, FontWeight eWeight, - OUString* pFontName, bool* pEmbolden, ItalicMatrix* pMatrix) const + OUString* pFontName, bool* pEmbolden, + ItalicMatrix* pMatrix) const { - UnicodeFallbackList::const_iterator it = maUnicodeFallbackList.find( std::pair< sal_UCS4, FontWeight >(cChar,eWeight) ); - if( it == maUnicodeFallbackList.end() ) + UnicodeFallbackList::const_iterator it + = maUnicodeFallbackList.find(std::pair<sal_UCS4, FontWeight>(cChar, eWeight)); + if (it == maUnicodeFallbackList.end()) return false; const MapEntry& rEntry = (*it).second; @@ -122,17 +126,20 @@ bool LogicalFontInstance::GetFallbackForUnicode(sal_UCS4 cChar, FontWeight eWeig return true; } -void LogicalFontInstance::IgnoreFallbackForUnicode( sal_UCS4 cChar, FontWeight eWeight, std::u16string_view rFontName ) +void LogicalFontInstance::IgnoreFallbackForUnicode(sal_UCS4 cChar, FontWeight eWeight, + std::u16string_view rFontName) { - UnicodeFallbackList::iterator it = maUnicodeFallbackList.find( std::pair< sal_UCS4,FontWeight >(cChar,eWeight) ); - if( it == maUnicodeFallbackList.end() ) + UnicodeFallbackList::iterator it + = maUnicodeFallbackList.find(std::pair<sal_UCS4, FontWeight>(cChar, eWeight)); + if (it == maUnicodeFallbackList.end()) return; const MapEntry& rEntry = (*it).second; if (rEntry.sFontName == rFontName) - maUnicodeFallbackList.erase( it ); + maUnicodeFallbackList.erase(it); } -bool LogicalFontInstance::GetGlyphBoundRect(sal_GlyphId nID, tools::Rectangle &rRect, bool bVertical) const +bool LogicalFontInstance::GetGlyphBoundRect(sal_GlyphId nID, tools::Rectangle& rRect, + bool bVertical) const { if (mpFontCache && mpFontCache->GetCachedGlyphBoundRect(this, nID, rRect)) return true; @@ -147,7 +154,8 @@ bool LogicalFontInstance::IsGraphiteFont() { if (!m_xbIsGraphiteFont) { - m_xbIsGraphiteFont = hb_graphite2_face_get_gr_face(hb_font_get_face(GetHbFont())) != nullptr; + m_xbIsGraphiteFont + = hb_graphite2_face_get_gr_face(hb_font_get_face(GetHbFont())) != nullptr; } return *m_xbIsGraphiteFont; } @@ -161,8 +169,9 @@ bool LogicalFontInstance::NeedOffsetCorrection(sal_Int32 nYOffset) m_xeFontFamilyEnum = FontFamilyEnum::Unclassified; - if (hb_ot_name_get_utf8 (hb_font_get_face(GetHbFont()), - HB_OT_NAME_ID_FONT_FAMILY , HB_LANGUAGE_INVALID, &familyname_size, familyname) == 8) + if (hb_ot_name_get_utf8(hb_font_get_face(GetHbFont()), HB_OT_NAME_ID_FONT_FAMILY, + HB_LANGUAGE_INVALID, &familyname_size, familyname) + == 8) { // DFKai-SB (ukai.ttf) is a built-in font under traditional Chinese // Windows. It has wrong extent values in glyf table. The problem results @@ -178,10 +187,10 @@ bool LogicalFontInstance::NeedOffsetCorrection(sal_Int32 nYOffset) switch (*m_xeFontFamilyEnum) { case FontFamilyEnum::DFKaiSB: - // -839: optimization for one third of ukai.ttf - if (nYOffset == -839) - bRet = false; - break; + // -839: optimization for one third of ukai.ttf + if (nYOffset == -839) + bRet = false; + break; default: bRet = false; } diff --git a/vcl/source/font/fontcache.cxx b/vcl/source/font/fontcache.cxx index 9a87d02bcda2..ef08a5467321 100644 --- a/vcl/source/font/fontcache.cxx +++ b/vcl/source/font/fontcache.cxx @@ -24,7 +24,7 @@ #include <font/PhysicalFontCollection.hxx> #include <font/PhysicalFontFace.hxx> #include <font/PhysicalFontFamily.hxx> -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> #include <impfontcache.hxx> using namespace vcl::font; diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx index 428af2e46e86..4f398ba76a57 100644 --- a/vcl/source/font/fontmetric.cxx +++ b/vcl/source/font/fontmetric.cxx @@ -28,7 +28,7 @@ #include <font/FontSelectPattern.hxx> #include <font/PhysicalFontFace.hxx> -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> #include <impfontmetricdata.hxx> #include <sft.hxx> diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index adc7e3def9bb..a9cc4e8ae56f 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -25,7 +25,7 @@ #include <unx/freetype_glyphcache.hxx> -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> #include <fontattributes.hxx> #include <unotools/fontdefs.hxx> diff --git a/vcl/unx/generic/glyphs/glyphcache.cxx b/vcl/unx/generic/glyphs/glyphcache.cxx index b285bcc04c63..b97b956a4e8b 100644 --- a/vcl/unx/generic/glyphs/glyphcache.cxx +++ b/vcl/unx/generic/glyphs/glyphcache.cxx @@ -23,7 +23,7 @@ #include <unx/freetype_glyphcache.hxx> #include <unx/gendata.hxx> -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> #include <rtl/ustring.hxx> #include <sal/log.hxx> diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx index ff62b2860a93..b398206e9094 100644 --- a/vcl/unx/generic/print/genpspgraphics.cxx +++ b/vcl/unx/generic/print/genpspgraphics.cxx @@ -43,7 +43,7 @@ #include <unx/genpspgraphics.h> #include <unx/printergfx.hxx> #include <langboost.hxx> -#include <fontinstance.hxx> +#include <font/LogicalFontInstance.hxx> #include <fontattributes.hxx> #include <impfontmetricdata.hxx> #include <font/FontSelectPattern.hxx> |