summaryrefslogtreecommitdiff
path: root/vcl/source/font/LogicalFontInstance.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/font/LogicalFontInstance.cxx')
-rw-r--r--vcl/source/font/LogicalFontInstance.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/vcl/source/font/LogicalFontInstance.cxx b/vcl/source/font/LogicalFontInstance.cxx
index 0936bb7286b9..542a814fb9ac 100644
--- a/vcl/source/font/LogicalFontInstance.cxx
+++ b/vcl/source/font/LogicalFontInstance.cxx
@@ -37,6 +37,7 @@ LogicalFontInstance::LogicalFontInstance(const vcl::font::PhysicalFontFace& rFon
, mpFontCache(nullptr)
, m_aFontSelData(rFontSelData)
, m_pHbFont(nullptr)
+ , m_pUnscaledHbFont(nullptr)
, m_nAveWidthFactor(1.0f)
, m_pFontFace(&const_cast<vcl::font::PhysicalFontFace&>(rFontFace))
{
@@ -50,6 +51,8 @@ LogicalFontInstance::~LogicalFontInstance()
if (m_pHbFont)
hb_font_destroy(m_pHbFont);
+ if (m_pUnscaledHbFont)
+ hb_font_destroy(m_pUnscaledHbFont);
}
hb_font_t* LogicalFontInstance::InitHbFont()
@@ -150,6 +153,14 @@ bool LogicalFontInstance::GetGlyphBoundRect(sal_GlyphId nID, tools::Rectangle& r
return res;
}
+sal_Int32 LogicalFontInstance::GetUnscaledGlyphWidth(sal_GlyphId nGlyph, bool bVertical) const
+{
+ auto* pHbFont = const_cast<LogicalFontInstance*>(this)->GetUnscaledHbFont();
+ if (bVertical)
+ hb_font_get_glyph_v_advance(pHbFont, nGlyph);
+ return hb_font_get_glyph_h_advance(pHbFont, nGlyph);
+}
+
bool LogicalFontInstance::IsGraphiteFont()
{
if (!m_xbIsGraphiteFont)