summaryrefslogtreecommitdiff
path: root/vcl/inc/font
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@aliftype.com>2022-09-10 23:15:55 +0200
committerخالد حسني <khaled@aliftype.com>2022-09-11 09:51:29 +0200
commitaa0a71b5cec118d4a4a922f6833ff20d7e4ba8ba (patch)
tree15b79801467daf27a165c7193cfeb6daa6e60b94 /vcl/inc/font
parent218624bdf176010e18afc06b453b4535d7a00a04 (diff)
vcl: Add PhysicalFontFace::GetRawFontData()
Change-Id: Iddeccfc8ffd5e63f7df09219ac4507502011fb28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139626 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: خالد حسني <khaled@aliftype.com>
Diffstat (limited to 'vcl/inc/font')
-rw-r--r--vcl/inc/font/PhysicalFontFace.hxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/vcl/inc/font/PhysicalFontFace.hxx b/vcl/inc/font/PhysicalFontFace.hxx
index 396178c5e40d..3f59dd3b25e4 100644
--- a/vcl/inc/font/PhysicalFontFace.hxx
+++ b/vcl/inc/font/PhysicalFontFace.hxx
@@ -55,6 +55,34 @@ public:
const OUString* mpTargetStyleName;
};
+struct RawFontData
+{
+public:
+ RawFontData(hb_blob_t* pBlob = nullptr)
+ : mpBlob(pBlob ? pBlob : hb_blob_get_empty())
+ {
+ }
+
+ ~RawFontData() { hb_blob_destroy(mpBlob); }
+
+ RawFontData& operator=(const RawFontData& rOther)
+ {
+ hb_blob_destroy(mpBlob);
+ mpBlob = hb_blob_reference(rOther.mpBlob);
+ return *this;
+ }
+
+ size_t size() const { return hb_blob_get_length(mpBlob); }
+ bool empty() const { return size() == 0; }
+ const uint8_t* data() const
+ {
+ return reinterpret_cast<const uint8_t*>(hb_blob_get_data(mpBlob, nullptr));
+ }
+
+private:
+ hb_blob_t* mpBlob;
+};
+
// TODO: no more direct access to members
// TODO: get rid of height/width for scalable fonts
// TODO: make cloning cheaper
@@ -78,6 +106,8 @@ public:
virtual FontCharMapRef GetFontCharMap() const;
virtual bool GetFontCapabilities(vcl::FontCapabilities&) const;
+ RawFontData GetRawFontData(uint32_t) const;
+
bool IsBetterMatch(const vcl::font::FontSelectPattern&, FontMatchStatus&) const;
sal_Int32 CompareIgnoreSize(const PhysicalFontFace&) const;