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

New commits:
commit cbdcc18778f9736ca6f186e2bbb9f0db456b1cee
Author:     Khaled Hosny <kha...@aliftype.com>
AuthorDate: Wed Feb 8 21:27:50 2023 +0200
Commit:     خالد حسني <kha...@aliftype.com>
CommitDate: Thu Feb 9 16:42:46 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>

diff --git a/configure.ac b/configure.ac
index c232686dc696..ed0e05d6a7b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10820,6 +10820,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"
@@ -10828,11 +10829,11 @@ 
HARFBUZZ_LIBS_internal="-L${WORKDIR}/UnpackedTarball/harfbuzz/src/.libs -lharfbu
 case "$_os" in
     Linux)
         libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 
0.9.3],,,TRUE)
-        libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 
0.9.42],,,TRUE)
+        libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 
$harfbuzz_required_version],,,TRUE)
         ;;
     *)
         libo_CHECK_SYSTEM_MODULE([graphite],[GRAPHITE],[graphite2 >= 0.9.3])
-        libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 
0.9.42])
+        libo_CHECK_SYSTEM_MODULE([harfbuzz],[HARFBUZZ],[harfbuzz-icu >= 
$harfbuzz_required_version])
         ;;
 esac
 
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 5997ea375192..0c6043a91869 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