[PATCH 1/5] dwrite: Set lookup flags for joiners.
Nikolay Sivov
nsivov at codeweavers.com
Mon Jan 18 06:05:38 CST 2021
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/dwrite/dwrite_private.h | 3 +++
dlls/dwrite/opentype.c | 23 +++++++++++++++--------
dlls/dwrite/shape.c | 12 ++++++------
3 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h
index 7c9fe8a6873..632b2776bfc 100644
--- a/dlls/dwrite/dwrite_private.h
+++ b/dlls/dwrite/dwrite_private.h
@@ -615,6 +615,9 @@ enum shaping_feature_flags
{
FEATURE_GLOBAL = 0x1,
FEATURE_GLOBAL_SEARCH = 0x2,
+ FEATURE_MANUAL_ZWNJ = 0x4,
+ FEATURE_MANUAL_ZWJ = 0x8,
+ FEATURE_MANUAL_JOINERS = FEATURE_MANUAL_ZWNJ | FEATURE_MANUAL_ZWJ,
};
struct shaping_feature
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index 260a0a8f5db..55ef482c42d 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -3508,6 +3508,8 @@ struct lookup
unsigned int mask;
unsigned int offset;
+ unsigned int auto_zwnj : 1;
+ unsigned int auto_zwj : 1;
};
static unsigned int opentype_layout_get_gsubgpos_subtable(const struct scriptshaping_context *context,
@@ -4337,8 +4339,8 @@ static int lookups_sorting_compare(const void *a, const void *b)
return left->index < right->index ? -1 : left->index > right->index ? 1 : 0;
};
-static BOOL opentype_layout_init_lookup(const struct ot_gsubgpos_table *table, unsigned short lookup_index, unsigned int mask,
- struct lookup *lookup)
+static BOOL opentype_layout_init_lookup(const struct ot_gsubgpos_table *table, unsigned short lookup_index,
+ const struct shaping_feature *feature, struct lookup *lookup)
{
unsigned short subtable_count, lookup_type, flags, mark_filtering_set;
const struct ot_lookup_table *lookup_table;
@@ -4372,8 +4374,13 @@ static BOOL opentype_layout_init_lookup(const struct ot_gsubgpos_table *table, u
lookup->type = lookup_type;
lookup->flags = flags;
lookup->subtable_count = subtable_count;
- lookup->mask = mask;
lookup->offset = offset;
+ if (feature)
+ {
+ lookup->mask = feature->mask;
+ lookup->auto_zwnj = !(feature->flags & FEATURE_MANUAL_ZWNJ);
+ lookup->auto_zwj = !(feature->flags & FEATURE_MANUAL_ZWJ);
+ }
return TRUE;
}
@@ -4409,7 +4416,7 @@ static void opentype_layout_add_lookups(const struct ot_feature_list *feature_li
if (lookup_index >= total_lookup_count)
continue;
- if (opentype_layout_init_lookup(table, lookup_index, feature->mask, &lookups->lookups[lookups->count]))
+ if (opentype_layout_init_lookup(table, lookup_index, feature, &lookups->lookups[lookups->count]))
lookups->count++;
}
}
@@ -4567,6 +4574,8 @@ static void opentype_layout_collect_lookups(struct scriptshaping_context *contex
else
{
lookups->lookups[j].mask |= lookups->lookups[i].mask;
+ lookups->lookups[j].auto_zwnj &= lookups->lookups[i].auto_zwnj;
+ lookups->lookups[j].auto_zwj &= lookups->lookups[i].auto_zwj;
}
}
lookups->count = j + 1;
@@ -4648,8 +4657,7 @@ static void opentype_layout_set_glyph_masks(struct scriptshaping_context *contex
static void opentype_layout_apply_gpos_context_lookup(struct scriptshaping_context *context, unsigned int lookup_index)
{
struct lookup lookup = { 0 };
- /* Feature mask is intentionally zero, it's not used outside of main loop. */
- if (opentype_layout_init_lookup(context->table, lookup_index, 0, &lookup))
+ if (opentype_layout_init_lookup(context->table, lookup_index, NULL, &lookup))
opentype_layout_apply_gpos_lookup(context, &lookup);
}
@@ -5742,8 +5750,7 @@ static BOOL opentype_is_gsub_lookup_reversed(const struct scriptshaping_context
static void opentype_layout_apply_gsub_context_lookup(struct scriptshaping_context *context, unsigned int lookup_index)
{
struct lookup lookup = { 0 };
- /* Feature mask is intentionally zero, it's not used outside of main loop. */
- if (opentype_layout_init_lookup(context->table, lookup_index, 0, &lookup))
+ if (opentype_layout_init_lookup(context->table, lookup_index, NULL, &lookup))
opentype_layout_apply_gsub_lookup(context, &lookup);
}
diff --git a/dlls/dwrite/shape.c b/dlls/dwrite/shape.c
index be8a69c27c4..567ec5fa54f 100644
--- a/dlls/dwrite/shape.c
+++ b/dlls/dwrite/shape.c
@@ -189,12 +189,12 @@ static void shape_merge_features(struct scriptshaping_context *context, struct s
HRESULT shape_get_positions(struct scriptshaping_context *context, const unsigned int *scripts)
{
- static const unsigned int common_features[] =
+ static const struct shaping_feature common_features[] =
{
- DWRITE_MAKE_OPENTYPE_TAG('a','b','v','m'),
- DWRITE_MAKE_OPENTYPE_TAG('b','l','w','m'),
- DWRITE_MAKE_OPENTYPE_TAG('m','a','r','k'),
- DWRITE_MAKE_OPENTYPE_TAG('m','k','m','k'),
+ { DWRITE_MAKE_OPENTYPE_TAG('a','b','v','m') },
+ { DWRITE_MAKE_OPENTYPE_TAG('b','l','w','m') },
+ { DWRITE_MAKE_OPENTYPE_TAG('m','a','r','k'), FEATURE_MANUAL_JOINERS },
+ { DWRITE_MAKE_OPENTYPE_TAG('m','k','m','k'), FEATURE_MANUAL_JOINERS },
};
static const unsigned int horizontal_features[] =
{
@@ -207,7 +207,7 @@ HRESULT shape_get_positions(struct scriptshaping_context *context, const unsigne
struct shaping_features features = { 0 };
for (i = 0; i < ARRAY_SIZE(common_features); ++i)
- shape_add_feature(&features, common_features[i]);
+ shape_add_feature_full(&features, common_features[i].tag, FEATURE_GLOBAL | common_features[i].flags, 1);
/* Horizontal features */
if (!context->is_sideways)
--
2.29.2
More information about the wine-devel
mailing list