diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-29 13:32:03 +0000 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-10-30 12:45:47 +0100 |
commit | 71507ba3eb4bc6e8b36cd66b865c49a1b66b787e (patch) | |
tree | 009ba1c21f8d0f94e9fcda83c84358568239e890 /vcl/source/gdi/CommonSalLayout.cxx | |
parent | adf71090c94b90d95d3b320e070d53b7071751cd (diff) |
tdf#120982 add font reference to SalLayoutGlyphsImpl
Now that we store the LogicalFontInstance instead of the fallback
level, it's not enough to keep a pointer in the glyphs in
SalLayoutGlyphsImpl. We also need a reference to the font, to
keep the font instance alive.
Change-Id: Idc99cf9259af6be672a97ab2c67dbffd9cf29c70
Reviewed-on: https://gerrit.libreoffice.org/62520
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/source/gdi/CommonSalLayout.cxx')
-rw-r--r-- | vcl/source/gdi/CommonSalLayout.cxx | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index 0fc540fcb823..21d4d1c22ad3 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -57,11 +57,10 @@ static hb_unicode_funcs_t* getUnicodeFuncs() #endif GenericSalLayout::GenericSalLayout(LogicalFontInstance &rFont) - : mpFont(&rFont) - , mpVertGlyphs(nullptr) + : mpVertGlyphs(nullptr) , mbFuzzing(utl::ConfigManager::IsFuzzing()) { - new SalLayoutGlyphsImpl(m_GlyphItems); + new SalGenericLayoutGlyphsImpl(m_GlyphItems, rFont); } GenericSalLayout::~GenericSalLayout() @@ -230,7 +229,7 @@ void GenericSalLayout::DrawText(SalGraphics& rSalGraphics) const bool GenericSalLayout::HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aVariationSelector) { hb_codepoint_t nGlyphIndex = 0; - hb_font_t *pHbFont = mpFont->GetHbFont(); + hb_font_t *pHbFont = GetFont().GetHbFont(); if (!hb_font_get_glyph(pHbFont, aChar, aVariationSelector, &nGlyphIndex)) return false; @@ -277,7 +276,7 @@ bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs, const SalLayoutGlyphs* return true; } - hb_font_t *pHbFont = mpFont->GetHbFont(); + hb_font_t *pHbFont = GetFont().GetHbFont(); int nGlyphCapacity = 2 * (rArgs.mnEndCharPos - rArgs.mnMinCharPos); m_GlyphItems.Impl()->reserve(nGlyphCapacity); @@ -304,7 +303,7 @@ bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs, const SalLayoutGlyphs* hb_buffer_set_unicode_funcs(pHbBuffer, pHbUnicodeFuncs); #endif - const FontSelectPattern& rFontSelData = mpFont->GetFontSelectPattern(); + const FontSelectPattern& rFontSelData = GetFont().GetFontSelectPattern(); if (rArgs.mnFlags & SalLayoutFlags::DisableKerning) { SAL_INFO("vcl.harfbuzz", "Disabling kerning for font: " << rFontSelData.maTargetName); @@ -315,7 +314,7 @@ bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs, const SalLayoutGlyphs* double nXScale = 0; double nYScale = 0; - mpFont->GetScale(&nXScale, &nYScale); + GetFont().GetScale(&nXScale, &nYScale); Point aCurrPos(0, 0); while (true) @@ -571,7 +570,7 @@ bool GenericSalLayout::LayoutText(ImplLayoutArgs& rArgs, const SalLayoutGlyphs* Point aNewPos(aCurrPos.X() + nXOffset, aCurrPos.Y() + nYOffset); const GlyphItem aGI(nCharPos, nCharCount, nGlyphIndex, aNewPos, nGlyphFlags, - nAdvance, nXOffset, mpFont.get()); + nAdvance, nXOffset, &GetFont()); m_GlyphItems.Impl()->push_back(aGI); aCurrPos.AdjustX(nAdvance ); @@ -644,10 +643,10 @@ void GenericSalLayout::ApplyDXArray(ImplLayoutArgs& rArgs) hb_codepoint_t nKashidaIndex = 0; if (rArgs.mnFlags & SalLayoutFlags::KashidaJustification) { - hb_font_t *pHbFont = mpFont->GetHbFont(); + hb_font_t *pHbFont = GetFont().GetHbFont(); // Find Kashida glyph width and index. if (hb_font_get_glyph(pHbFont, 0x0640, 0, &nKashidaIndex)) - nKashidaWidth = mpFont->GetKashidaWidth(); + nKashidaWidth = GetFont().GetKashidaWidth(); bKashidaJustify = nKashidaWidth != 0; } @@ -768,7 +767,7 @@ void GenericSalLayout::ApplyDXArray(ImplLayoutArgs& rArgs) int const nFlags = GlyphItem::IS_IN_CLUSTER | GlyphItem::IS_RTL_GLYPH; while (nCopies--) { - GlyphItem aKashida(nCharPos, 0, nKashidaIndex, aPos, nFlags, nKashidaWidth, 0, mpFont.get()); + GlyphItem aKashida(nCharPos, 0, nKashidaIndex, aPos, nFlags, nKashidaWidth, 0, &GetFont()); pGlyphIter = m_GlyphItems.Impl()->insert(pGlyphIter, aKashida); aPos.AdjustX(nKashidaWidth ); aPos.AdjustX( -nOverlap ); |