dwrite/arabic: Set per-glyph mask.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-01-22 15:25:22 +03:00 committed by Alexandre Julliard
parent bea9c706eb
commit 4ae8191ee9
3 changed files with 23 additions and 0 deletions

View File

@ -590,6 +590,8 @@ extern void shape_enable_feature(struct shaping_features *features, unsigned int
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 unsigned int shape_get_feature_1_mask(const struct shaping_features *features,
unsigned int tag) DECLSPEC_HIDDEN;
extern void shape_start_next_stage(struct shaping_features *features, stage_func func) DECLSPEC_HIDDEN;
struct scriptshaping_context

View File

@ -4632,6 +4632,12 @@ static unsigned int shaping_features_get_mask(const struct shaping_features *fea
return feature->mask;
}
unsigned int shape_get_feature_1_mask(const struct shaping_features *features, unsigned int tag)
{
unsigned int shift, mask = shaping_features_get_mask(features, tag, &shift);
return (1 << shift) & mask;
}
static void opentype_layout_get_glyph_range_for_text(struct scriptshaping_context *context, unsigned int start_char,
unsigned int end_char, unsigned int *start_glyph, unsigned int *end_glyph)
{

View File

@ -41,6 +41,7 @@ enum arabic_shaping_action
MED2,
INIT,
NONE,
NUM_FEATURES = NONE,
};
static BOOL feature_is_syriac(unsigned int tag)
@ -134,10 +135,17 @@ static void arabic_set_shaping_action(struct scriptshaping_context *context,
context->glyph_infos[idx].props |= (action & 0xf) << 16;
}
static enum arabic_shaping_action arabic_get_shaping_action(const struct scriptshaping_context *context,
unsigned int idx)
{
return (context->glyph_infos[idx].props >> 16) & 0xf;
}
static void arabic_setup_masks(struct scriptshaping_context *context,
const struct shaping_features *features)
{
unsigned int i, prev = ~0u, state = 0;
unsigned int masks[NUM_FEATURES];
for (i = 0; i < context->length; ++i)
{
@ -160,6 +168,13 @@ static void arabic_setup_masks(struct scriptshaping_context *context,
prev = i;
state = entry->next_state;
}
for (i = 0; i < ARRAY_SIZE(masks); ++i)
masks[i] = shape_get_feature_1_mask(features, arabic_features[i]);
/* Unaffected glyphs get action NONE with zero mask. */
for (i = 0; i < context->length; ++i)
context->glyph_infos[i].mask |= masks[arabic_get_shaping_action(context, i)];
}
const struct shaper arabic_shaper =