[PATCH 3/5] dwrite: Enable 'vert' feature.

Nikolay Sivov nsivov at codeweavers.com
Thu May 21 07:28:47 CDT 2020


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/dwrite/dwrite_private.h |  7 +++++++
 dlls/dwrite/opentype.c       | 15 +++++++++++++--
 dlls/dwrite/shape.c          | 13 +++++++++++--
 3 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h
index db3543d79ed..06fcf8d7480 100644
--- a/dlls/dwrite/dwrite_private.h
+++ b/dlls/dwrite/dwrite_private.h
@@ -505,10 +505,17 @@ extern struct scriptshaping_cache *create_scriptshaping_cache(void *context,
 extern void release_scriptshaping_cache(struct scriptshaping_cache*) DECLSPEC_HIDDEN;
 extern struct scriptshaping_cache *fontface_get_shaping_cache(struct dwrite_fontface *fontface) DECLSPEC_HIDDEN;
 
+enum shaping_feature_flags
+{
+    FEATURE_GLOBAL = 0x1,
+    FEATURE_GLOBAL_SEARCH = 0x2,
+};
+
 struct shaping_feature
 {
     unsigned int tag;
     unsigned int index;
+    unsigned int flags;
 };
 
 struct shaping_features
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index 411b3df855e..713a5002f35 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -4143,14 +4143,25 @@ static void opentype_layout_collect_lookups(struct scriptshaping_context *contex
                     langsys_offset + FIELD_OFFSET(struct ot_langsys, feature_index[j]));
             if (feature_index >= total_feature_count)
                 continue;
-            if (feature_list->features[feature_index].tag == features->features[i].tag)
+            if ((found = feature_list->features[feature_index].tag == features->features[i].tag))
             {
-                found = TRUE;
                 features->features[i].index = feature_index;
                 break;
             }
         }
 
+        if (!found && (features->features[i].flags & FEATURE_GLOBAL_SEARCH))
+        {
+            for (j = 0; j < total_feature_count; ++j)
+            {
+                if ((found = (feature_list->features[j].tag == features->features[i].tag)))
+                {
+                    features->features[i].index = j;
+                    break;
+                }
+            }
+        }
+
         if (!found)
             features->features[i].index = 0xffff;
     }
diff --git a/dlls/dwrite/shape.c b/dlls/dwrite/shape.c
index 82ad3a2a1e7..4de73953d47 100644
--- a/dlls/dwrite/shape.c
+++ b/dlls/dwrite/shape.c
@@ -201,13 +201,20 @@ static DWORD shape_select_language(const struct scriptshaping_cache *cache, DWOR
     return 0;
 }
 
-static void shape_add_feature(struct shaping_features *features, unsigned int tag)
+static void shape_add_feature_flags(struct shaping_features *features, unsigned int tag, unsigned int flags)
 {
     if (!dwrite_array_reserve((void **)&features->features, &features->capacity, features->count + 1,
             sizeof(*features->features)))
         return;
 
-    features->features[features->count++].tag = tag;
+    features->features[features->count].tag = tag;
+    features->features[features->count].flags = flags;
+    features->count++;
+}
+
+static void shape_add_feature(struct shaping_features *features, unsigned int tag)
+{
+    shape_add_feature_flags(features, tag, FEATURE_GLOBAL);
 }
 
 static int features_sorting_compare(const void *a, const void *b)
@@ -344,6 +351,8 @@ HRESULT shape_get_glyphs(struct scriptshaping_context *context, const unsigned i
         for (i = 0; i < ARRAY_SIZE(horizontal_features); ++i)
             shape_add_feature(&features, horizontal_features[i]);
     }
+    else
+        shape_add_feature_flags(&features, DWRITE_MAKE_OPENTYPE_TAG('v','e','r','t'), FEATURE_GLOBAL_SEARCH);
 
     shape_merge_features(&features);
 
-- 
2.26.2




More information about the wine-devel mailing list