gdi32: Fixed localized font style name.

This commit is contained in:
Qian Hong 2012-09-11 01:05:57 +08:00 committed by Alexandre Julliard
parent 4461612e33
commit 80dbd4e9cf
2 changed files with 26 additions and 7 deletions

View File

@ -1714,7 +1714,14 @@ static Face *create_face( FT_Face ft_face, FT_Long face_index, const char *file,
Face *face = HeapAlloc( GetProcessHeap(), 0, sizeof(*face) );
My_FT_Bitmap_Size *size = (My_FT_Bitmap_Size *)ft_face->available_sizes;
face->StyleName = get_face_name( ft_face, TT_NAME_ID_FONT_SUBFAMILY, GetSystemDefaultLangID() );
if (!face->StyleName)
face->StyleName = get_face_name( ft_face, TT_NAME_ID_FONT_SUBFAMILY, TT_MS_LANGID_ENGLISH_UNITED_STATES );
if (!face->StyleName)
{
face->StyleName = towstr( CP_ACP, ft_face->style_name );
}
face->FullName = get_face_name( ft_face, TT_NAME_ID_FULL_NAME, GetSystemDefaultLangID() );
if (!face->FullName)
face->FullName = get_face_name( ft_face, TT_NAME_ID_FULL_NAME, TT_MS_LANGID_ENGLISH_UNITED_STATES );
@ -6549,11 +6556,18 @@ static BOOL get_outline_text_metrics(GdiFont *font)
lenfam = (strlenW(font->name) + 1) * sizeof(WCHAR);
family_nameW = strdupW(font->name);
lensty = MultiByteToWideChar(CP_ACP, 0, ft_face->style_name, -1, NULL, 0)
* sizeof(WCHAR);
style_nameW = get_face_name( ft_face, TT_NAME_ID_FONT_SUBFAMILY, GetSystemDefaultLangID() );
if (!style_nameW)
style_nameW = get_face_name( ft_face, TT_NAME_ID_FONT_SUBFAMILY, TT_MS_LANGID_ENGLISH_UNITED_STATES );
if (!style_nameW)
{
FIXME("failed to read sytle_nameW for font %s!\n", wine_dbgstr_w(font->name));
lensty = MultiByteToWideChar(CP_ACP, 0, ft_face->style_name, -1, NULL, 0) * sizeof(WCHAR);
style_nameW = HeapAlloc(GetProcessHeap(), 0, lensty);
MultiByteToWideChar(CP_ACP, 0, ft_face->style_name, -1,
style_nameW, lensty/sizeof(WCHAR));
MultiByteToWideChar(CP_ACP, 0, ft_face->style_name, -1, style_nameW, lensty/sizeof(WCHAR));
}
else
lensty = (strlenW(style_nameW) + 1) * sizeof(WCHAR);
face_nameW = get_face_name( ft_face, TT_NAME_ID_FULL_NAME, GetSystemDefaultLangID() );
if (!face_nameW)

View File

@ -4132,7 +4132,12 @@ static void test_fullname2_helper(const char *Family)
bufW[0] = 0;
bufA[0] = 0;
ret = get_ttf_nametable_entry(hdc, TT_NAME_ID_FONT_SUBFAMILY, bufW, buf_size, GetSystemDefaultLangID());
if (!ret)
{
trace("no localized FONT_SUBFAMILY font.\n");
ret = get_ttf_nametable_entry(hdc, TT_NAME_ID_FONT_SUBFAMILY, bufW, buf_size, TT_MS_LANGID_ENGLISH_UNITED_STATES);
}
ok(ret, "SUBFAMILY (style name) could not be read\n");
WideCharToMultiByte(CP_ACP, 0, bufW, -1, bufA, buf_size, NULL, FALSE);
ok(!lstrcmpA(StyleName, bufA), "style names don't match: returned %s, expect %s\n", StyleName, bufA);