summaryrefslogtreecommitdiff
path: root/vcl/inc/fontinstance.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/inc/fontinstance.hxx')
-rw-r--r--vcl/inc/fontinstance.hxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx
index c37ada563fb0..8bd6584c6154 100644
--- a/vcl/inc/fontinstance.hxx
+++ b/vcl/inc/fontinstance.hxx
@@ -26,6 +26,8 @@
#include <unordered_map>
#include <memory>
+#include <hb-ot.h>
+
class ConvertChar;
class ImplFontCache;
class PhysicalFontFace;
@@ -57,13 +59,25 @@ public: // TODO: make data members private
void Acquire();
void Release();
+ inline hb_font_t* GetHbFont();
+ void SetAverageWidthFactor(double nFactor) { m_nAveWidthFactor = nFactor; }
+ double GetAverageWidthFactor() const { return m_nAveWidthFactor; }
const FontSelectPattern& GetFontSelectPattern() const { return m_aFontSelData; }
+
const PhysicalFontFace* GetFontFace() const { return m_pFontFace; }
const ImplFontCache* GetFontCache() const { return mpFontCache; }
+ void GetScale(double* nXScale, double* nYScale);
+ static inline void DecodeOpenTypeTag(const uint32_t nTableTag, char* pTagName);
+
protected:
explicit LogicalFontInstance(const PhysicalFontFace&, const FontSelectPattern&);
+ // Takes ownership of pHbFace.
+ hb_font_t* InitHbFont(hb_face_t* pHbFace) const;
+ virtual hb_font_t* ImplInitHbFont() { assert(false); return nullptr; }
+ inline void ReleaseHbFont();
+
private:
// cache of Unicode characters and replacement font names
// TODO: a fallback map can be shared with many other ImplFontEntries
@@ -73,9 +87,35 @@ private:
ImplFontCache * mpFontCache;
sal_uInt32 mnRefCount;
const FontSelectPattern m_aFontSelData;
+ hb_font_t* m_pHbFont;
+ double m_nAveWidthFactor;
const PhysicalFontFace* m_pFontFace;
};
+inline hb_font_t* LogicalFontInstance::GetHbFont()
+{
+ if (!m_pHbFont)
+ m_pHbFont = ImplInitHbFont();
+ return m_pHbFont;
+}
+
+inline void LogicalFontInstance::ReleaseHbFont()
+{
+ if (!m_pHbFont)
+ return;
+ hb_font_destroy(m_pHbFont);
+ m_pHbFont = nullptr;
+}
+
+inline void LogicalFontInstance::DecodeOpenTypeTag(const uint32_t nTableTag, char* pTagName)
+{
+ pTagName[0] = static_cast<char>(nTableTag >> 24);
+ pTagName[1] = static_cast<char>(nTableTag >> 16);
+ pTagName[2] = static_cast<char>(nTableTag >> 8);
+ pTagName[3] = static_cast<char>(nTableTag);
+ pTagName[4] = 0;
+}
+
#endif // INCLUDED_VCL_INC_FONTINSTANCE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */