Nikolay Sivov : dwrite: Add per shaping stage functions.
Alexandre Julliard
julliard at winehq.org
Fri Jan 22 15:59:15 CST 2021
Module: wine
Branch: master
Commit: dfb94e6f8ee630bd514a7c16beefcba3daaf0bcf
URL: https://source.winehq.org/git/wine.git/?a=commit;h=dfb94e6f8ee630bd514a7c16beefcba3daaf0bcf
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Jan 22 15:25:19 2021 +0300
dwrite: Add per shaping stage functions.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dwrite/dwrite_private.h | 21 ++++++++++++++++-----
dlls/dwrite/opentype.c | 7 ++++---
dlls/dwrite/shape.c | 3 ++-
dlls/dwrite/shapers/arabic.c | 6 +++---
4 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h
index 57641680db5..3f48c189a13 100644
--- a/dlls/dwrite/dwrite_private.h
+++ b/dlls/dwrite/dwrite_private.h
@@ -559,12 +559,23 @@ struct shaping_feature
unsigned int stage;
};
+#define MAX_SHAPING_STAGE 16
+
+typedef void (*stage_func)(struct scriptshaping_context *context);
+
+struct shaping_stage
+{
+ stage_func func;
+ unsigned int last_lookup;
+};
+
struct shaping_features
{
struct shaping_feature *features;
size_t count;
size_t capacity;
unsigned int stage;
+ struct shaping_stage stages[MAX_SHAPING_STAGE];
};
struct shaper
@@ -577,9 +588,9 @@ extern const struct shaper arabic_shaper DECLSPEC_HIDDEN;
extern void shape_enable_feature(struct shaping_features *features, unsigned int tag,
unsigned int flags) DECLSPEC_HIDDEN;
-extern void shape_add_feature_full(struct shaping_features *features, unsigned int tag, unsigned int flags,
- unsigned int value) DECLSPEC_HIDDEN;
-extern void shape_start_next_stage(struct shaping_features *features) DECLSPEC_HIDDEN;
+extern void shape_add_feature_full(struct shaping_features *features, unsigned int tag,
+ unsigned int flags, unsigned int value) DECLSPEC_HIDDEN;
+extern void shape_start_next_stage(struct shaping_features *features, stage_func func) DECLSPEC_HIDDEN;
struct scriptshaping_context
{
@@ -667,9 +678,9 @@ extern DWORD opentype_layout_find_script(const struct scriptshaping_cache *cache
extern DWORD opentype_layout_find_language(const struct scriptshaping_cache *cache, DWORD kind, DWORD tag,
unsigned int script_index, unsigned int *language_index) DECLSPEC_HIDDEN;
extern void opentype_layout_apply_gsub_features(struct scriptshaping_context *context, unsigned int script_index,
- unsigned int language_index, const struct shaping_features *features) DECLSPEC_HIDDEN;
+ unsigned int language_index, struct shaping_features *features) DECLSPEC_HIDDEN;
extern void opentype_layout_apply_gpos_features(struct scriptshaping_context *context, unsigned int script_index,
- unsigned int language_index, const struct shaping_features *features) DECLSPEC_HIDDEN;
+ unsigned int language_index, struct shaping_features *features) DECLSPEC_HIDDEN;
extern BOOL opentype_layout_check_feature(struct scriptshaping_context *context, unsigned int script_index,
unsigned int language_index, struct shaping_feature *feature, unsigned int glyph_count,
const UINT16 *glyphs, UINT8 *feature_applies) DECLSPEC_HIDDEN;
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index 03b74eae591..b446e7450b7 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -4442,7 +4442,7 @@ static void opentype_layout_add_lookups(const struct ot_feature_list *feature_li
}
static void opentype_layout_collect_lookups(struct scriptshaping_context *context, unsigned int script_index,
- unsigned int language_index, const struct shaping_features *features, const struct ot_gsubgpos_table *table,
+ unsigned int language_index, struct shaping_features *features, const struct ot_gsubgpos_table *table,
struct lookups *lookups)
{
unsigned int last_num_lookups = 0, stage, script_feature_count = 0;
@@ -4607,6 +4607,7 @@ static void opentype_layout_collect_lookups(struct scriptshaping_context *contex
}
last_num_lookups = lookups->count;
+ features->stages[stage].last_lookup = last_num_lookups;
}
}
@@ -4688,7 +4689,7 @@ static void opentype_layout_apply_gpos_context_lookup(struct scriptshaping_conte
}
void opentype_layout_apply_gpos_features(struct scriptshaping_context *context, unsigned int script_index,
- unsigned int language_index, const struct shaping_features *features)
+ unsigned int language_index, struct shaping_features *features)
{
struct lookups lookups = { 0 };
unsigned int i;
@@ -5791,7 +5792,7 @@ static void opentype_layout_apply_gsub_context_lookup(struct scriptshaping_conte
}
void opentype_layout_apply_gsub_features(struct scriptshaping_context *context, unsigned int script_index,
- unsigned int language_index, const struct shaping_features *features)
+ unsigned int language_index, struct shaping_features *features)
{
struct lookups lookups = { 0 };
unsigned int i, j, start_idx;
diff --git a/dlls/dwrite/shape.c b/dlls/dwrite/shape.c
index 2dbea825216..6428bf6ceb0 100644
--- a/dlls/dwrite/shape.c
+++ b/dlls/dwrite/shape.c
@@ -142,8 +142,9 @@ void shape_enable_feature(struct shaping_features *features, unsigned int tag,
shape_add_feature_full(features, tag, FEATURE_GLOBAL | flags, 1);
}
-void shape_start_next_stage(struct shaping_features *features)
+void shape_start_next_stage(struct shaping_features *features, stage_func func)
{
+ features->stages[features->stage].func = func;
features->stage++;
}
diff --git a/dlls/dwrite/shapers/arabic.c b/dlls/dwrite/shapers/arabic.c
index 32588b9c796..0b456dadc11 100644
--- a/dlls/dwrite/shapers/arabic.c
+++ b/dlls/dwrite/shapers/arabic.c
@@ -56,21 +56,21 @@ static void arabic_collect_features(struct scriptshaping_context *context,
shape_enable_feature(features, DWRITE_MAKE_OPENTYPE_TAG('c','c','m','p'), 0);
shape_enable_feature(features, DWRITE_MAKE_OPENTYPE_TAG('l','o','c','l'), 0);
- shape_start_next_stage(features);
+ shape_start_next_stage(features, NULL);
for (i = 0; i < ARRAY_SIZE(arabic_features); ++i)
{
unsigned int flags = context->script == Script_Arabic && !feature_is_syriac(arabic_features[i]) ?
FEATURE_HAS_FALLBACK : 0;
shape_add_feature_full(features, arabic_features[i], flags, 1);
- shape_start_next_stage(features);
+ shape_start_next_stage(features, NULL);
}
shape_enable_feature(features, DWRITE_MAKE_OPENTYPE_TAG('r','l','i','g'), FEATURE_MANUAL_ZWJ | FEATURE_HAS_FALLBACK);
shape_enable_feature(features, DWRITE_MAKE_OPENTYPE_TAG('r','c','l','t'), FEATURE_MANUAL_ZWJ);
shape_enable_feature(features, DWRITE_MAKE_OPENTYPE_TAG('c','a','l','t'), FEATURE_MANUAL_ZWJ);
- shape_start_next_stage(features);
+ shape_start_next_stage(features, NULL);
shape_enable_feature(features, DWRITE_MAKE_OPENTYPE_TAG('m','s','e','t'), 0);
}
More information about the wine-cvs
mailing list