configure.ac                            |    3 ++-
 vcl/inc/font/LogicalFontInstance.hxx    |    2 --
 vcl/source/font/LogicalFontInstance.cxx |   13 +------------
 vcl/source/gdi/CommonSalLayout.cxx      |    9 ++-------
 4 files changed, 5 insertions(+), 22 deletions(-)

New commits:
commit 6a006674c2cf62742ae0653f397aea1166fb43d8
Author:     Khaled Hosny <kha...@aliftype.com>
AuthorDate: Wed Feb 8 21:27:50 2023 +0200
Commit:     خالد حسني <kha...@aliftype.com>
CommitDate: Fri Feb 10 08:16:39 2023 +0000

    Require HarfBuzz 5.1.0
    
    This is the minimal version to provide the functionality we currently
    check for. Some important LO functionality currently depend on idfdef'd
    HarfBuzz code, and some distributions build against old system HarfBuzz
    leading to user bug reports that are tricky to track down, e.g:
    tdf#153048 and tdf#153470.
    
    Change-Id: I7d58ec46f8fd340d2592887c0088876d71351771
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146674
    Tested-by: Jenkins
    Reviewed-by: خالد حسني <kha...@aliftype.com>
    (cherry picked from commit 8c1e91444c78db1093c3db54d98efb16294f82ea)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146700
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>
    Tested-by: René Engelhard <r...@debian.org>

diff --git a/configure.ac b/configure.ac
index 734149364bbd..2fc55c588ac3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10848,6 +10848,7 @@ AC_SUBST(SYSTEM_LIBORCUS)
 dnl ===================================================================
 dnl HarfBuzz
 dnl ===================================================================
+harfbuzz_required_version=5.1.0
 
 GRAPHITE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/graphite/include 
-DGRAPHITE2_STATIC"
 GRAPHITE_LIBS_internal="-L${WORKDIR}/LinkTarget/StaticLibrary -lgraphite"
@@ -10855,7 +10856,7 @@ 
libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
 
 HARFBUZZ_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/harfbuzz/src"
 HARFBUZZ_LIBS_internal="-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs 
-lharfbuzz"
-libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 2.6.8])
+libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 
$harfbuzz_required_version])
 
 if test "$COM" = "MSC"; then # override the above
     GRAPHITE_LIBS="${WORKDIR}/LinkTarget/StaticLibrary/graphite.lib"
diff --git a/vcl/inc/font/LogicalFontInstance.hxx 
b/vcl/inc/font/LogicalFontInstance.hxx
index 6f4645c82c0c..c9e837d540f1 100644
--- a/vcl/inc/font/LogicalFontInstance.hxx
+++ b/vcl/inc/font/LogicalFontInstance.hxx
@@ -156,10 +156,8 @@ private:
     // The value is initialized and used in NeedOffsetCorrection().
     std::optional<FontFamilyEnum> m_xeFontFamilyEnum;
 
-#if HB_VERSION_ATLEAST(4, 0, 0)
     mutable hb_draw_funcs_t* m_pHbDrawFuncs = nullptr;
     basegfx::B2DPolygon m_aDrawPolygon;
-#endif
 };
 
 inline hb_font_t* LogicalFontInstance::GetHbFont()
diff --git a/vcl/source/font/LogicalFontInstance.cxx 
b/vcl/source/font/LogicalFontInstance.cxx
index 277edec2d96c..58b291d04bdf 100644
--- a/vcl/source/font/LogicalFontInstance.cxx
+++ b/vcl/source/font/LogicalFontInstance.cxx
@@ -54,10 +54,8 @@ LogicalFontInstance::~LogicalFontInstance()
     if (m_pHbFontUntransformed)
         hb_font_destroy(m_pHbFontUntransformed);
 
-#if HB_VERSION_ATLEAST(4, 0, 0)
     if (m_pHbDrawFuncs)
         hb_draw_funcs_destroy(m_pHbDrawFuncs);
-#endif
 }
 
 hb_font_t* LogicalFontInstance::InitHbFont()
@@ -75,12 +73,10 @@ hb_font_t* LogicalFontInstance::InitHbFont()
     if (!aVariations.empty())
         hb_font_set_variations(pHbFont, aVariations.data(), 
aVariations.size());
 
-#if HB_VERSION_ATLEAST(3, 3, 0)
     // If we are applying artificial italic, instruct HarfBuzz to do the same
     // so that mark positioning is also transformed.
     if (NeedsArtificialItalic())
         hb_font_set_synthetic_slant(pHbFont, ARTIFICIAL_ITALIC_SKEW);
-#endif
 
     ImplInitHbFont(pHbFont);
 
@@ -91,7 +87,6 @@ hb_font_t* LogicalFontInstance::GetHbFontUntransformed() const
 {
     auto* pHbFont = const_cast<LogicalFontInstance*>(this)->GetHbFont();
 
-#if HB_VERSION_ATLEAST(3, 3, 0)
     if (NeedsArtificialItalic()) // || NeedsArtificialBold()
     {
         if (!m_pHbFontUntransformed)
@@ -103,7 +98,7 @@ hb_font_t* LogicalFontInstance::GetHbFontUntransformed() 
const
         }
         return m_pHbFontUntransformed;
     }
-#endif
+
     return pHbFont;
 }
 
@@ -259,7 +254,6 @@ bool LogicalFontInstance::NeedsArtificialItalic() const
     return m_aFontSelData.GetItalic() != ITALIC_NONE && 
m_pFontFace->GetItalic() == ITALIC_NONE;
 }
 
-#if HB_VERSION_ATLEAST(4, 0, 0)
 namespace
 {
 void move_to_func(hb_draw_funcs_t*, void* /*pDrawData*/, hb_draw_state_t*, 
float to_x, float to_y,
@@ -294,12 +288,10 @@ void close_path_func(hb_draw_funcs_t*, void* pDrawData, 
hb_draw_state_t*, void*
     pPoly->clear();
 }
 }
-#endif
 
 bool LogicalFontInstance::GetGlyphOutlineUntransformed(sal_GlyphId nGlyph,
                                                        
basegfx::B2DPolyPolygon& rPolyPoly) const
 {
-#if HB_VERSION_ATLEAST(4, 0, 0)
     if (!m_pHbDrawFuncs)
     {
         m_pHbDrawFuncs = hb_draw_funcs_create();
@@ -316,9 +308,6 @@ bool 
LogicalFontInstance::GetGlyphOutlineUntransformed(sal_GlyphId nGlyph,
 
     hb_font_get_glyph_shape(GetHbFontUntransformed(), nGlyph, m_pHbDrawFuncs, 
&rPolyPoly);
     return true;
-#else
-    return false;
-#endif
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/CommonSalLayout.cxx 
b/vcl/source/gdi/CommonSalLayout.cxx
index 92b090222481..f4472726fcfe 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -421,10 +421,10 @@ bool 
GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay
             const int nRunLen = nEndRunPos - nMinRunPos;
 
             int nHbFlags = HB_BUFFER_FLAGS_DEFAULT;
-#if HB_VERSION_ATLEAST(5, 1, 0)
+
             // Produce HB_GLYPH_FLAG_SAFE_TO_INSERT_TATWEEL that we use below.
             nHbFlags |= HB_BUFFER_FLAG_PRODUCE_SAFE_TO_INSERT_TATWEEL;
-#endif
+
             if (nMinRunPos == 0)
                 nHbFlags |= HB_BUFFER_FLAG_BOT; /* Beginning-of-text */
             if (nEndRunPos == nLength)
@@ -545,13 +545,8 @@ bool 
GenericSalLayout::LayoutText(vcl::text::ImplLayoutArgs& rArgs, const SalLay
                 if (hb_glyph_info_get_glyph_flags(&pHbGlyphInfos[i]) & 
HB_GLYPH_FLAG_UNSAFE_TO_BREAK)
                     nGlyphFlags |= GlyphItemFlags::IS_UNSAFE_TO_BREAK;
 
-#if HB_VERSION_ATLEAST(5, 1, 0)
                 if (hb_glyph_info_get_glyph_flags(&pHbGlyphInfos[i]) & 
HB_GLYPH_FLAG_SAFE_TO_INSERT_TATWEEL)
                     nGlyphFlags |= GlyphItemFlags::IS_SAFE_TO_INSERT_KASHIDA;
-#else
-                // If support is not present, then allow kashida anywhere.
-                nGlyphFlags |= GlyphItemFlags::IS_SAFE_TO_INSERT_KASHIDA;
-#endif
 
                 DeviceCoordinate nAdvance, nXOffset, nYOffset;
                 if (aSubRun.maDirection == HB_DIRECTION_TTB)

Reply via email to