Commit c435eb5c authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Sort localized strings by locale name.

parent ea07bc41
...@@ -237,6 +237,7 @@ extern HRESULT create_localizedstrings(IDWriteLocalizedStrings**) DECLSPEC_HIDDE ...@@ -237,6 +237,7 @@ extern HRESULT create_localizedstrings(IDWriteLocalizedStrings**) DECLSPEC_HIDDE
extern HRESULT add_localizedstring(IDWriteLocalizedStrings*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN; extern HRESULT add_localizedstring(IDWriteLocalizedStrings*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;
extern HRESULT clone_localizedstring(IDWriteLocalizedStrings *iface, IDWriteLocalizedStrings **strings) DECLSPEC_HIDDEN; extern HRESULT clone_localizedstring(IDWriteLocalizedStrings *iface, IDWriteLocalizedStrings **strings) DECLSPEC_HIDDEN;
extern void set_en_localizedstring(IDWriteLocalizedStrings*,const WCHAR*) DECLSPEC_HIDDEN; extern void set_en_localizedstring(IDWriteLocalizedStrings*,const WCHAR*) DECLSPEC_HIDDEN;
extern void sort_localizedstrings(IDWriteLocalizedStrings*) DECLSPEC_HIDDEN;
extern HRESULT get_system_fontcollection(IDWriteFactory5*,IDWriteFontCollection1**) DECLSPEC_HIDDEN; extern HRESULT get_system_fontcollection(IDWriteFactory5*,IDWriteFontCollection1**) DECLSPEC_HIDDEN;
extern HRESULT get_eudc_fontcollection(IDWriteFactory5*,IDWriteFontCollection1**) DECLSPEC_HIDDEN; extern HRESULT get_eudc_fontcollection(IDWriteFactory5*,IDWriteFontCollection1**) DECLSPEC_HIDDEN;
extern IDWriteTextAnalyzer *get_text_analyzer(void) DECLSPEC_HIDDEN; extern IDWriteTextAnalyzer *get_text_analyzer(void) DECLSPEC_HIDDEN;
......
...@@ -520,6 +520,20 @@ void set_en_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *string) ...@@ -520,6 +520,20 @@ void set_en_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *string)
} }
} }
static int localizedstrings_sorting_compare(const void *left, const void *right)
{
const struct localizedpair *_l = left, *_r = right;
return strcmpW(_l->locale, _r->locale);
};
void sort_localizedstrings(IDWriteLocalizedStrings *iface)
{
struct localizedstrings *strings = impl_from_IDWriteLocalizedStrings(iface);
qsort(strings->data, strings->count, sizeof(*strings->data), localizedstrings_sorting_compare);
}
struct collectionloader struct collectionloader
{ {
struct list entry; struct list entry;
......
...@@ -2010,6 +2010,9 @@ static HRESULT opentype_get_font_strings_from_id(const void *table_data, enum OP ...@@ -2010,6 +2010,9 @@ static HRESULT opentype_get_font_strings_from_id(const void *table_data, enum OP
} }
} }
if (*strings)
sort_localizedstrings(*strings);
return exists ? S_OK : E_FAIL; return exists ? S_OK : E_FAIL;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment