external/harfbuzz/3874.patch.1                |   47 ++++++++++++++++++++++++++
 external/harfbuzz/UnpackedTarball_harfbuzz.mk |    5 ++
 tools/source/generic/poly.cxx                 |    4 +-
 vcl/source/gdi/impglyphitem.cxx               |    4 --
 4 files changed, 54 insertions(+), 6 deletions(-)

New commits:
commit b7badb551990addaa10960a3557c8f83732a560e
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Nov 16 20:17:48 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Nov 17 10:31:35 2022 +0100

    use harfbuzz upstream fix instead of workaround
    
    drop temp workaround for problem seen with tdf119074-1.odt
    
    i.e. apply https://github.com/harfbuzz/harfbuzz/pull/3874
    for https://github.com/harfbuzz/harfbuzz/issues/3824
    
    Change-Id: I42373f2282d30d7e45ee88b654d3df40f3a6384b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142815
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/external/harfbuzz/3874.patch.1 b/external/harfbuzz/3874.patch.1
new file mode 100644
index 000000000000..74dd91086ad6
--- /dev/null
+++ b/external/harfbuzz/3874.patch.1
@@ -0,0 +1,47 @@
+From 26efeceefab9c45b080c3636daaf9452779c79c7 Mon Sep 17 00:00:00 2001
+From: Behdad Esfahbod <beh...@behdad.org>
+Date: Fri, 11 Nov 2022 12:45:12 -0700
+Subject: [PATCH] [GPOS.PairPos] Adjust unsafe-to-break for non-zero
+ ValueFormat2
+
+Fixes https://github.com/harfbuzz/harfbuzz/issues/3824
+---
+ src/OT/Layout/GPOS/PairPosFormat2.hh | 4 ++++
+ src/OT/Layout/GPOS/PairSet.hh        | 7 ++++++-
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/src/OT/Layout/GPOS/PairPosFormat2.hh 
b/src/OT/Layout/GPOS/PairPosFormat2.hh
+index 83b093b988..1bb0d60ae2 100644
+--- a/src/OT/Layout/GPOS/PairPosFormat2.hh
++++ b/src/OT/Layout/GPOS/PairPosFormat2.hh
+@@ -244,7 +244,11 @@ struct PairPosFormat2_4
+ 
+     buffer->idx = skippy_iter.idx;
+     if (len2)
++    {
+       buffer->idx++;
++      // https://github.com/harfbuzz/harfbuzz/issues/3824
++      buffer->unsafe_to_break (buffer->idx - 1, buffer->idx + 1);
++    }
+ 
+     return_trace (true);
+   }
+diff --git a/src/OT/Layout/GPOS/PairSet.hh b/src/OT/Layout/GPOS/PairSet.hh
+index aa48d933c3..b1d9f83bc9 100644
+--- a/src/OT/Layout/GPOS/PairSet.hh
++++ b/src/OT/Layout/GPOS/PairSet.hh
+@@ -128,8 +128,13 @@ struct PairSet
+ 
+       if (applied_first || applied_second)
+         buffer->unsafe_to_break (buffer->idx, pos + 1);
++
+       if (len2)
+-        pos++;
++      {
++      pos++;
++      // https://github.com/harfbuzz/harfbuzz/issues/3824
++      buffer->unsafe_to_break (pos - 1, pos + 1);
++      }
+ 
+       buffer->idx = pos;
+       return_trace (true);
diff --git a/external/harfbuzz/UnpackedTarball_harfbuzz.mk 
b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
index a99f116d80ad..969a7ca2c51c 100644
--- a/external/harfbuzz/UnpackedTarball_harfbuzz.mk
+++ b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
@@ -15,4 +15,9 @@ $(eval $(call 
gb_UnpackedTarball_update_autoconf_configs,harfbuzz))
 
 $(eval $(call gb_UnpackedTarball_set_patchlevel,harfbuzz,0))
 
+#   <https://github.com/harfbuzz/harfbuzz/pull/3874> "Adjust unsafe-to-break 
for non-zero ValueFormat2":
+$(eval $(call gb_UnpackedTarball_add_patches,harfbuzz, \
+    external/harfbuzz/3874.patch.1 \
+))
+
 # vim: set noet sw=4 ts=4:
diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index 4ca745f6063c..34e1f5a4d187 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -327,10 +327,6 @@ SalLayoutGlyphsCache::GetLayoutGlyphs(VclPtr<const 
OutputDevice> outputDevice, c
     if (nLen == 0)
         return nullptr;
     const CachedGlyphsKey key(outputDevice, text, nIndex, nLen, nLogicWidth);
-    // for now disable if the font is the one seen in tdf#119074
-    // https://github.com/harfbuzz/harfbuzz/issues/3824
-    if (key.fontMetric.GetFamilyName() == "XB Roya")
-        return nullptr;
     GlyphsCache::const_iterator it = mCachedGlyphs.find(key);
     if (it != mCachedGlyphs.end())
     {
commit c2fc5d4fc042460eaac1d6407f45d2f0073bf6a7
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Nov 16 20:04:47 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Nov 17 10:31:21 2022 +0100

    ofz#53450 Integer-overflow
    
    Change-Id: I106e703714083631c67d7b8a84180c3c485953d9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142814
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 2c12ad777ec1..ae3465a2ce22 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -1432,8 +1432,8 @@ void Polygon::Rotate( const Point& rCenter, double fSin, 
double fCos )
 
         const tools::Long nX = rPt.X() - nCenterX;
         const tools::Long nY = rPt.Y() - nCenterY;
-        rPt.setX( FRound( fCos * nX + fSin * nY ) + nCenterX );
-        rPt.setY( - FRound( fSin * nX - fCos * nY ) + nCenterY );
+        rPt.setX( FRound(fCos * nX + fSin * nY + nCenterX) );
+        rPt.setY( - FRound(fSin * nX - fCos * nY - nCenterY) );
     }
 }
 

Reply via email to