dwrite: Store OpenType language tag in shaping cache.

This commit is contained in:
Nikolay Sivov 2014-10-06 05:01:22 +04:00 committed by Alexandre Julliard
parent cb8556c171
commit c9bb307c35
4 changed files with 15 additions and 7 deletions

View File

@ -926,7 +926,7 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphs(IDWriteTextAnalyzer2 *iface,
}
*actual_glyph_count = g;
hr = create_scriptshaping_cache(fontface, &cache);
hr = create_scriptshaping_cache(fontface, locale, &cache);
if (FAILED(hr))
goto done;

View File

@ -19,6 +19,10 @@
#include "wine/debug.h"
#include "wine/unicode.h"
#define DWRITE_MAKE_OPENTYPE_TAG(ch0, ch1, ch2, ch3) \
((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24))
static inline void *heap_alloc(size_t len)
{
return HeapAlloc(GetProcessHeap(), 0, len);
@ -136,7 +140,7 @@ enum SCRIPT_JUSTIFY
};
struct scriptshaping_cache;
extern HRESULT create_scriptshaping_cache(IDWriteFontFace*,struct scriptshaping_cache**) DECLSPEC_HIDDEN;
extern HRESULT create_scriptshaping_cache(IDWriteFontFace*,const WCHAR*,struct scriptshaping_cache**) DECLSPEC_HIDDEN;
extern void release_scriptshaping_cache(struct scriptshaping_cache*) DECLSPEC_HIDDEN;
struct scriptshaping_ops

View File

@ -25,10 +25,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
#define DWRITE_MAKE_OPENTYPE_TAG(ch0, ch1, ch2, ch3) \
((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24))
#define MS_TTCF_TAG DWRITE_MAKE_OPENTYPE_TAG('t','t','c','f')
#define MS_OTTO_TAG DWRITE_MAKE_OPENTYPE_TAG('O','T','T','O')

View File

@ -29,9 +29,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
struct scriptshaping_cache
{
IDWriteFontFace *fontface;
UINT32 language_tag;
};
HRESULT create_scriptshaping_cache(IDWriteFontFace *fontface, struct scriptshaping_cache **cache)
HRESULT create_scriptshaping_cache(IDWriteFontFace *fontface, const WCHAR *locale, struct scriptshaping_cache **cache)
{
struct scriptshaping_cache *ret;
@ -42,6 +43,13 @@ HRESULT create_scriptshaping_cache(IDWriteFontFace *fontface, struct scriptshapi
ret->fontface = fontface;
IDWriteFontFace_AddRef(fontface);
ret->language_tag = DWRITE_MAKE_OPENTYPE_TAG('d','f','l','t');
if (locale) {
WCHAR tag[5];
if (GetLocaleInfoEx(locale, LOCALE_SOPENTYPELANGUAGETAG, tag, sizeof(tag)/sizeof(WCHAR)))
ret->language_tag = DWRITE_MAKE_OPENTYPE_TAG(tag[0],tag[1],tag[2],tag[3]);
}
*cache = ret;
return S_OK;