[PATCH] dwrite: Keep current lookup feature mask in context.

Nikolay Sivov nsivov at codeweavers.com
Fri Jun 12 06:22:28 CDT 2020


Lookups referenced from context-based lookups need to have access to
original feature mask, set it once instead of propagating it on every
recursive call. It's used for input matching and parametrized cases
like alternate substitutions.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/dwrite/dwrite_private.h |  1 +
 dlls/dwrite/opentype.c       | 10 +++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h
index 661e01123c9..be3f4b719e8 100644
--- a/dlls/dwrite/dwrite_private.h
+++ b/dlls/dwrite/dwrite_private.h
@@ -585,6 +585,7 @@ struct scriptshaping_context
         unsigned int range_count;
     } user_features;
     unsigned int global_mask;
+    unsigned int lookup_mask; /* Currently processed feature mask, set in main loop. */
     struct shaping_glyph_info *glyph_infos;
 
     unsigned int cur;
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index cb79a68d59e..22159e29885 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -4802,6 +4802,8 @@ void opentype_layout_apply_gpos_features(struct scriptshaping_context *context,
         const struct lookup *lookup = &lookups.lookups[i];
 
         context->cur = 0;
+        context->lookup_mask = lookup->mask;
+
         while (context->cur < context->glyph_count)
         {
             ret = FALSE;
@@ -5037,8 +5039,8 @@ static BOOL opentype_layout_apply_gsub_alt_substitution(struct scriptshaping_con
         if (!count)
             return FALSE;
 
-        BitScanForward(&shift, lookup->mask);
-        alt_index = (lookup->mask & context->glyph_infos[idx].mask) >> shift;
+        BitScanForward(&shift, context->lookup_mask);
+        alt_index = (context->lookup_mask & context->glyph_infos[idx].mask) >> shift;
 
         if (alt_index > count || !alt_index)
             return FALSE;
@@ -5071,7 +5073,7 @@ static BOOL opentype_layout_context_match_input(const struct match_context *mc,
     match_positions[0] = context->cur;
 
     glyph_iterator_init(context, mc->lookup->flags, context->cur, count - 1, &iter);
-    iter.mask = mc->lookup->mask;
+    iter.mask = context->lookup_mask;
     iter.match_func = mc->match_func;
     iter.match_data = &match_data;
     iter.glyph_data = input;
@@ -5933,6 +5935,8 @@ void opentype_layout_apply_gsub_features(struct scriptshaping_context *context,
     {
         const struct lookup *lookup = &lookups.lookups[i];
 
+        context->lookup_mask = lookup->mask;
+
         if (!opentype_is_gsub_lookup_reversed(context, lookup))
         {
             context->cur = 0;
-- 
2.27.0




More information about the wine-devel mailing list