summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorخالد حسني <khaled@aliftype.com>2022-09-06 00:10:04 +0200
committerخالد حسني <khaled@aliftype.com>2022-09-06 00:50:39 +0200
commit47981aeb3a233a01a8b099d3fe2c3f5a8a9cfb7b (patch)
treeb152d6156291cc3564c63a9784668cb427e35720 /vcl/source
parent875aff18fb58767e909664fb81510a8853ad32c8 (diff)
Revert "vcl: Add LogicalFontInstance::GetUnscaledGLyphWidth()"
This reverts commit fa1835db77b38047d8c3cea7041d38762c329867. Reason for revert: merged too early Change-Id: I7dba2e8fcc06db59b2cbc211a0f4e7d1f209aa05 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139428 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@aliftype.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/font/LogicalFontInstance.cxx11
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx16
2 files changed, 14 insertions, 13 deletions
diff --git a/vcl/source/font/LogicalFontInstance.cxx b/vcl/source/font/LogicalFontInstance.cxx
index 542a814fb9ac..0936bb7286b9 100644
--- a/vcl/source/font/LogicalFontInstance.cxx
+++ b/vcl/source/font/LogicalFontInstance.cxx
@@ -37,7 +37,6 @@ 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))
{
@@ -51,8 +50,6 @@ LogicalFontInstance::~LogicalFontInstance()
if (m_pHbFont)
hb_font_destroy(m_pHbFont);
- if (m_pUnscaledHbFont)
- hb_font_destroy(m_pUnscaledHbFont);
}
hb_font_t* LogicalFontInstance::InitHbFont()
@@ -153,14 +150,6 @@ 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)
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index dc5e443374ba..f1c01944a48f 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -3905,7 +3905,13 @@ void PDFWriterImpl::createDefaultCheckBoxAppearance( PDFWidget& rBox, const PDFW
const GlyphItem aItem(0, 0, pMap->GetGlyphIndex(cMark),
DevicePoint(), GlyphItemFlags::NONE, 0, 0, 0);
const std::vector<sal_Ucs> aCodeUnits={ cMark };
- sal_Int32 nGlyphWidth = GetFontInstance()->GetUnscaledGlyphWidth(aItem.glyphId(), aItem.IsVertical());
+ sal_Int32 nGlyphWidth = 0;
+ SalGraphics *pGraphics = GetGraphics();
+ if (pGraphics)
+ nGlyphWidth = m_aFontCache.getGlyphWidth(pDevFont,
+ aItem.glyphId(),
+ aItem.IsVertical(),
+ pGraphics);
sal_uInt8 nMappedGlyph;
sal_Int32 nMappedFontObject;
@@ -6296,7 +6302,13 @@ void PDFWriterImpl::drawLayout( SalLayout& rLayout, const OUString& rText, bool
assert(!aCodeUnits.empty() || bUseActualText || pGlyph->IsInCluster());
- sal_Int32 nGlyphWidth = GetFontInstance()->GetUnscaledGlyphWidth(pGlyph->glyphId(), pGlyph->IsVertical());
+ sal_Int32 nGlyphWidth = 0;
+ SalGraphics *pGraphics = GetGraphics();
+ if (pGraphics)
+ nGlyphWidth = m_aFontCache.getGlyphWidth(pFont,
+ pGlyph->glyphId(),
+ pGlyph->IsVertical(),
+ pGraphics);
sal_uInt8 nMappedGlyph;
sal_Int32 nMappedFontObject;