summaryrefslogtreecommitdiff
path: root/vcl/inc
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-03-08 10:29:13 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-03-08 15:40:41 +0100
commitd73551e4023f2c9de5adaaba3d2dc0e940de41e4 (patch)
tree86f201bb112149e4c659f9dcecad5558e1fc60aa /vcl/inc
parent5bf404afe2e075c6dea8bf1f57f2adbc575f712b (diff)
no need to allocate fallback list separately
an empty map is just a couple of words of storage anyway Change-Id: Ic14eb370cee5522f435c6709529c8480d2af9e13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131170 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/inc')
-rw-r--r--vcl/inc/fontinstance.hxx19
1 files changed, 18 insertions, 1 deletions
diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index d23c6a58548d..5822bd1a08b5 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -22,6 +22,7 @@
#include <sal/config.h>
#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <o3tl/hash_combine.hxx>
#include <rtl/ref.hxx>
#include <salhelper/simplereferenceobject.hxx>
#include <tools/gen.hxx>
@@ -41,6 +42,22 @@
class ConvertChar;
class ImplFontCache;
+// extend std namespace to add custom hash needed for LogicalFontInstance
+
+namespace std
+{
+ template <> struct hash< pair< sal_UCS4, FontWeight > >
+ {
+ 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;
+ }
+ };
+}
+
// TODO: allow sharing of metrics for related fonts
class VCL_PLUGIN_PUBLIC LogicalFontInstance : public salhelper::SimpleReferenceObject
@@ -105,7 +122,7 @@ private:
// 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;
- std::unique_ptr<UnicodeFallbackList> mpUnicodeFallbackList;
+ UnicodeFallbackList maUnicodeFallbackList;
mutable ImplFontCache * mpFontCache;
const vcl::font::FontSelectPattern m_aFontSelData;
hb_font_t* m_pHbFont;