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

dwrite: Use wide-char literals.

parent 9f4c4750
...@@ -207,9 +207,7 @@ const char *debugstr_sa_script(UINT16 script) ...@@ -207,9 +207,7 @@ const char *debugstr_sa_script(UINT16 script)
} }
/* system font falback configuration */ /* system font falback configuration */
static const WCHAR meiryoW[] = {'M','e','i','r','y','o',0}; static const WCHAR *cjk_families[] = { L"Meiryo" };
static const WCHAR *cjk_families[] = { meiryoW };
static const DWRITE_UNICODE_RANGE cjk_ranges[] = static const DWRITE_UNICODE_RANGE cjk_ranges[] =
{ {
...@@ -1102,12 +1100,12 @@ static void get_number_substitutes(IDWriteNumberSubstitution *substitution, BOOL ...@@ -1102,12 +1100,12 @@ static void get_number_substitutes(IDWriteNumberSubstitution *substitution, BOOL
break; break;
case DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL: case DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL:
case DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL: case DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL:
if (GetLocaleInfoEx(numbersubst->locale, LOCALE_SISO639LANGNAME, isolang, ARRAY_SIZE(isolang))) { if (GetLocaleInfoEx(numbersubst->locale, LOCALE_SISO639LANGNAME, isolang, ARRAY_SIZE(isolang)))
static const WCHAR arW[] = {'a','r',0}; {
static const WCHAR arabicW[] = {0x640,0x641,0x642,0x643,0x644,0x645,0x646,0x647,0x648,0x649,0}; static const WCHAR arabicW[] = {0x640,0x641,0x642,0x643,0x644,0x645,0x646,0x647,0x648,0x649,0};
/* For some Arabic locales Latin digits are returned for SNATIVEDIGITS */ /* For some Arabic locales Latin digits are returned for SNATIVEDIGITS */
if (!wcscmp(arW, isolang)) if (!wcscmp(L"ar", isolang))
{ {
wcscpy(digits, arabicW); wcscpy(digits, arabicW);
break; break;
......
...@@ -531,13 +531,12 @@ HRESULT clone_localizedstrings(IDWriteLocalizedStrings *iface, IDWriteLocalizedS ...@@ -531,13 +531,12 @@ HRESULT clone_localizedstrings(IDWriteLocalizedStrings *iface, IDWriteLocalizedS
void set_en_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *string) void set_en_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *string)
{ {
static const WCHAR enusW[] = {'e','n','-','U','S',0};
struct localizedstrings *strings = impl_from_IDWriteLocalizedStrings(iface); struct localizedstrings *strings = impl_from_IDWriteLocalizedStrings(iface);
UINT32 i; UINT32 i;
for (i = 0; i < strings->count; i++) for (i = 0; i < strings->count; i++)
{ {
if (!wcsicmp(strings->data[i].locale, enusW)) if (!wcsicmp(strings->data[i].locale, L"en-US"))
{ {
heap_free(strings->data[i].string); heap_free(strings->data[i].string);
strings->data[i].string = heap_strdupW(string); strings->data[i].string = heap_strdupW(string);
...@@ -1573,12 +1572,11 @@ static HRESULT create_system_path_list(WCHAR ***ret, unsigned int *ret_count) ...@@ -1573,12 +1572,11 @@ static HRESULT create_system_path_list(WCHAR ***ret, unsigned int *ret_count)
{ {
if (!wcschr(value, '\\')) if (!wcschr(value, '\\'))
{ {
static const WCHAR fontsW[] = {'\\','f','o','n','t','s','\\',0};
WCHAR *ptrW; WCHAR *ptrW;
ptrW = heap_alloc((MAX_PATH + wcslen(value)) * sizeof(WCHAR)); ptrW = heap_alloc((MAX_PATH + wcslen(value)) * sizeof(WCHAR));
GetWindowsDirectoryW(ptrW, MAX_PATH); GetWindowsDirectoryW(ptrW, MAX_PATH);
wcscat(ptrW, fontsW); wcscat(ptrW, L"\\fonts\\");
wcscat(ptrW, value); wcscat(ptrW, value);
heap_free(value); heap_free(value);
......
...@@ -2252,9 +2252,8 @@ static UINT get_name_record_codepage(enum OPENTYPE_PLATFORM_ID platform, USHORT ...@@ -2252,9 +2252,8 @@ static UINT get_name_record_codepage(enum OPENTYPE_PLATFORM_ID platform, USHORT
static void get_name_record_locale(enum OPENTYPE_PLATFORM_ID platform, USHORT lang_id, WCHAR *locale, USHORT locale_len) static void get_name_record_locale(enum OPENTYPE_PLATFORM_ID platform, USHORT lang_id, WCHAR *locale, USHORT locale_len)
{ {
static const WCHAR enusW[] = {'e','n','-','U','S',0}; switch (platform)
{
switch (platform) {
case OPENTYPE_PLATFORM_MAC: case OPENTYPE_PLATFORM_MAC:
{ {
const char *locale_name = NULL; const char *locale_name = NULL;
...@@ -2269,18 +2268,18 @@ static void get_name_record_locale(enum OPENTYPE_PLATFORM_ID platform, USHORT la ...@@ -2269,18 +2268,18 @@ static void get_name_record_locale(enum OPENTYPE_PLATFORM_ID platform, USHORT la
if (locale_name) if (locale_name)
MultiByteToWideChar(CP_ACP, 0, name_mac_langid_to_locale[lang_id], -1, locale, locale_len); MultiByteToWideChar(CP_ACP, 0, name_mac_langid_to_locale[lang_id], -1, locale, locale_len);
else else
wcscpy(locale, enusW); wcscpy(locale, L"en-US");
break; break;
} }
case OPENTYPE_PLATFORM_WIN: case OPENTYPE_PLATFORM_WIN:
if (!LCIDToLocaleName(MAKELCID(lang_id, SORT_DEFAULT), locale, locale_len, 0)) if (!LCIDToLocaleName(MAKELCID(lang_id, SORT_DEFAULT), locale, locale_len, 0))
{ {
FIXME("failed to get locale name for lcid=0x%08x\n", MAKELCID(lang_id, SORT_DEFAULT)); FIXME("failed to get locale name for lcid=0x%08x\n", MAKELCID(lang_id, SORT_DEFAULT));
wcscpy(locale, enusW); wcscpy(locale, L"en-US");
} }
break; break;
case OPENTYPE_PLATFORM_UNICODE: case OPENTYPE_PLATFORM_UNICODE:
wcscpy(locale, enusW); wcscpy(locale, L"en-US");
break; break;
default: default:
FIXME("unknown platform %d\n", platform); FIXME("unknown platform %d\n", platform);
...@@ -2301,7 +2300,6 @@ static BOOL opentype_is_english_namerecord(const struct dwrite_fonttable *table, ...@@ -2301,7 +2300,6 @@ static BOOL opentype_is_english_namerecord(const struct dwrite_fonttable *table,
static BOOL opentype_decode_namerecord(const struct dwrite_fonttable *table, unsigned int idx, static BOOL opentype_decode_namerecord(const struct dwrite_fonttable *table, unsigned int idx,
IDWriteLocalizedStrings *strings) IDWriteLocalizedStrings *strings)
{ {
static const WCHAR enusW[] = {'e','n','-','U','S',0};
USHORT lang_id, length, offset, encoding, platform; USHORT lang_id, length, offset, encoding, platform;
const struct name_header *header = (const struct name_header *)table->data; const struct name_header *header = (const struct name_header *)table->data;
const struct name_record *record; const struct name_record *record;
...@@ -2350,7 +2348,7 @@ static BOOL opentype_decode_namerecord(const struct dwrite_fonttable *table, uns ...@@ -2350,7 +2348,7 @@ static BOOL opentype_decode_namerecord(const struct dwrite_fonttable *table, uns
add_localizedstring(strings, locale, name_string); add_localizedstring(strings, locale, name_string);
heap_free(name_string); heap_free(name_string);
ret = !wcscmp(locale, enusW); ret = !wcscmp(locale, L"en-US");
} }
else else
FIXME("handle NAME format 1\n"); FIXME("handle NAME format 1\n");
...@@ -2443,14 +2441,13 @@ static HRESULT opentype_get_font_strings_from_id(const struct dwrite_fonttable * ...@@ -2443,14 +2441,13 @@ static HRESULT opentype_get_font_strings_from_id(const struct dwrite_fonttable *
static WCHAR *meta_get_lng_name(WCHAR *str, WCHAR **ctx) static WCHAR *meta_get_lng_name(WCHAR *str, WCHAR **ctx)
{ {
static const WCHAR delimW[] = {',',' ',0};
WCHAR *ret; WCHAR *ret;
if (!str) str = *ctx; if (!str) str = *ctx;
while (*str && wcschr(delimW, *str)) str++; while (*str && wcschr(L", ", *str)) str++;
if (!*str) return NULL; if (!*str) return NULL;
ret = str++; ret = str++;
while (*str && !wcschr(delimW, *str)) str++; while (*str && !wcschr(L", ", *str)) str++;
if (*str) *str++ = 0; if (*str) *str++ = 0;
*ctx = str; *ctx = str;
...@@ -2460,7 +2457,6 @@ static WCHAR *meta_get_lng_name(WCHAR *str, WCHAR **ctx) ...@@ -2460,7 +2457,6 @@ static WCHAR *meta_get_lng_name(WCHAR *str, WCHAR **ctx)
static HRESULT opentype_get_font_strings_from_meta(const struct file_stream_desc *stream_desc, static HRESULT opentype_get_font_strings_from_meta(const struct file_stream_desc *stream_desc,
DWRITE_INFORMATIONAL_STRING_ID id, IDWriteLocalizedStrings **ret) DWRITE_INFORMATIONAL_STRING_ID id, IDWriteLocalizedStrings **ret)
{ {
static const WCHAR emptyW[] = { 0 };
const struct meta_data_map *maps; const struct meta_data_map *maps;
IDWriteLocalizedStrings *strings; IDWriteLocalizedStrings *strings;
struct dwrite_fonttable meta; struct dwrite_fonttable meta;
...@@ -2528,7 +2524,7 @@ static HRESULT opentype_get_font_strings_from_meta(const struct file_stream_desc ...@@ -2528,7 +2524,7 @@ static HRESULT opentype_get_font_strings_from_meta(const struct file_stream_desc
while (token) while (token)
{ {
add_localizedstring(strings, emptyW, token); add_localizedstring(strings, L"", token);
token = meta_get_lng_name(NULL, &ctx); token = meta_get_lng_name(NULL, &ctx);
} }
...@@ -2632,7 +2628,6 @@ HRESULT opentype_get_font_facename(struct file_stream_desc *stream_desc, WCHAR * ...@@ -2632,7 +2628,6 @@ HRESULT opentype_get_font_facename(struct file_stream_desc *stream_desc, WCHAR *
*lfname = 0; *lfname = 0;
if (SUCCEEDED(opentype_get_font_strings_from_id(&name, OPENTYPE_STRING_FAMILY_NAME, &lfnames))) if (SUCCEEDED(opentype_get_font_strings_from_id(&name, OPENTYPE_STRING_FAMILY_NAME, &lfnames)))
{ {
static const WCHAR enusW[] = {'e','n','-','u','s',0};
WCHAR localeW[LOCALE_NAME_MAX_LENGTH]; WCHAR localeW[LOCALE_NAME_MAX_LENGTH];
UINT32 index; UINT32 index;
BOOL exists; BOOL exists;
...@@ -2642,7 +2637,7 @@ HRESULT opentype_get_font_facename(struct file_stream_desc *stream_desc, WCHAR * ...@@ -2642,7 +2637,7 @@ HRESULT opentype_get_font_facename(struct file_stream_desc *stream_desc, WCHAR *
IDWriteLocalizedStrings_FindLocaleName(lfnames, localeW, &index, &exists); IDWriteLocalizedStrings_FindLocaleName(lfnames, localeW, &index, &exists);
if (!exists) if (!exists)
IDWriteLocalizedStrings_FindLocaleName(lfnames, enusW, &index, &exists); IDWriteLocalizedStrings_FindLocaleName(lfnames, L"en-us", &index, &exists);
if (exists) { if (exists) {
UINT32 length = 0; UINT32 length = 0;
......
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