[PATCH 3/4] dwrite: Fix IDWriteFactory3 methods order
Nikolay Sivov
nsivov at codeweavers.com
Tue Apr 19 01:39:27 CDT 2016
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/dwrite/main.c | 16 ++++++++--------
dlls/dwrite/tests/font.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
include/dwrite_3.idl | 12 +++++++-----
3 files changed, 64 insertions(+), 13 deletions(-)
diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c
index bf0c41d..de60147 100644
--- a/dlls/dwrite/main.c
+++ b/dlls/dwrite/main.c
@@ -1261,22 +1261,22 @@ static HRESULT WINAPI dwritefactory3_CreateCustomRenderingParams(IDWriteFactory3
gridfit_mode, params);
}
-static HRESULT WINAPI dwritefactory3_CreateFontFaceReference(IDWriteFactory3 *iface, WCHAR const *path, FILETIME const *writetime,
- UINT32 index, DWRITE_FONT_SIMULATIONS simulations, IDWriteFontFaceReference **reference)
+static HRESULT WINAPI dwritefactory3_CreateFontFaceReference_(IDWriteFactory3 *iface, IDWriteFontFile *file, UINT32 index,
+ DWRITE_FONT_SIMULATIONS simulations, IDWriteFontFaceReference **reference)
{
struct dwritefactory *This = impl_from_IDWriteFactory3(iface);
- FIXME("(%p)->(%s %p %u %x, %p): stub\n", This, debugstr_w(path), writetime, index, simulations, reference);
+ FIXME("(%p)->(%p %u %x %p): stub\n", This, file, index, simulations, reference);
return E_NOTIMPL;
}
-static HRESULT WINAPI dwritefactory3_CreateFontFaceReference_(IDWriteFactory3 *iface, IDWriteFontFile *file, UINT32 index,
- DWRITE_FONT_SIMULATIONS simulations, IDWriteFontFaceReference **reference)
+static HRESULT WINAPI dwritefactory3_CreateFontFaceReference(IDWriteFactory3 *iface, WCHAR const *path, FILETIME const *writetime,
+ UINT32 index, DWRITE_FONT_SIMULATIONS simulations, IDWriteFontFaceReference **reference)
{
struct dwritefactory *This = impl_from_IDWriteFactory3(iface);
- FIXME("(%p)->(%p %u %x %p): stub\n", This, file, index, simulations, reference);
+ FIXME("(%p)->(%s %p %u %x, %p): stub\n", This, debugstr_w(path), writetime, index, simulations, reference);
return E_NOTIMPL;
}
@@ -1362,8 +1362,8 @@ static const struct IDWriteFactory3Vtbl dwritefactoryvtbl = {
dwritefactory2_CreateGlyphRunAnalysis,
dwritefactory3_CreateGlyphRunAnalysis,
dwritefactory3_CreateCustomRenderingParams,
- dwritefactory3_CreateFontFaceReference,
dwritefactory3_CreateFontFaceReference_,
+ dwritefactory3_CreateFontFaceReference,
dwritefactory3_GetSystemFontSet,
dwritefactory3_CreateFontSetBuilder,
dwritefactory3_CreateFontCollectionFromFontSet,
@@ -1419,8 +1419,8 @@ static const struct IDWriteFactory3Vtbl shareddwritefactoryvtbl = {
dwritefactory2_CreateGlyphRunAnalysis,
dwritefactory3_CreateGlyphRunAnalysis,
dwritefactory3_CreateCustomRenderingParams,
- dwritefactory3_CreateFontFaceReference,
dwritefactory3_CreateFontFaceReference_,
+ dwritefactory3_CreateFontFaceReference,
dwritefactory3_GetSystemFontSet,
dwritefactory3_CreateFontSetBuilder,
dwritefactory3_CreateFontCollectionFromFontSet,
diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c
index 515ece4..3c1f332 100644
--- a/dlls/dwrite/tests/font.c
+++ b/dlls/dwrite/tests/font.c
@@ -5792,6 +5792,54 @@ static void test_HasCharacter(void)
IDWriteFactory_Release(factory);
}
+static void test_CreateFontFaceReference(void)
+{
+ static const WCHAR dummyW[] = {'d','u','m','m','y',0};
+ IDWriteFontFaceReference *ref;
+ IDWriteFactory3 *factory3;
+ IDWriteFactory *factory;
+ UINT32 index;
+ WCHAR *path;
+ HRESULT hr;
+
+ factory = create_factory();
+
+ hr = IDWriteFactory_QueryInterface(factory, &IID_IDWriteFactory3, (void**)&factory3);
+ IDWriteFactory_Release(factory);
+ if (FAILED(hr)) {
+ win_skip("CreateFontFaceReference() is not supported.\n");
+ return;
+ }
+
+ path = create_testfontfile(test_fontfile);
+
+ hr = IDWriteFactory3_CreateFontFaceReference(factory3, NULL, NULL, 0, DWRITE_FONT_SIMULATIONS_NONE, &ref);
+todo_wine
+ ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+
+ /* test file is not a collection, but reference could still be created */
+ hr = IDWriteFactory3_CreateFontFaceReference(factory3, path, NULL, 1, DWRITE_FONT_SIMULATIONS_NONE, &ref);
+todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+if (hr == S_OK) {
+ index = IDWriteFontFaceReference_GetFontFaceIndex(ref);
+ ok(index == 1, "got %u\n", index);
+}
+ /* path however has to be valid */
+ hr = IDWriteFactory3_CreateFontFaceReference(factory3, dummyW, NULL, 0, DWRITE_FONT_SIMULATIONS_NONE, &ref);
+todo_wine
+ ok(hr == DWRITE_E_FILENOTFOUND, "got 0x%08x\n", hr);
+
+ hr = IDWriteFactory3_CreateFontFaceReference(factory3, path, NULL, 0, DWRITE_FONT_SIMULATIONS_NONE, &ref);
+todo_wine
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+if (hr == S_OK)
+ IDWriteFontFaceReference_Release(ref);
+
+ IDWriteFactory3_Release(factory3);
+ DELETE_FONTFILE(path);
+}
+
START_TEST(font)
{
IDWriteFactory *factory;
@@ -5846,6 +5894,7 @@ START_TEST(font)
test_GetPaletteEntries();
test_TranslateColorGlyphRun();
test_HasCharacter();
+ test_CreateFontFaceReference();
IDWriteFactory_Release(factory);
}
diff --git a/include/dwrite_3.idl b/include/dwrite_3.idl
index b69f29a..bf16800 100644
--- a/include/dwrite_3.idl
+++ b/include/dwrite_3.idl
@@ -282,15 +282,17 @@ interface IDWriteFactory3 : IDWriteFactory2
DWRITE_GRID_FIT_MODE gridfit_mode,
IDWriteRenderingParams3 **params);
- HRESULT CreateFontFaceReference(
- WCHAR const *path,
- FILETIME const *writetime,
+ /* CreateFontFaceReference methods are listed in reversed order to make
+ resulting vtable order compatible. */
+ HRESULT CreateFontFaceReference_(
+ IDWriteFontFile *file,
UINT32 index,
DWRITE_FONT_SIMULATIONS simulations,
IDWriteFontFaceReference **reference);
- HRESULT CreateFontFaceReference_(
- IDWriteFontFile *file,
+ HRESULT CreateFontFaceReference(
+ WCHAR const *path,
+ FILETIME const *writetime,
UINT32 index,
DWRITE_FONT_SIMULATIONS simulations,
IDWriteFontFaceReference **reference);
--
2.8.0.rc3
More information about the wine-patches
mailing list