dwrite: Pass raw NAME table pointer to table reading code.
This commit is contained in:
parent
2300602586
commit
35e9b6d85d
|
@ -113,7 +113,7 @@ extern HRESULT opentype_get_font_table(IDWriteFontFileStream*,DWRITE_FONT_FACE_T
|
||||||
extern void opentype_cmap_get_glyphindex(void*,UINT32,UINT16*) DECLSPEC_HIDDEN;
|
extern void opentype_cmap_get_glyphindex(void*,UINT32,UINT16*) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT opentype_cmap_get_unicode_ranges(void*,UINT32,DWRITE_UNICODE_RANGE*,UINT32*) DECLSPEC_HIDDEN;
|
extern HRESULT opentype_cmap_get_unicode_ranges(void*,UINT32,DWRITE_UNICODE_RANGE*,UINT32*) DECLSPEC_HIDDEN;
|
||||||
extern VOID get_font_properties(LPCVOID os2, LPCVOID head, LPCVOID post, DWRITE_FONT_METRICS *metrics, DWRITE_FONT_STRETCH *stretch, DWRITE_FONT_WEIGHT *weight, DWRITE_FONT_STYLE *style) DECLSPEC_HIDDEN;
|
extern VOID get_font_properties(LPCVOID os2, LPCVOID head, LPCVOID post, DWRITE_FONT_METRICS *metrics, DWRITE_FONT_STRETCH *stretch, DWRITE_FONT_WEIGHT *weight, DWRITE_FONT_STYLE *style) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT opentype_get_font_strings_from_id(IDWriteFontFace2*,DWRITE_INFORMATIONAL_STRING_ID,IDWriteLocalizedStrings**) DECLSPEC_HIDDEN;
|
extern HRESULT opentype_get_font_strings_from_id(const void*,DWRITE_INFORMATIONAL_STRING_ID,IDWriteLocalizedStrings**) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
extern HRESULT bidi_computelevels(const WCHAR*,UINT32,UINT8,UINT8*,UINT8*) DECLSPEC_HIDDEN;
|
extern HRESULT bidi_computelevels(const WCHAR*,UINT32,UINT8,UINT8*,UINT8*) DECLSPEC_HIDDEN;
|
||||||
extern WCHAR bidi_get_mirrored_char(WCHAR) DECLSPEC_HIDDEN;
|
extern WCHAR bidi_get_mirrored_char(WCHAR) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -29,6 +29,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
|
||||||
#define MS_OS2_TAG DWRITE_MAKE_OPENTYPE_TAG('O','S','/','2')
|
#define MS_OS2_TAG DWRITE_MAKE_OPENTYPE_TAG('O','S','/','2')
|
||||||
#define MS_POST_TAG DWRITE_MAKE_OPENTYPE_TAG('p','o','s','t')
|
#define MS_POST_TAG DWRITE_MAKE_OPENTYPE_TAG('p','o','s','t')
|
||||||
#define MS_CMAP_TAG DWRITE_MAKE_OPENTYPE_TAG('c','m','a','p')
|
#define MS_CMAP_TAG DWRITE_MAKE_OPENTYPE_TAG('c','m','a','p')
|
||||||
|
#define MS_NAME_TAG DWRITE_MAKE_OPENTYPE_TAG('n','a','m','e')
|
||||||
|
|
||||||
struct dwrite_fontface_data {
|
struct dwrite_fontface_data {
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
@ -986,14 +987,26 @@ static HRESULT WINAPI dwritefont_GetInformationalStrings(IDWriteFont2 *iface,
|
||||||
|
|
||||||
if (!data->info_strings[stringid]) {
|
if (!data->info_strings[stringid]) {
|
||||||
IDWriteFontFace2 *fontface;
|
IDWriteFontFace2 *fontface;
|
||||||
|
const void *table_data;
|
||||||
|
BOOL table_exists;
|
||||||
|
void *context;
|
||||||
|
UINT32 size;
|
||||||
|
|
||||||
hr = get_fontface_from_font(This, &fontface);
|
hr = get_fontface_from_font(This, &fontface);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
hr = opentype_get_font_strings_from_id(fontface, stringid, &data->info_strings[stringid]);
|
table_exists = FALSE;
|
||||||
if (FAILED(hr) || !data->info_strings[stringid])
|
hr = IDWriteFontFace2_TryGetFontTable(fontface, MS_NAME_TAG, &table_data, &size, &context, &table_exists);
|
||||||
return hr;
|
if (FAILED(hr) || !table_exists)
|
||||||
|
WARN("no NAME table found.\n");
|
||||||
|
|
||||||
|
if (table_exists) {
|
||||||
|
hr = opentype_get_font_strings_from_id(table_data, stringid, &data->info_strings[stringid]);
|
||||||
|
if (FAILED(hr) || !data->info_strings[stringid])
|
||||||
|
return hr;
|
||||||
|
IDWriteFontFace2_ReleaseFontTable(fontface, context);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = clone_localizedstring(data->info_strings[stringid], strings);
|
hr = clone_localizedstring(data->info_strings[stringid], strings);
|
||||||
|
@ -1001,7 +1014,7 @@ static HRESULT WINAPI dwritefont_GetInformationalStrings(IDWriteFont2 *iface,
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
*exists = TRUE;
|
*exists = TRUE;
|
||||||
return hr;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWRITE_FONT_SIMULATIONS WINAPI dwritefont_GetSimulations(IDWriteFont2 *iface)
|
static DWRITE_FONT_SIMULATIONS WINAPI dwritefont_GetSimulations(IDWriteFont2 *iface)
|
||||||
|
|
|
@ -361,33 +361,36 @@ HRESULT add_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *locale,
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT clone_localizedstring(IDWriteLocalizedStrings *iface, IDWriteLocalizedStrings **strings)
|
HRESULT clone_localizedstring(IDWriteLocalizedStrings *iface, IDWriteLocalizedStrings **ret)
|
||||||
{
|
{
|
||||||
struct localizedstrings *This = impl_from_IDWriteLocalizedStrings(iface);
|
struct localizedstrings *strings, *strings_clone;
|
||||||
struct localizedstrings *New;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
*strings = NULL;
|
*ret = NULL;
|
||||||
|
|
||||||
New = heap_alloc(sizeof(struct localizedstrings));
|
if (!iface)
|
||||||
if (!New) return E_OUTOFMEMORY;
|
return S_FALSE;
|
||||||
|
|
||||||
New->IDWriteLocalizedStrings_iface.lpVtbl = &localizedstringsvtbl;
|
strings = impl_from_IDWriteLocalizedStrings(iface);
|
||||||
New->ref = 1;
|
strings_clone = heap_alloc(sizeof(struct localizedstrings));
|
||||||
New->count = This->count;
|
if (!strings_clone) return E_OUTOFMEMORY;
|
||||||
New->data = heap_alloc(sizeof(struct localizedpair) * New->count);
|
|
||||||
if (!New->data) {
|
strings_clone->IDWriteLocalizedStrings_iface.lpVtbl = &localizedstringsvtbl;
|
||||||
heap_free(New);
|
strings_clone->ref = 1;
|
||||||
|
strings_clone->count = strings->count;
|
||||||
|
strings_clone->data = heap_alloc(sizeof(struct localizedpair) * strings_clone->count);
|
||||||
|
if (!strings_clone->data) {
|
||||||
|
heap_free(strings_clone);
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
for (i = 0; i < New->count; i++)
|
for (i = 0; i < strings_clone->count; i++)
|
||||||
{
|
{
|
||||||
New->data[i].locale = heap_strdupW(This->data[i].locale);
|
strings_clone->data[i].locale = heap_strdupW(strings->data[i].locale);
|
||||||
New->data[i].string = heap_strdupW(This->data[i].string);
|
strings_clone->data[i].string = heap_strdupW(strings->data[i].string);
|
||||||
}
|
}
|
||||||
New->alloc = New->count;
|
strings_clone->alloc = strings_clone->count;
|
||||||
|
|
||||||
*strings = &New->IDWriteLocalizedStrings_iface;
|
*ret = &strings_clone->IDWriteLocalizedStrings_iface;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
|
||||||
|
|
||||||
#define MS_TTCF_TAG DWRITE_MAKE_OPENTYPE_TAG('t','t','c','f')
|
#define MS_TTCF_TAG DWRITE_MAKE_OPENTYPE_TAG('t','t','c','f')
|
||||||
#define MS_OTTO_TAG DWRITE_MAKE_OPENTYPE_TAG('O','T','T','O')
|
#define MS_OTTO_TAG DWRITE_MAKE_OPENTYPE_TAG('O','T','T','O')
|
||||||
#define MS_NAME_TAG DWRITE_MAKE_OPENTYPE_TAG('n','a','m','e')
|
|
||||||
|
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
#define GET_BE_WORD(x) (x)
|
#define GET_BE_WORD(x) (x)
|
||||||
|
@ -615,24 +614,18 @@ VOID get_font_properties(LPCVOID os2, LPCVOID head, LPCVOID post, DWRITE_FONT_ME
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT opentype_get_font_strings_from_id(IDWriteFontFace2 *fontface, DWRITE_INFORMATIONAL_STRING_ID id, IDWriteLocalizedStrings **strings)
|
HRESULT opentype_get_font_strings_from_id(const void *table_data, DWRITE_INFORMATIONAL_STRING_ID id, IDWriteLocalizedStrings **strings)
|
||||||
{
|
{
|
||||||
const void *table_data = NULL;
|
|
||||||
void *name_context = NULL;
|
|
||||||
const TT_NAME_V0 *header;
|
const TT_NAME_V0 *header;
|
||||||
BYTE *storage_area = 0;
|
BYTE *storage_area = 0;
|
||||||
BOOL exists = FALSE;
|
|
||||||
USHORT count = 0;
|
USHORT count = 0;
|
||||||
UINT16 name_id;
|
UINT16 name_id;
|
||||||
UINT32 size;
|
BOOL exists;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
hr = IDWriteFontFace2_TryGetFontTable(fontface, MS_NAME_TAG, &table_data, &size, &name_context, &exists);
|
if (!table_data)
|
||||||
if (FAILED(hr) || !exists) {
|
|
||||||
FIXME("failed to get NAME table\n");
|
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
|
||||||
|
|
||||||
hr = create_localizedstrings(strings);
|
hr = create_localizedstrings(strings);
|
||||||
if (FAILED(hr)) return hr;
|
if (FAILED(hr)) return hr;
|
||||||
|
@ -727,8 +720,6 @@ HRESULT opentype_get_font_strings_from_id(IDWriteFontFace2 *fontface, DWRITE_INF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IDWriteFontFace2_ReleaseFontTable(fontface, name_context);
|
|
||||||
|
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
IDWriteLocalizedStrings_Release(*strings);
|
IDWriteLocalizedStrings_Release(*strings);
|
||||||
*strings = NULL;
|
*strings = NULL;
|
||||||
|
|
|
@ -1521,10 +1521,9 @@ static void test_GetInformationalStrings(void)
|
||||||
exists = FALSE;
|
exists = FALSE;
|
||||||
strings = NULL;
|
strings = NULL;
|
||||||
hr = IDWriteFont_GetInformationalStrings(font, DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, &strings, &exists);
|
hr = IDWriteFont_GetInformationalStrings(font, DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, &strings, &exists);
|
||||||
todo_wine {
|
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
ok(exists == TRUE, "got %d\n", exists);
|
ok(exists == TRUE, "got %d\n", exists);
|
||||||
}
|
|
||||||
exists = TRUE;
|
exists = TRUE;
|
||||||
strings = NULL;
|
strings = NULL;
|
||||||
hr = IDWriteFont_GetInformationalStrings(font, DWRITE_INFORMATIONAL_STRING_NONE, &strings, &exists);
|
hr = IDWriteFont_GetInformationalStrings(font, DWRITE_INFORMATIONAL_STRING_NONE, &strings, &exists);
|
||||||
|
@ -1534,10 +1533,9 @@ todo_wine {
|
||||||
/* strings instance is not reused */
|
/* strings instance is not reused */
|
||||||
strings2 = NULL;
|
strings2 = NULL;
|
||||||
hr = IDWriteFont_GetInformationalStrings(font, DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, &strings2, &exists);
|
hr = IDWriteFont_GetInformationalStrings(font, DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, &strings2, &exists);
|
||||||
todo_wine {
|
|
||||||
ok(hr == S_OK, "got 0x%08x\n", hr);
|
ok(hr == S_OK, "got 0x%08x\n", hr);
|
||||||
|
todo_wine
|
||||||
ok(strings2 != strings, "got %p, %p\n", strings2, strings);
|
ok(strings2 != strings, "got %p, %p\n", strings2, strings);
|
||||||
}
|
|
||||||
|
|
||||||
if (strings)
|
if (strings)
|
||||||
IDWriteLocalizedStrings_Release(strings);
|
IDWriteLocalizedStrings_Release(strings);
|
||||||
|
|
Loading…
Reference in New Issue