From: Daniel Lehman <dlehman25@gmail.com> Existing helper font_fallback_get_locale returns neutral locale if the exact name is not found. This is ok when searching for the font fallback, but shortcuts the adding of locale when building the font fallback collection. --- dlls/dwrite/analyzer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c index 8548d8515fb..db8e7f8ffd8 100644 --- a/dlls/dwrite/analyzer.c +++ b/dlls/dwrite/analyzer.c @@ -533,14 +533,14 @@ static HRESULT fallback_locale_add_mapping(struct fallback_locale *locale, size_ /* TODO: potentially needs improvement to consider partially matching locale names. */ static struct fallback_locale * font_fallback_get_locale(const struct list *locales, - const WCHAR *locale_name) + const WCHAR *locale_name, bool use_neutral) { struct fallback_locale *locale, *neutral = NULL; LIST_FOR_EACH_ENTRY(locale, locales, struct fallback_locale, entry) { if (!wcsicmp(locale->name, locale_name)) return locale; - if (!*locale->name) neutral = locale; + if (use_neutral && !*locale->name) neutral = locale; } return neutral; @@ -633,7 +633,7 @@ static const struct fallback_mapping * find_fallback_mapping(const struct fallba /* Mapping wasn't found for specific locale, try with neutral one. This will only recurse once. */ if (*locale->name) { - locale = font_fallback_get_locale(&fallback->locales, L""); + locale = font_fallback_get_locale(&fallback->locales, L"", true); mapping = find_fallback_mapping(fallback, locale, ch); } @@ -2525,7 +2525,7 @@ static HRESULT fallback_map_characters(const struct dwrite_fontfallback *fallbac if (!locale_name) locale_name = L""; /* Lookup locale entry once, if specific locale is missing neutral one will be returned. */ - locale = font_fallback_get_locale(&data->locales, locale_name); + locale = font_fallback_get_locale(&data->locales, locale_name, true); if (FAILED(hr = text_source_context_init(&context, source, position, length))) return hr; @@ -2764,7 +2764,7 @@ static struct fallback_locale * fallback_builder_add_locale(struct dwrite_fontfa struct fallback_locale *locale; if (!locale_name) locale_name = L""; - if ((locale = font_fallback_get_locale(&builder->data.locales, locale_name))) return locale; + if ((locale = font_fallback_get_locale(&builder->data.locales, locale_name, false))) return locale; if (!(locale = calloc(1, sizeof(*locale)))) return NULL; lstrcpynW(locale->name, locale_name, ARRAY_SIZE(locale->name)); list_add_tail(&builder->data.locales, &locale->entry); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10201