dwrite/arabic: Mark some features for fallback.

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:17 +03:00 committed by Alexandre Julliard
parent 1495ccd152
commit f064acbdd9
4 changed files with 29 additions and 4 deletions

View File

@ -543,6 +543,7 @@ enum shaping_feature_flags
FEATURE_MANUAL_ZWNJ = 0x4,
FEATURE_MANUAL_ZWJ = 0x8,
FEATURE_MANUAL_JOINERS = FEATURE_MANUAL_ZWNJ | FEATURE_MANUAL_ZWJ,
FEATURE_HAS_FALLBACK = 0x10,
};
struct shaping_feature
@ -575,6 +576,8 @@ 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;
struct scriptshaping_context

View File

@ -4553,7 +4553,7 @@ static void opentype_layout_collect_lookups(struct scriptshaping_context *contex
}
}
if (!found)
if (!found && !(features->features[i].flags & FEATURE_HAS_FALLBACK))
continue;
if (feature->flags & FEATURE_GLOBAL && feature->max_value == 1)

View File

@ -115,7 +115,7 @@ static DWORD shape_select_language(const struct scriptshaping_cache *cache, DWOR
return 0;
}
static void shape_add_feature_full(struct shaping_features *features, unsigned int tag, unsigned int flags, unsigned int value)
void shape_add_feature_full(struct shaping_features *features, unsigned int tag, unsigned int flags, unsigned int value)
{
unsigned int i = features->count;
@ -193,6 +193,7 @@ static void shape_merge_features(struct scriptshaping_context *context, struct s
features->features[j].flags ^= FEATURE_GLOBAL;
features->features[j].max_value = max(features->features[j].max_value, features->features[i].max_value);
}
features->features[j].flags |= features->features[i].flags & FEATURE_HAS_FALLBACK;
features->features[j].stage = min(features->features[j].stage, features->features[i].stage);
}
}

View File

@ -18,6 +18,7 @@
*/
#include "dwrite_private.h"
#include "scripts.h"
static const unsigned int arabic_features[] =
{
@ -30,6 +31,24 @@ static const unsigned int arabic_features[] =
DWRITE_MAKE_OPENTYPE_TAG('i','n','i','t'),
};
enum arabic_shaping_action
{
ISOL,
FINA,
FIN2,
FIN3,
MEDI,
MED2,
INIT,
NONE,
};
static BOOL feature_is_syriac(unsigned int tag)
{
return tag == arabic_features[FIN2] || tag == arabic_features[FIN3] ||
tag == arabic_features[MED2];
}
static void arabic_collect_features(struct scriptshaping_context *context,
struct shaping_features *features)
{
@ -41,11 +60,13 @@ static void arabic_collect_features(struct scriptshaping_context *context,
for (i = 0; i < ARRAY_SIZE(arabic_features); ++i)
{
shape_enable_feature(features, arabic_features[i], 0);
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_enable_feature(features, DWRITE_MAKE_OPENTYPE_TAG('r','l','i','g'), FEATURE_MANUAL_ZWJ);
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);