Nikolay Sivov : dwrite: Call stage function for substitution loop.

Alexandre Julliard julliard at winehq.org
Fri Jan 22 15:59:15 CST 2021


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Jan 22 15:25:20 2021 +0300

dwrite: Call stage function for substitution loop.

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

---

 dlls/dwrite/opentype.c | 66 +++++++++++++++++++++++++++-----------------------
 1 file changed, 36 insertions(+), 30 deletions(-)

diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index b446e7450b7..6fe85dd4991 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -5795,7 +5795,7 @@ void opentype_layout_apply_gsub_features(struct scriptshaping_context *context,
         unsigned int language_index, struct shaping_features *features)
 {
     struct lookups lookups = { 0 };
-    unsigned int i, j, start_idx;
+    unsigned int i = 0, j, start_idx;
     BOOL ret;
 
     context->nesting_level_left = SHAPE_MAX_NESTING_LEVEL;
@@ -5805,47 +5805,53 @@ void opentype_layout_apply_gsub_features(struct scriptshaping_context *context,
     opentype_get_nominal_glyphs(context, features);
     opentype_layout_set_glyph_masks(context, features);
 
-    for (i = 0; i < lookups.count; ++i)
+    for (j = 0; j <= features->stage; ++j)
     {
-        const struct lookup *lookup = &lookups.lookups[i];
+        for (; i < features->stages[j].last_lookup; ++i)
+        {
+            const struct lookup *lookup = &lookups.lookups[i];
 
-        context->lookup_mask = lookup->mask;
-        context->auto_zwnj = lookup->auto_zwnj;
-        context->auto_zwj = lookup->auto_zwj;
+            context->lookup_mask = lookup->mask;
+            context->auto_zwnj = lookup->auto_zwnj;
+            context->auto_zwj = lookup->auto_zwj;
 
-        if (!opentype_is_gsub_lookup_reversed(context, lookup))
-        {
-            context->cur = 0;
-            while (context->cur < context->glyph_count)
+            if (!opentype_is_gsub_lookup_reversed(context, lookup))
             {
-                ret = FALSE;
-
-                if ((context->glyph_infos[context->cur].mask & lookup->mask) &&
-                        lookup_is_glyph_match(context, context->cur, lookup->flags))
+                context->cur = 0;
+                while (context->cur < context->glyph_count)
                 {
-                    ret = opentype_layout_apply_gsub_lookup(context, lookup);
-                }
+                    ret = FALSE;
 
-                if (!ret)
-                    context->cur++;
-            }
-        }
-        else
-        {
-            context->cur = context->glyph_count - 1;
+                    if ((context->glyph_infos[context->cur].mask & lookup->mask) &&
+                            lookup_is_glyph_match(context, context->cur, lookup->flags))
+                    {
+                        ret = opentype_layout_apply_gsub_lookup(context, lookup);
+                    }
 
-            for (;;)
+                    if (!ret)
+                        context->cur++;
+                }
+            }
+            else
             {
-                if ((context->glyph_infos[context->cur].mask & lookup->mask) &&
-                        lookup_is_glyph_match(context, context->cur, lookup->flags))
+                context->cur = context->glyph_count - 1;
+
+                for (;;)
                 {
-                    opentype_layout_apply_gsub_lookup(context, lookup);
-                }
+                    if ((context->glyph_infos[context->cur].mask & lookup->mask) &&
+                            lookup_is_glyph_match(context, context->cur, lookup->flags))
+                    {
+                        opentype_layout_apply_gsub_lookup(context, lookup);
+                    }
 
-                if (context->cur == 0) break;
-                --context->cur;
+                    if (context->cur == 0) break;
+                    --context->cur;
+                }
             }
         }
+
+        if (features->stages[j].func)
+            features->stages[j].func(context);
     }
 
     /* For every glyph range of [<last>.isClusterStart, <next>.isClusterStart) set corresponding




More information about the wine-cvs mailing list