[PATCH] gdi32: Improve structure layout of data returned by GetFontRealizationInfo()
Nikolay Sivov
nsivov at codeweavers.com
Thu Oct 8 13:13:57 CDT 2015
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/dwrite/gdiinterop.c | 6 ++++--
dlls/gdi32/freetype.c | 5 +++++
dlls/gdi32/gdi_private.h | 3 ++-
dlls/gdi32/tests/font.c | 7 +++++--
4 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/dlls/dwrite/gdiinterop.c b/dlls/dwrite/gdiinterop.c
index cf81699..e178f33 100644
--- a/dlls/dwrite/gdiinterop.c
+++ b/dlls/dwrite/gdiinterop.c
@@ -783,7 +783,8 @@ struct font_realization_info {
DWORD cache_num;
DWORD instance_id;
DWORD unk;
- DWORD face_index;
+ WORD face_index;
+ WORD simulations;
};
struct font_fileinfo {
@@ -853,7 +854,8 @@ static HRESULT WINAPI gdiinterop_CreateFontFaceFromHdc(IDWriteGdiInterop *iface,
return hr;
}
- hr = IDWriteFactory2_CreateFontFace(This->factory, facetype, 1, &file, info.face_index, DWRITE_FONT_SIMULATIONS_NONE,
+ /* Simulations flags values match DWRITE_FONT_SIMULATIONS */
+ hr = IDWriteFactory2_CreateFontFace(This->factory, facetype, 1, &file, info.face_index, info.simulations,
fontface);
IDWriteFontFile_Release(file);
return hr;
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 33e196c..95df22a 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -8282,6 +8282,11 @@ static BOOL freetype_GetFontRealizationInfo( PHYSDEV dev, void *ptr )
{
info->unk = 0;
info->face_index = physdev->font->ft_face->face_index;
+ info->simulations = 0;
+ if (physdev->font->fake_bold)
+ info->simulations |= 0x1;
+ if (physdev->font->fake_italic)
+ info->simulations |= 0x2;
}
return TRUE;
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 2e52e08..337fe27 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -284,7 +284,8 @@ struct font_realization_info
DWORD cache_num; /* keeps incrementing - num of fonts that have been created allowing for caching?? */
DWORD instance_id; /* identifies a realized font instance */
DWORD unk; /* unknown */
- DWORD face_index; /* face index in case of font collections */
+ WORD face_index; /* face index in case of font collections */
+ WORD simulations; /* 0 bit - bold simulation, 1 bit - oblique simulation */
};
extern INT WineEngAddFontResourceEx(LPCWSTR, DWORD, PVOID) DECLSPEC_HIDDEN;
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index fd9bda3..6eefc3b 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -4136,7 +4136,8 @@ static void test_RealizationInfo(void)
DWORD cache_num;
DWORD instance_id;
DWORD unk;
- DWORD face_index;
+ WORD face_index;
+ WORD simulations;
};
struct realization_info_t
@@ -4186,7 +4187,8 @@ static void test_RealizationInfo(void)
memset(&lf, 0, sizeof(lf));
strcpy(lf.lfFaceName, "Tahoma");
lf.lfHeight = 20;
- lf.lfWeight = FW_NORMAL;
+ lf.lfWeight = FW_BOLD;
+ lf.lfItalic = 1;
hfont = CreateFontIndirectA(&lf);
hfont_old = SelectObject(hdc, hfont);
@@ -4234,6 +4236,7 @@ static void test_RealizationInfo(void)
ok(fri->flags == ri->flags, "flags mismatch\n");
ok(fri->cache_num == ri->cache_num, "cache_num mismatch\n");
ok(fri->instance_id == ri->instance_id, "instance id mismatch\n");
+ ok(fri->simulations == 0x2, "got simulations flags 0x%04x\n", fri->simulations);
ok(fri->face_index == 0, "got wrong face index %u\n", fri->face_index);
ok(info2[6] == 0xcccccccc, "structure longer than 6 dwords\n");
--
2.6.1
More information about the wine-patches
mailing list