Nikolay Sivov : dwrite: Update glyph properties on single substitution.

Alexandre Julliard julliard at winehq.org
Tue May 26 17:17:06 CDT 2020


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue May 26 11:16:08 2020 +0300

dwrite: Update glyph properties on single substitution.

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, 18 insertions(+), 10 deletions(-)

diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index abf9cba105..5d90bad79c 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -3137,7 +3137,7 @@ static unsigned int opentype_set_glyph_props(struct scriptshaping_context *conte
 
     if (cache->gdef.classdef)
     {
-        glyph_class = opentype_layout_get_glyph_class(&cache->gdef.table, cache->gdef.classdef, context->u.subst.glyphs[g]);
+        glyph_class = opentype_layout_get_glyph_class(&cache->gdef.table, cache->gdef.classdef, glyph);
     }
 
     switch (glyph_class)
@@ -3160,6 +3160,13 @@ static unsigned int opentype_set_glyph_props(struct scriptshaping_context *conte
     return props;
 }
 
+static void opentype_set_subst_glyph_props(struct scriptshaping_context *context, unsigned int g, UINT16 glyph)
+{
+    unsigned int glyph_props = opentype_set_glyph_props(context, g, glyph);
+    context->u.subst.glyph_props[g].isDiacritic = !!(glyph_props == GLYPH_PROP_MARK);
+    context->u.subst.glyph_props[g].isZeroWidthSpace = !!(glyph_props == GLYPH_PROP_MARK);
+}
+
 struct coverage_compare_format1_context
 {
     UINT16 glyph;
@@ -4419,15 +4426,14 @@ void opentype_layout_apply_gpos_features(struct scriptshaping_context *context,
 
 static BOOL opentype_layout_apply_gsub_single_substitution(struct glyph_iterator *iter, const struct ot_lookup *lookup)
 {
+    UINT16 format, coverage, orig_glyph = iter->context->u.subst.glyphs[iter->pos], glyph = orig_glyph;
     struct scriptshaping_cache *cache = iter->context->cache;
     const struct dwrite_fonttable *gsub = &cache->gsub.table;
-    UINT16 format, coverage;
     unsigned int i;
 
     for (i = 0; i < lookup->subtable_count; ++i)
     {
         unsigned int subtable_offset = opentype_layout_get_gsub_subtable(cache, lookup->offset, i);
-        UINT16 glyph = iter->context->u.subst.glyphs[iter->pos];
         unsigned int coverage_index;
 
         format = table_read_be_word(&cache->gsub.table, subtable_offset);
@@ -4443,7 +4449,7 @@ static BOOL opentype_layout_apply_gsub_single_substitution(struct glyph_iterator
             if (coverage_index == GLYPH_NOT_COVERED)
                 continue;
 
-            iter->context->u.subst.glyphs[iter->pos] = glyph + GET_BE_WORD(format1->delta);
+            glyph = orig_glyph + GET_BE_WORD(format1->delta);
             break;
         }
         else if (format == 2)
@@ -4456,13 +4462,19 @@ static BOOL opentype_layout_apply_gsub_single_substitution(struct glyph_iterator
             if (coverage_index == GLYPH_NOT_COVERED || coverage_index >= count)
                 continue;
 
-            iter->context->u.subst.glyphs[iter->pos] = GET_BE_WORD(format2->substitutes[coverage_index]);
+            glyph = GET_BE_WORD(format2->substitutes[coverage_index]);
             break;
         }
         else
             WARN("Unknown single substitution format %u.\n", format);
     }
 
+    if (glyph != orig_glyph)
+    {
+        iter->context->u.subst.glyphs[iter->pos] = glyph;
+        opentype_set_subst_glyph_props(iter->context, iter->pos, glyph);
+    }
+
     return FALSE;
 }
 
@@ -4762,11 +4774,7 @@ static void opentype_get_nominal_glyphs(struct scriptshaping_context *context, c
         context->u.subst.glyphs[g] = font->get_glyph(context->cache->context, codepoint);
         context->u.subst.glyph_props[g].justification = SCRIPT_JUSTIFY_CHARACTER;
         context->u.subst.glyph_props[g].isClusterStart = 1;
-        if (opentype_set_glyph_props(context, g, context->u.subst.glyphs[g]) == GLYPH_PROP_MARK)
-        {
-            context->u.subst.glyph_props[g].isDiacritic = 1;
-            context->u.subst.glyph_props[g].isZeroWidthSpace = 1;
-        }
+        opentype_set_subst_glyph_props(context, g, context->u.subst.glyphs[g]);
         context->glyph_count++;
 
         clustermap[i] = i;




More information about the wine-cvs mailing list