external/harfbuzz/0001-Fix-applying-synthetic-slight-to-glyph-origins-5629.patch.1
 |  102 ++++++++++
 external/harfbuzz/UnpackedTarball_harfbuzz.mk                                  
    |    1 
 2 files changed, 103 insertions(+)

New commits:
commit 68822e1bfe0ed83766f4166f8162aacc7e392191
Author:     Xisco Fauli <[email protected]>
AuthorDate: Thu Oct 30 09:59:59 2025 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Oct 30 11:22:08 2025 +0100

    tdf#167963: patch upstream fix
    
    See https://github.com/harfbuzz/harfbuzz/issues/5628
    
    Change-Id: I05bffb1d5e291bd2a5f92bb87aa49bd46d9dc6b8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193182
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git 
a/external/harfbuzz/0001-Fix-applying-synthetic-slight-to-glyph-origins-5629.patch.1
 
b/external/harfbuzz/0001-Fix-applying-synthetic-slight-to-glyph-origins-5629.patch.1
new file mode 100644
index 000000000000..ea5f5f4def12
--- /dev/null
+++ 
b/external/harfbuzz/0001-Fix-applying-synthetic-slight-to-glyph-origins-5629.patch.1
@@ -0,0 +1,102 @@
+From 6105bad18730fe05916b8b87903333d804ef8b84 Mon Sep 17 00:00:00 2001
+From: Khaled Hosny <[email protected]>
+Date: Wed, 29 Oct 2025 22:59:51 +0300
+Subject: [PATCH] Fix applying synthetic slight to glyph origins (#5629)
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+* Fix applying synthetic slight to glyph origins
+
+The hb_font_t::get_glyph_[h/v]_origins() methods were applying all the
+transformations to the first glyph in the buffer. This shows up for
+vertical text only because h_origin callback is usually unset.
+
+Fixes https://github.com/harfbuzz/harfbuzz/issues/5628
+
+* Don’t apply slant to glyph origin
+
+Per discussion in 
https://github.com/harfbuzz/harfbuzz/issues/5628#issuecomment-3459345504
+
+* Disable only font functions that fail
+---
+ src/hb-font.hh                                 | 16 ++++++----------
+ test/shape/data/in-house/meson.build           |  1 +
+ test/shape/data/in-house/tests/synthetic.tests |  3 +++
+ 3 files changed, 10 insertions(+), 10 deletions(-)
+ create mode 100644 test/shape/data/in-house/tests/synthetic.tests
+
+diff --git a/src/hb-font.hh b/src/hb-font.hh
+index f7f67af3b..d5626661b 100644
+--- a/src/hb-font.hh
++++ b/src/hb-font.hh
+@@ -508,9 +508,7 @@ struct hb_font_t
+       hb_position_t y_shift = y_scale < 0 ? -y_strength : y_strength;
+       for (unsigned i = 0; i < count; i++)
+       {
+-      /* Slant */
+-      if (slant_xy)
+-        *first_x += roundf (*first_y * slant_xy);
++      /* Slant is ignored as it does not affect glyph origin */
+ 
+       /* Embolden */
+       if (!embolden_in_place)
+@@ -518,9 +516,9 @@ struct hb_font_t
+         *first_x += x_shift;
+         *first_y += y_shift;
+       }
++      first_x = &StructAtOffsetUnaligned<hb_position_t> (first_x, x_stride);
++      first_y = &StructAtOffsetUnaligned<hb_position_t> (first_y, y_stride);
+       }
+-      first_x = &StructAtOffsetUnaligned<hb_position_t> (first_x, x_stride);
+-      first_y = &StructAtOffsetUnaligned<hb_position_t> (first_y, y_stride);
+     }
+ 
+     return ret;
+@@ -548,9 +546,7 @@ struct hb_font_t
+       hb_position_t y_shift = y_scale < 0 ? -y_strength : y_strength;
+       for (unsigned i = 0; i < count; i++)
+       {
+-      /* Slant */
+-      if (slant_xy)
+-        *first_x += roundf (*first_y * slant_xy);
++      /* Slant is ignored as it does not affect glyph origin */
+ 
+       /* Embolden */
+       if (!embolden_in_place)
+@@ -558,9 +554,9 @@ struct hb_font_t
+         *first_x += x_shift;
+         *first_y += y_shift;
+       }
++      first_x = &StructAtOffsetUnaligned<hb_position_t> (first_x, x_stride);
++      first_y = &StructAtOffsetUnaligned<hb_position_t> (first_y, y_stride);
+       }
+-      first_x = &StructAtOffsetUnaligned<hb_position_t> (first_x, x_stride);
+-      first_y = &StructAtOffsetUnaligned<hb_position_t> (first_y, y_stride);
+     }
+ 
+     return ret;
+diff --git a/test/shape/data/in-house/meson.build 
b/test/shape/data/in-house/meson.build
+index 0da9c1279..a3c87d752 100644
+--- a/test/shape/data/in-house/meson.build
++++ b/test/shape/data/in-house/meson.build
+@@ -64,6 +64,7 @@ in_house_tests = [
+   'simple.tests',
+   'sinhala.tests',
+   'spaces.tests',
++  'synthetic.tests',
+   'tibetan-contractions-1.tests',
+   'tibetan-contractions-2.tests',
+   'tibetan-vowels.tests',
+diff --git a/test/shape/data/in-house/tests/synthetic.tests 
b/test/shape/data/in-house/tests/synthetic.tests
+new file mode 100644
+index 000000000..4b11a6a33
+--- /dev/null
++++ b/test/shape/data/in-house/tests/synthetic.tests
+@@ -0,0 +1,3 @@
++@font-funcs-=coretext,ft,directwrite # TODO investigate why these font funcs 
fail
++../fonts/NotoSans-VF.abc.ttf;--font-slant=0.5 
--direction=ttb;U+0061,U+0062,U+0063;[gid1=0@-280,-948+0,-1362|gid2=1@-307,-1056+0,-1362|gid3=2@-240,-949+0,-1362]
++../fonts/NotoSans-VF.abc.ttf;--font-bold=0.1 
--direction=ttb;U+0061,U+0062,U+0063;[gid1=0@-430,-1148+0,-1362|gid2=1@-457,-1256+0,-1362|gid3=2@-390,-1149+0,-1362]
+-- 
+2.39.5
+
diff --git a/external/harfbuzz/UnpackedTarball_harfbuzz.mk 
b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
index b3b63944d0dc..2999c2d8c3fe 100644
--- a/external/harfbuzz/UnpackedTarball_harfbuzz.mk
+++ b/external/harfbuzz/UnpackedTarball_harfbuzz.mk
@@ -17,6 +17,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,harfbuzz,0))
 
 $(eval $(call gb_UnpackedTarball_add_patches,harfbuzz, \
     external/harfbuzz/harfbuzz_visibility.patch.1 \
+       
external/harfbuzz/0001-Fix-applying-synthetic-slight-to-glyph-origins-5629.patch.1
 \
 ))
 
 # meson will replace python3 from shebang in build commands with the

Reply via email to