1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-08 20:06:18 +00:00

dwrite: Add partial implementation for IDWriteFontFace5::Equals().

Issue with missing method spotted by Brendan Shanks.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-08-21 15:39:27 +03:00 committed by Alexandre Julliard
parent 15a39f9990
commit ab94abb14f
2 changed files with 27 additions and 1 deletions

View File

@ -1562,6 +1562,22 @@ static HRESULT WINAPI dwritefontface5_GetFontResource(IDWriteFontFace5 *iface, I
return IDWriteFactory7_CreateFontResource(fontface->factory, fontface->files[0], fontface->index, resource);
}
static BOOL WINAPI dwritefontface5_Equals(IDWriteFontFace5 *iface, IDWriteFontFace *other)
{
struct dwrite_fontface *fontface = impl_from_IDWriteFontFace5(iface), *other_face;
TRACE("%p, %p.\n", iface, other);
if (!(other_face = unsafe_impl_from_IDWriteFontFace(other)))
return FALSE;
/* TODO: add variations support */
return fontface->index == other_face->index &&
fontface->simulations == other_face->simulations &&
is_same_fontfile(fontface->files[0], other_face->files[0]);
}
static const IDWriteFontFace5Vtbl dwritefontfacevtbl =
{
dwritefontface_QueryInterface,
@ -1621,6 +1637,7 @@ static const IDWriteFontFace5Vtbl dwritefontfacevtbl =
dwritefontface5_GetFontAxisValues,
dwritefontface5_HasVariations,
dwritefontface5_GetFontResource,
dwritefontface5_Equals,
};
static HRESULT WINAPI dwritefontface_reference_QueryInterface(IDWriteFontFaceReference *iface, REFIID riid, void **obj)

View File

@ -1817,13 +1817,14 @@ static void test_CreateFontFace(void)
IDWriteFontCollection *collection;
DWRITE_FONT_FILE_TYPE file_type;
DWRITE_FONT_FACE_TYPE face_type;
IDWriteFontFace5 *fontface5;
IDWriteGdiInterop *interop;
IDWriteFont *font, *font2;
IDWriteFontFamily *family;
IDWriteFactory *factory;
IDWriteFontFile *file;
BOOL supported, ret;
LOGFONTW logfont;
BOOL supported;
UINT32 count;
WCHAR *path;
HRESULT hr;
@ -1908,6 +1909,14 @@ static void test_CreateFontFace(void)
ok(hr == S_OK, "got 0x%08x\n", hr);
ok(fontface == fontface2, "got %p, was %p\n", fontface2, fontface);
/* Trivial equality test */
if (SUCCEEDED(IDWriteFontFace_QueryInterface(fontface, &IID_IDWriteFontFace5, (void **)&fontface5)))
{
ret = IDWriteFontFace5_Equals(fontface5, fontface2);
ok(ret, "Unexpected result %d.\n", ret);
IDWriteFontFace5_Release(fontface5);
}
IDWriteFontFace_Release(fontface);
IDWriteFontFace_Release(fontface2);
IDWriteFont_Release(font2);