diff options
-rw-r--r-- | vcl/inc/fontinstance.hxx | 2 | ||||
-rw-r--r-- | vcl/source/font/fontinstance.cxx | 43 |
2 files changed, 3 insertions, 42 deletions
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; |