summaryrefslogtreecommitdiff
path: root/vcl/unx/generic
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@libreoffice.org>2023-07-16 07:37:55 +0300
committerخالد حسني <khaled@libreoffice.org>2023-07-23 06:00:30 +0200
commitdfe42e756b37642355356a6035081f4473609832 (patch)
tree77a42535ddef1f76802fa4221f33fd97755bb2ff /vcl/unx/generic
parent32144b5dc617d5a375eeadf25b5b62befb529785 (diff)
vcl: Use HarfBuzz to get glyph bounding rectangle
For consistent cross-platform results that also matches our glyph advances since platform functions might be using hints which we don’t use. Change-Id: I4aebd3e7c5f460dff584f5eba74f7a11bab0f9b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154388 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
Diffstat (limited to 'vcl/unx/generic')
-rw-r--r--vcl/unx/generic/glyphs/freetype_glyphcache.cxx38
-rw-r--r--vcl/unx/generic/glyphs/glyphcache.cxx8
2 files changed, 0 insertions, 46 deletions
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index bc73ed0168a9..2543b76b5719 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -596,44 +596,6 @@ void FreetypeFont::ApplyGlyphTransform(bool bVertical, FT_Glyph pGlyphFT ) const
}
}
-bool FreetypeFont::GetGlyphBoundRect(sal_GlyphId nID, tools::Rectangle& rRect, bool bVertical) const
-{
- FT_Activate_Size( maSizeFT );
-
- FT_Error rc = FT_Load_Glyph(maFaceFT, nID, mnLoadFlags);
-
- if (rc != FT_Err_Ok)
- return false;
-
- if (mrFontInstance.NeedsArtificialBold())
- FT_GlyphSlot_Embolden(maFaceFT->glyph);
-
- FT_Glyph pGlyphFT;
- rc = FT_Get_Glyph(maFaceFT->glyph, &pGlyphFT);
- if (rc != FT_Err_Ok)
- return false;
-
- ApplyGlyphTransform(bVertical, pGlyphFT);
-
- FT_BBox aBbox;
- FT_Glyph_Get_CBox( pGlyphFT, FT_GLYPH_BBOX_PIXELS, &aBbox );
- FT_Done_Glyph( pGlyphFT );
-
- tools::Rectangle aRect(aBbox.xMin, -aBbox.yMax, aBbox.xMax, -aBbox.yMin);
- if (mnCos != 0x10000 && mnSin != 0)
- {
- const double nCos = mnCos / 65536.0;
- const double nSin = mnSin / 65536.0;
- rRect.SetLeft( nCos*aRect.Left() + nSin*aRect.Top() );
- rRect.SetTop( -nSin*aRect.Left() - nCos*aRect.Top() );
- rRect.SetRight( nCos*aRect.Right() + nSin*aRect.Bottom() );
- rRect.SetBottom( -nSin*aRect.Right() - nCos*aRect.Bottom() );
- }
- else
- rRect = aRect;
- return true;
-}
-
bool FreetypeFont::GetAntialiasAdvice() const
{
// TODO: also use GASP info
diff --git a/vcl/unx/generic/glyphs/glyphcache.cxx b/vcl/unx/generic/glyphs/glyphcache.cxx
index 39b10c78e123..ac3c5e15ab73 100644
--- a/vcl/unx/generic/glyphs/glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/glyphcache.cxx
@@ -75,14 +75,6 @@ FreetypeFontInstance::~FreetypeFontInstance()
{
}
-bool FreetypeFontInstance::ImplGetGlyphBoundRect(sal_GlyphId nId, tools::Rectangle& rRect, bool bVertical) const
-{
- assert(mxFreetypeFont);
- if (!mxFreetypeFont)
- return false;
- return mxFreetypeFont->GetGlyphBoundRect(nId, rRect, bVertical);
-}
-
bool FreetypeFontInstance::GetGlyphOutline(sal_GlyphId nId, basegfx::B2DPolyPolygon& rPoly, bool bVertical) const
{
assert(mxFreetypeFont);