File 0002-Revert-Require-HarfBuzz-5.1.0.patch of Package libreoffice.31324

--- libreoffice-7.6.0.1/configure.ac	2023-08-07 21:28:19.740514309 +0200
+++ libreoffice-7.6.0.1/configure.ac	2023-08-07 21:28:32.847268581 +0200
@@ -10868,7 +10868,7 @@
 dnl ===================================================================
 dnl HarfBuzz
 dnl ===================================================================
-harfbuzz_required_version=5.1.0
+harfbuzz_required_version=0.93
 
 GRAPHITE_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/graphite/include -DGRAPHITE2_STATIC"
 HARFBUZZ_CFLAGS_internal="-I${WORKDIR}/UnpackedTarball/harfbuzz/src"
--- libreoffice-7.6.0.1/vcl/inc/font/LogicalFontInstance.hxx	2023-08-07 21:28:16.093823265 +0200
+++ libreoffice-7.6.0.1/vcl/inc/font/LogicalFontInstance.hxx	2023-08-07 21:28:32.847268581 +0200
@@ -156,8 +156,10 @@
     // 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()
--- libreoffice-7.6.0.1/vcl/source/font/LogicalFontInstance.cxx	2023-08-07 21:28:15.910488707 +0200
+++ libreoffice-7.6.0.1/vcl/source/font/LogicalFontInstance.cxx	2023-08-07 21:31:44.758551351 +0200
@@ -54,8 +54,10 @@
     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()
@@ -73,10 +75,12 @@
     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);
 
@@ -87,6 +91,7 @@
 {
     auto* pHbFont = const_cast<LogicalFontInstance*>(this)->GetHbFont();
 
+#if HB_VERSION_ATLEAST(3, 3, 0)
     if (NeedsArtificialItalic()) // || NeedsArtificialBold()
     {
         if (!m_pHbFontUntransformed)
@@ -98,7 +103,7 @@
         }
         return m_pHbFontUntransformed;
     }
-
+#endif
     return pHbFont;
 }
 
@@ -254,6 +259,7 @@
     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,
@@ -288,9 +294,12 @@
     pPoly->clear();
 }
 }
+#endif
 
 basegfx::B2DPolyPolygon LogicalFontInstance::GetGlyphOutlineUntransformed(sal_GlyphId nGlyph) const
 {
+    basegfx::B2DPolyPolygon aPolyPoly;
+#if HB_VERSION_ATLEAST(4, 0, 0)
     if (!m_pHbDrawFuncs)
     {
         m_pHbDrawFuncs = hb_draw_funcs_create();
@@ -305,12 +314,12 @@
         hb_draw_funcs_set_close_path_func(m_pHbDrawFuncs, close_path_func, pUserData, nullptr);
     }
 
-    basegfx::B2DPolyPolygon aPolyPoly;
 #if HB_VERSION_ATLEAST(7, 0, 0)
     hb_font_draw_glyph(GetHbFontUntransformed(), nGlyph, m_pHbDrawFuncs, &aPolyPoly);
 #else
     hb_font_get_glyph_shape(GetHbFontUntransformed(), nGlyph, m_pHbDrawFuncs, &aPolyPoly);
 #endif
+#endif
     return aPolyPoly;
 }
 
--- libreoffice-7.6.0.1/vcl/source/gdi/CommonSalLayout.cxx	2023-08-07 21:28:15.910488707 +0200
+++ libreoffice-7.6.0.1/vcl/source/gdi/CommonSalLayout.cxx	2023-08-07 21:28:32.850601937 +0200
@@ -421,10 +421,10 @@
             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,8 +545,13 @@
                 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)
openSUSE Build Service is sponsored by