From: Akihiro Sagawa sagawa.aki@gmail.com
Also added and prioritized 'DFLT' as the default script tag, with 'dflt' as a secondary option.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56658 --- dlls/win32u/font.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/dlls/win32u/font.c b/dlls/win32u/font.c index 277849ac4d9..e196e1392d5 100644 --- a/dlls/win32u/font.c +++ b/dlls/win32u/font.c @@ -2638,7 +2638,6 @@ typedef struct static GSUB_Script *GSUB_get_script_table( GSUB_Header *header, const char *tag ) { GSUB_ScriptList *script; - GSUB_Script *deflt = NULL; int i;
script = (GSUB_ScriptList *)((BYTE *)header + GET_BE_WORD(header->ScriptList)); @@ -2648,9 +2647,8 @@ static GSUB_Script *GSUB_get_script_table( GSUB_Header *header, const char *tag int offset = GET_BE_WORD(script->ScriptRecord[i].Script); GSUB_Script *scr = (GSUB_Script *)((BYTE *)script + offset); if (!memcmp( script->ScriptRecord[i].ScriptTag, tag, 4 )) return scr; - if (!memcmp( script->ScriptRecord[i].ScriptTag, "dflt", 4 )) deflt = scr; } - return deflt; + return NULL; }
static GSUB_LangSys *GSUB_get_lang_table( GSUB_Script *script, const char *tag ) @@ -2715,11 +2713,13 @@ static const char *get_opentype_script( const struct gdi_font *font )
static void *get_GSUB_vert_feature( struct gdi_font *font ) { + int i; GSUB_Header *header; GSUB_Script *script; GSUB_LangSys *language; GSUB_Feature *feature; UINT length = font_funcs->get_font_data( font, MS_GSUB_TAG, 0, NULL, 0 ); + const char* script_list[3];
if (length == GDI_ERROR) return NULL;
@@ -2727,22 +2727,29 @@ static void *get_GSUB_vert_feature( struct gdi_font *font ) font_funcs->get_font_data( font, MS_GSUB_TAG, 0, header, length ); TRACE( "Loaded GSUB table of %i bytes\n", length );
- if ((script = GSUB_get_script_table( header, get_opentype_script(font) ))) + script_list[0] = get_opentype_script(font); + script_list[1] = "DFLT"; + script_list[2] = "dflt"; + + for (i = 0; i < ARRAY_SIZE(script_list); i++) { - if ((language = GSUB_get_lang_table( script, "xxxx" ))) /* Need to get Lang tag */ + if ((script = GSUB_get_script_table( header, script_list[i] ))) { - feature = GSUB_get_feature( header, language, "vrt2" ); - if (!feature) feature = GSUB_get_feature( header, language, "vert" ); - if (feature) + if ((language = GSUB_get_lang_table( script, "xxxx" ))) /* Need to get Lang tag */ { - font->gsub_table = header; - return feature; + feature = GSUB_get_feature( header, language, "vrt2" ); + if (!feature) feature = GSUB_get_feature( header, language, "vert" ); + if (feature) + { + font->gsub_table = header; + return feature; + } + TRACE("[%s] vrt2/vert feature not found\n", script_list[i]); } - TRACE("vrt2/vert feature not found\n"); + else TRACE("[%s] Language not found\n", script_list[i]); } - else TRACE("Language not found\n"); + else TRACE("[%s] Script not found\n", script_list[i]); } - else TRACE("Script not found\n");
free( header ); return NULL;