mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
gdi32: Add vertical fonts to font list.
This commit is contained in:
parent
65f809248f
commit
69a26387b3
@ -1450,11 +1450,25 @@ static void AddFaceToFamily(Face *face, Family *family)
|
||||
list_add_before( entry, &face->entry );
|
||||
}
|
||||
|
||||
static WCHAR *prepend_at(WCHAR *family)
|
||||
{
|
||||
WCHAR *str;
|
||||
|
||||
if (!family)
|
||||
return NULL;
|
||||
|
||||
str = HeapAlloc(GetProcessHeap(), 0, sizeof (WCHAR) * (strlenW(family) + 2));
|
||||
str[0] = '@';
|
||||
strcpyW(str + 1, family);
|
||||
HeapFree(GetProcessHeap(), 0, family);
|
||||
return str;
|
||||
}
|
||||
|
||||
#define ADDFONT_EXTERNAL_FONT 0x01
|
||||
#define ADDFONT_FORCE_BITMAP 0x02
|
||||
#define ADDFONT_ADD_TO_CACHE 0x04
|
||||
|
||||
static void AddFaceToList(FT_Face ft_face, char *fake_family, const char *file, void *font_data_ptr, DWORD font_data_size, FT_Long face_index, DWORD flags)
|
||||
static void AddFaceToList(FT_Face ft_face, char *fake_family, const char *file, void *font_data_ptr, DWORD font_data_size, FT_Long face_index, DWORD flags, BOOL vertical)
|
||||
{
|
||||
int bitmap_num = 0;
|
||||
Family *family;
|
||||
@ -1494,6 +1508,12 @@ static void AddFaceToList(FT_Face ft_face, char *fake_family, const char *file,
|
||||
}
|
||||
}
|
||||
|
||||
if (vertical)
|
||||
{
|
||||
english_family = prepend_at(english_family);
|
||||
localised_family = prepend_at(localised_family);
|
||||
}
|
||||
|
||||
family = find_family_from_name(localised_family ? localised_family : english_family);
|
||||
if(!family) {
|
||||
family = HeapAlloc(GetProcessHeap(), 0, sizeof(*family));
|
||||
@ -1671,6 +1691,7 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_
|
||||
WCHAR *localised_family;
|
||||
FT_Error err;
|
||||
FT_Long face_index = 0, num_faces;
|
||||
INT ret = 0;
|
||||
|
||||
/* we always load external fonts from files - otherwise we would get a crash in update_reg_entries */
|
||||
assert(file || !(flags & ADDFONT_EXTERNAL_FONT));
|
||||
@ -1779,12 +1800,19 @@ static INT AddFontToList(const char *file, void *font_data_ptr, DWORD font_data_
|
||||
HeapFree(GetProcessHeap(), 0, localised_family);
|
||||
}
|
||||
|
||||
AddFaceToList(ft_face, fake_family, file, font_data_ptr, font_data_size, face_index, flags);
|
||||
AddFaceToList(ft_face, fake_family, file, font_data_ptr, font_data_size, face_index, flags, FALSE);
|
||||
++ret;
|
||||
|
||||
if (FT_HAS_VERTICAL(ft_face))
|
||||
{
|
||||
AddFaceToList(ft_face, fake_family, file, font_data_ptr, font_data_size, face_index, flags, TRUE);
|
||||
++ret;
|
||||
}
|
||||
|
||||
num_faces = ft_face->num_faces;
|
||||
pFT_Done_Face(ft_face);
|
||||
} while(num_faces > ++face_index);
|
||||
return num_faces;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static INT AddFontFileToList(const char *file, char *fake_family, const WCHAR *target_family, DWORD flags)
|
||||
|
@ -4121,7 +4121,6 @@ static void test_vertical_font(void)
|
||||
}
|
||||
|
||||
num = pAddFontResourceExA(ttf_name, FR_PRIVATE, 0);
|
||||
todo_wine
|
||||
ok(num == 2, "AddFontResourceExA should add 2 fonts from vertical.ttf\n");
|
||||
|
||||
check_vertical_font("@WineTestVertical", &installed, &selected, &gm);
|
||||
@ -4133,11 +4132,8 @@ static void test_vertical_font(void)
|
||||
gm.gmBlackBoxX, gm.gmBlackBoxY);
|
||||
|
||||
check_vertical_font("@@WineTestVertical", &installed, &selected, &gm);
|
||||
todo_wine
|
||||
ok(installed, "@@WineTestVertical is not installed\n");
|
||||
todo_wine
|
||||
ok(selected, "@@WineTestVertical is not selected\n");
|
||||
todo_wine
|
||||
ok(gm.gmBlackBoxX < gm.gmBlackBoxY,
|
||||
"gmBlackBoxX(%u) should be less than gmBlackBoxY(%u) if vertical\n",
|
||||
gm.gmBlackBoxX, gm.gmBlackBoxY);
|
||||
|
Loading…
Reference in New Issue
Block a user