vcl/inc/fontinstance.hxx | 2 - vcl/source/font/fontinstance.cxx | 43 +-------------------------------------- 2 files changed, 3 insertions(+), 42 deletions(-)
New commits: commit 4ce644feaa732e9f306e6c53300e024ac2a11bb7 Author: Khaled Hosny <khaledho...@eglug.org> AuthorDate: Sat Sep 21 23:12:49 2019 +0200 Commit: Khaled Hosny <khaledho...@eglug.org> CommitDate: Sun Sep 22 07:34:44 2019 +0200 tdf#127325: Revert "Use HarfBuzz to get glyph bounding rectangle" This reverts commit 502d73cda8fa1f482634bb6435fd1440757fdad9. Change-Id: Ib1a318e6d9a722f9ca056ba1df3a6f2ab19855e5 Reviewed-on: https://gerrit.libreoffice.org/79323 Tested-by: Jenkins Reviewed-by: Khaled Hosny <khaledho...@eglug.org> diff --git a/vcl/inc/fontinstance.hxx b/vcl/inc/fontinstance.hxx index b57955f82a9e..da5af02b1089 100644 --- a/vcl/inc/fontinstance.hxx +++ b/vcl/inc/fontinstance.hxx @@ -71,7 +71,7 @@ public: // TODO: make data members private const PhysicalFontFace* GetFontFace() const { return m_pFontFace.get(); } const ImplFontCache* GetFontCache() const { return mpFontCache; } - bool GetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool); + bool GetGlyphBoundRect(sal_GlyphId, tools::Rectangle&, bool) const; virtual bool GetGlyphOutline(sal_GlyphId, basegfx::B2DPolyPolygon&, bool) const = 0; int GetKashidaWidth(); diff --git a/vcl/source/font/fontinstance.cxx b/vcl/source/font/fontinstance.cxx index 808f2d0a5c27..58d72083f130 100644 --- a/vcl/source/font/fontinstance.cxx +++ b/vcl/source/font/fontinstance.cxx @@ -144,51 +144,12 @@ void LogicalFontInstance::IgnoreFallbackForUnicode( sal_UCS4 cChar, FontWeight e mpUnicodeFallbackList->erase( it ); } -bool LogicalFontInstance::GetGlyphBoundRect(sal_GlyphId nID, tools::Rectangle &rRect, bool bVertical) +bool LogicalFontInstance::GetGlyphBoundRect(sal_GlyphId nID, tools::Rectangle &rRect, bool bVertical) const { if (mpFontCache && mpFontCache->GetCachedGlyphBoundRect(this, nID, rRect)) return true; - hb_font_t* pHbFont = GetHbFont(); - hb_glyph_extents_t aExtents; - bool res = hb_font_get_glyph_extents(pHbFont, nID, &aExtents); - if (res) - { - double nXScale = 0, nYScale = 0; - GetScale(&nXScale, &nYScale); - - double fMinX = aExtents.x_bearing; - double fMinY = aExtents.y_bearing; - double fMaxX = aExtents.x_bearing + aExtents.width; - double fMaxY = aExtents.y_bearing + aExtents.height; - - tools::Rectangle aRect( std::floor(fMinX * nXScale), - -std::ceil(fMinY * nYScale), - std::ceil(fMaxX * nXScale), - -std::floor(fMaxY * nYScale)); - - if (mnOrientation && !bVertical) - { - // Apply font rotation. - const double fRad = basegfx::deg2rad(mnOrientation); - const double fCos = cos(fRad); - const double fSin = sin(fRad); - - rRect.SetLeft( fCos * aRect.Left() + fSin * aRect.Top()); - rRect.SetTop( -fSin * aRect.Left() - fCos * aRect.Top()); - rRect.SetRight( fCos * aRect.Right() + fSin * aRect.Bottom()); - rRect.SetBottom(-fSin * aRect.Right() - fCos * aRect.Bottom()); - } - else - rRect = aRect; - } - else - { - // Fallback to platform implementations. - // TODO: remove once we require HarfBuzz >= 2.3.0 - res = ImplGetGlyphBoundRect(nID, rRect, bVertical); - } - + bool res = ImplGetGlyphBoundRect(nID, rRect, bVertical); if (mpFontCache && res) mpFontCache->CacheGlyphBoundRect(this, nID, rRect); return res; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits