Nikolay Sivov : dwrite: Fix setting canBreakShapingAfter when applying ligatures.

Alexandre Julliard julliard at winehq.org
Thu Feb 11 15:37:14 CST 2021


Module: wine
Branch: master
Commit: b91548d05955cf8e29e95b0397087bb6ed33c5b8
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b91548d05955cf8e29e95b0397087bb6ed33c5b8

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Feb 11 11:10:18 2021 +0300

dwrite: Fix setting canBreakShapingAfter when applying ligatures.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dwrite/opentype.c | 28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index 7dc4a1f7b55..8885306a84d 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -5126,10 +5126,28 @@ static BOOL opentype_layout_context_match_input(const struct match_context *mc,
     return TRUE;
 }
 
-static void opentype_layout_unsafe_to_break(struct scriptshaping_context *context, unsigned int idx)
+/* Marks text segment as unsafe to break between [start, end) glyphs. */
+static void opentype_layout_unsafe_to_break(struct scriptshaping_context *context, unsigned int start,
+        unsigned int end)
 {
-    if (context->u.buffer.glyph_props[idx].isClusterStart)
-        context->u.buffer.text_props[context->glyph_infos[idx].start_text_idx].canBreakShapingAfter = 0;
+    unsigned int i;
+
+    while (start && !context->u.buffer.glyph_props[start].isClusterStart)
+        --start;
+
+    while (--end && !context->u.buffer.glyph_props[end].isClusterStart)
+        ;
+
+    if (start == end)
+    {
+        context->u.buffer.text_props[context->glyph_infos[start].start_text_idx].canBreakShapingAfter = 0;
+        return;
+    }
+
+    for (i = context->glyph_infos[start].start_text_idx; i < context->glyph_infos[end].start_text_idx; ++i)
+    {
+        context->u.buffer.text_props[i].canBreakShapingAfter = 0;
+    }
 }
 
 static void opentype_layout_delete_glyph(struct scriptshaping_context *context, unsigned int idx)
@@ -5194,10 +5212,8 @@ static BOOL opentype_layout_apply_ligature(struct scriptshaping_context *context
         {
             context->u.buffer.glyph_props[j++].lig_component = comp_count - i;
         }
-        opentype_layout_unsafe_to_break(context, i);
-        context->u.buffer.glyph_props[i].isClusterStart = 0;
-        context->glyph_infos[i].start_text_idx = 0;
     }
+    opentype_layout_unsafe_to_break(context, match_positions[0], match_positions[comp_count - 1] + 1);
 
     /* Delete ligated glyphs, backwards to preserve index. */
     for (i = 1; i < comp_count; ++i)




More information about the wine-cvs mailing list