From c9bb307c358c0b9361d4168b9fcea60856cfc157 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 6 Oct 2014 05:01:22 +0400 Subject: [PATCH] dwrite: Store OpenType language tag in shaping cache. --- dlls/dwrite/analyzer.c | 2 +- dlls/dwrite/dwrite_private.h | 6 +++++- dlls/dwrite/opentype.c | 4 ---- dlls/dwrite/shape.c | 10 +++++++++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c index e2fac55383f..5851e909805 100644 --- a/dlls/dwrite/analyzer.c +++ b/dlls/dwrite/analyzer.c @@ -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; diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 3eb7957be85..5a2b5a31ddc 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -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 diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index 532c126ef8a..318adcfcad8 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -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') diff --git a/dlls/dwrite/shape.c b/dlls/dwrite/shape.c index bf098617d2f..dbf5c67a0ad 100644 --- a/dlls/dwrite/shape.c +++ b/dlls/dwrite/shape.c @@ -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;