diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c index 2cbac7700c7..98e1ef4a0dc 100644 --- a/dlls/dwrite/analyzer.c +++ b/dlls/dwrite/analyzer.c @@ -1256,6 +1256,9 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphs(IDWriteTextAnalyzer2 *iface, context.u.subst.max_glyph_count = max_glyph_count; context.glyph_count = g; context.language_tag = get_opentype_language(locale); + context.user_features.features = features; + context.user_features.range_lengths = feature_range_lengths; + context.user_features.range_count = feature_ranges; script = analysis->script > Script_LastId ? Script_Unknown : analysis->script; scriptprops = &dwritescripts_properties[script]; @@ -1321,6 +1324,9 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphPlacements(IDWriteTextAnalyzer2 context.advances = advances; context.offsets = offsets; context.language_tag = get_opentype_language(locale); + context.user_features.features = features; + context.user_features.range_lengths = feature_range_lengths; + context.user_features.range_count = feature_ranges; return shape_get_positions(&context, scriptprops->scripttags); } @@ -1380,6 +1386,9 @@ static HRESULT WINAPI dwritetextanalyzer_GetGdiCompatibleGlyphPlacements(IDWrite context.advances = advances; context.offsets = offsets; context.language_tag = get_opentype_language(locale); + context.user_features.features = features; + context.user_features.range_lengths = feature_range_lengths; + context.user_features.range_count = feature_ranges; return shape_get_positions(&context, scriptprops->scripttags); } diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 06fcf8d7480..cad74d9e947 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -486,6 +486,13 @@ struct scriptshaping_context } subst; } u; + struct + { + const DWRITE_TYPOGRAPHIC_FEATURES **features; + const unsigned int *range_lengths; + unsigned int range_count; + } user_features; + unsigned int glyph_count; float emsize; DWRITE_MEASURING_MODE measuring_mode; diff --git a/dlls/dwrite/shape.c b/dlls/dwrite/shape.c index 4de73953d47..57c06f62e84 100644 --- a/dlls/dwrite/shape.c +++ b/dlls/dwrite/shape.c @@ -223,10 +223,27 @@ static int features_sorting_compare(const void *a, const void *b) return left->tag != right->tag ? (left->tag < right->tag ? -1 : 1) : 0; }; -static void shape_merge_features(struct shaping_features *features) +static void shape_merge_features(struct scriptshaping_context *context, struct shaping_features *features) { + const DWRITE_TYPOGRAPHIC_FEATURES **user_features = context->user_features.features; unsigned int j = 0, i; + /* For now only consider global, enabled user features. */ + if (user_features && context->user_features.range_lengths && context->user_features.range_count == 1) + { + for (i = 0; i < context->user_features.range_count; ++i) + { + if (context->user_features.range_lengths[i] != context->length) + break; + + for (j = 0; j < user_features[i]->featureCount; ++j) + { + if (user_features[i]->features[j].parameter == 1) + shape_add_feature(features, user_features[i]->features[j].nameTag); + } + } + } + /* Sort and merge duplicates. */ qsort(features->features, features->count, sizeof(*features->features), features_sorting_compare); @@ -267,7 +284,7 @@ HRESULT shape_get_positions(struct scriptshaping_context *context, const unsigne shape_add_feature(&features, horizontal_features[i]); } - shape_merge_features(&features); + shape_merge_features(context, &features); /* Resolve script tag to actually supported script. */ if (cache->gpos.table.data) @@ -354,7 +371,7 @@ HRESULT shape_get_glyphs(struct scriptshaping_context *context, const unsigned i else shape_add_feature_flags(&features, DWRITE_MAKE_OPENTYPE_TAG('v','e','r','t'), FEATURE_GLOBAL_SEARCH); - shape_merge_features(&features); + shape_merge_features(context, &features); /* Resolve script tag to actually supported script. */ if (cache->gsub.table.data)