Nikolay Sivov : dwrite: Use attachment chain for marks positioning.

Alexandre Julliard julliard at winehq.org
Mon Feb 8 15:46:41 CST 2021


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Feb  8 10:09:41 2021 +0300

dwrite: Use attachment chain for marks positioning.

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, 27 insertions(+), 1 deletion(-)

diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index 5fd341e8c94..2f254607653 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -479,6 +479,7 @@ enum gsub_gpos_lookup_flags
 enum attach_type
 {
     GLYPH_ATTACH_NONE = 0,
+    GLYPH_ATTACH_MARK,
     GLYPH_ATTACH_CURSIVE,
 };
 
@@ -4221,6 +4222,10 @@ static BOOL opentype_layout_apply_mark_array(struct scriptshaping_context *conte
     else
         context->offsets[context->cur].advanceOffset = -context->advances[glyph_pos] + base_x - mark_x;
     context->offsets[context->cur].ascenderOffset = base_y - mark_y;
+    opentype_set_glyph_attach_type(context, context->cur, GLYPH_ATTACH_MARK);
+    context->glyph_infos[context->cur].attach_chain = (int)glyph_pos - (int)context->cur;
+    context->has_gpos_attachment = 1;
+
     context->cur++;
 
     return TRUE;
@@ -4781,7 +4786,7 @@ static void opentype_propagate_attachment_offsets(struct scriptshaping_context *
 {
     enum attach_type type = opentype_get_glyph_attach_type(context, i);
     int chain = context->glyph_infos[i].attach_chain;
-    unsigned int j;
+    unsigned int j, k;
 
     if (!chain)
         return;
@@ -4799,6 +4804,27 @@ static void opentype_propagate_attachment_offsets(struct scriptshaping_context *
         /* FIXME: handle vertical direction. */
         context->offsets[i].ascenderOffset += context->offsets[j].ascenderOffset;
     }
+    else if (type == GLYPH_ATTACH_MARK)
+    {
+        context->offsets[i].advanceOffset += context->offsets[j].advanceOffset;
+        context->offsets[i].ascenderOffset += context->offsets[j].ascenderOffset;
+
+        /* FIXME: handle vertical adjustment. */
+        if (context->is_rtl)
+        {
+            for (k = j + 1; k < i + 1; ++k)
+            {
+                context->offsets[i].advanceOffset += context->advances[k];
+            }
+        }
+        else
+        {
+            for (k = j; k < i; k++)
+            {
+                context->offsets[i].advanceOffset -= context->advances[k];
+            }
+        }
+    }
 }
 
 void opentype_layout_apply_gpos_features(struct scriptshaping_context *context, unsigned int script_index,




More information about the wine-cvs mailing list