Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/font.c | 220 ++++++++++++++++++++++++--------------------- 1 file changed, 119 insertions(+), 101 deletions(-)
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index be9ff88fe4..f83c14381f 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -221,9 +221,10 @@ struct dwrite_fontfile { IDWriteFontFileStream *stream; };
-struct dwrite_fontfacereference { - IDWriteFontFaceReference IDWriteFontFaceReference_iface; - LONG ref; +struct dwrite_fontfacereference +{ + IDWriteFontFaceReference1 IDWriteFontFaceReference1_iface; + LONG refcount;
IDWriteFontFile *file; UINT32 index; @@ -317,9 +318,9 @@ static inline struct dwrite_fontlist *impl_from_IDWriteFontList1(IDWriteFontList return CONTAINING_RECORD(iface, struct dwrite_fontlist, IDWriteFontList1_iface); }
-static inline struct dwrite_fontfacereference *impl_from_IDWriteFontFaceReference(IDWriteFontFaceReference *iface) +static inline struct dwrite_fontfacereference *impl_from_IDWriteFontFaceReference1(IDWriteFontFaceReference1 *iface) { - return CONTAINING_RECORD(iface, struct dwrite_fontfacereference, IDWriteFontFaceReference_iface); + return CONTAINING_RECORD(iface, struct dwrite_fontfacereference, IDWriteFontFaceReference1_iface); }
static HRESULT get_cached_glyph_metrics(struct dwrite_fontface *fontface, UINT16 glyph, DWRITE_GLYPH_METRICS *metrics) @@ -5890,15 +5891,16 @@ HRESULT create_colorglyphenum(float originX, float originY, const DWRITE_GLYPH_R }
/* IDWriteFontFaceReference */ -static HRESULT WINAPI fontfacereference_QueryInterface(IDWriteFontFaceReference *iface, REFIID riid, void **obj) +static HRESULT WINAPI fontfacereference_QueryInterface(IDWriteFontFaceReference1 *iface, REFIID riid, void **obj) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); - - TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
- if (IsEqualIID(riid, &IID_IDWriteFontFaceReference) || IsEqualIID(riid, &IID_IUnknown)) { + if (IsEqualIID(riid, &IID_IDWriteFontFaceReference1) || + IsEqualIID(riid, &IID_IDWriteFontFaceReference) || + IsEqualIID(riid, &IID_IUnknown)) + { *obj = iface; - IDWriteFontFaceReference_AddRef(iface); + IDWriteFontFaceReference1_AddRef(iface); return S_OK; }
@@ -5909,43 +5911,46 @@ static HRESULT WINAPI fontfacereference_QueryInterface(IDWriteFontFaceReference return E_NOINTERFACE; }
-static ULONG WINAPI fontfacereference_AddRef(IDWriteFontFaceReference *iface) +static ULONG WINAPI fontfacereference_AddRef(IDWriteFontFaceReference1 *iface) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); - ULONG ref = InterlockedIncrement(&This->ref); - TRACE("(%p)->(%u)\n", This, ref); - return ref; + struct dwrite_fontfacereference *reference = impl_from_IDWriteFontFaceReference1(iface); + ULONG refcount = InterlockedIncrement(&reference->refcount); + + TRACE("%p, refcount %u.\n", iface, refcount); + + return refcount; }
-static ULONG WINAPI fontfacereference_Release(IDWriteFontFaceReference *iface) +static ULONG WINAPI fontfacereference_Release(IDWriteFontFaceReference1 *iface) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); - ULONG ref = InterlockedDecrement(&This->ref); + struct dwrite_fontfacereference *reference = impl_from_IDWriteFontFaceReference1(iface); + ULONG refcount = InterlockedDecrement(&reference->refcount);
- TRACE("(%p)->(%u)\n", This, ref); + TRACE("%p, refcount %u.\n", iface, refcount);
- if (!ref) { - IDWriteFontFile_Release(This->file); - IDWriteFactory5_Release(This->factory); - heap_free(This); + if (!refcount) + { + IDWriteFontFile_Release(reference->file); + IDWriteFactory5_Release(reference->factory); + heap_free(reference); }
- return ref; + return refcount; }
-static HRESULT WINAPI fontfacereference_CreateFontFace(IDWriteFontFaceReference *iface, IDWriteFontFace3 **fontface) +static HRESULT WINAPI fontfacereference_CreateFontFace(IDWriteFontFaceReference1 *iface, IDWriteFontFace3 **fontface) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); + struct dwrite_fontfacereference *reference = impl_from_IDWriteFontFaceReference1(iface);
- TRACE("(%p)->(%p)\n", This, fontface); + TRACE("%p, %p.\n", iface, fontface);
- return IDWriteFontFaceReference_CreateFontFaceWithSimulations(iface, This->simulations, fontface); + return IDWriteFontFaceReference1_CreateFontFaceWithSimulations(iface, reference->simulations, fontface); }
-static HRESULT WINAPI fontfacereference_CreateFontFaceWithSimulations(IDWriteFontFaceReference *iface, +static HRESULT WINAPI fontfacereference_CreateFontFaceWithSimulations(IDWriteFontFaceReference1 *iface, DWRITE_FONT_SIMULATIONS simulations, IDWriteFontFace3 **ret) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); + struct dwrite_fontfacereference *reference = impl_from_IDWriteFontFaceReference1(iface); DWRITE_FONT_FILE_TYPE file_type; DWRITE_FONT_FACE_TYPE face_type; IDWriteFontFace *fontface; @@ -5953,14 +5958,16 @@ static HRESULT WINAPI fontfacereference_CreateFontFaceWithSimulations(IDWriteFon UINT32 face_num; HRESULT hr;
- TRACE("(%p)->(%d %p)\n", This, simulations, ret); + TRACE("%p, %#x, %p.\n", iface, simulations, ret);
- hr = IDWriteFontFile_Analyze(This->file, &is_supported, &file_type, &face_type, &face_num); + hr = IDWriteFontFile_Analyze(reference->file, &is_supported, &file_type, &face_type, &face_num); if (FAILED(hr)) return hr;
- hr = IDWriteFactory5_CreateFontFace(This->factory, face_type, 1, &This->file, This->index, simulations, &fontface); - if (SUCCEEDED(hr)) { + hr = IDWriteFactory5_CreateFontFace(reference->factory, face_type, 1, &reference->file, reference->index, + simulations, &fontface); + if (SUCCEEDED(hr)) + { hr = IDWriteFontFace_QueryInterface(fontface, &IID_IDWriteFontFace3, (void **)ret); IDWriteFontFace_Release(fontface); } @@ -5968,143 +5975,150 @@ static HRESULT WINAPI fontfacereference_CreateFontFaceWithSimulations(IDWriteFon return hr; }
-static BOOL WINAPI fontfacereference_Equals(IDWriteFontFaceReference *iface, IDWriteFontFaceReference *ref) +static BOOL WINAPI fontfacereference_Equals(IDWriteFontFaceReference1 *iface, IDWriteFontFaceReference *ref) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); + struct dwrite_fontfacereference *reference = impl_from_IDWriteFontFaceReference1(iface); IDWriteFontFile *file; BOOL ret;
- TRACE("(%p)->(%p)\n", This, ref); + TRACE("%p, %p.\n", iface, ref);
if (FAILED(IDWriteFontFaceReference_GetFontFile(ref, &file))) return FALSE;
- ret = is_same_fontfile(This->file, file) && - This->index == IDWriteFontFaceReference_GetFontFaceIndex(ref) && - This->simulations == IDWriteFontFaceReference_GetSimulations(ref); + ret = is_same_fontfile(reference->file, file) && + reference->index == IDWriteFontFaceReference_GetFontFaceIndex(ref) && + reference->simulations == IDWriteFontFaceReference_GetSimulations(ref); IDWriteFontFile_Release(file);
return ret; }
-static UINT32 WINAPI fontfacereference_GetFontFaceIndex(IDWriteFontFaceReference *iface) +static UINT32 WINAPI fontfacereference_GetFontFaceIndex(IDWriteFontFaceReference1 *iface) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); + struct dwrite_fontfacereference *reference = impl_from_IDWriteFontFaceReference1(iface);
- TRACE("(%p)\n", This); + TRACE("%p.\n", iface);
- return This->index; + return reference->index; }
-static DWRITE_FONT_SIMULATIONS WINAPI fontfacereference_GetSimulations(IDWriteFontFaceReference *iface) +static DWRITE_FONT_SIMULATIONS WINAPI fontfacereference_GetSimulations(IDWriteFontFaceReference1 *iface) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); + struct dwrite_fontfacereference *reference = impl_from_IDWriteFontFaceReference1(iface);
- TRACE("(%p)\n", This); + TRACE("%p.\n", iface);
- return This->simulations; + return reference->simulations; }
-static HRESULT WINAPI fontfacereference_GetFontFile(IDWriteFontFaceReference *iface, IDWriteFontFile **file) +static HRESULT WINAPI fontfacereference_GetFontFile(IDWriteFontFaceReference1 *iface, IDWriteFontFile **file) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); + struct dwrite_fontfacereference *reference = impl_from_IDWriteFontFaceReference1(iface); IDWriteFontFileLoader *loader; const void *key; UINT32 key_size; HRESULT hr;
- TRACE("(%p)->(%p)\n", This, file); + TRACE("%p, %p.\n", iface, file);
- hr = IDWriteFontFile_GetReferenceKey(This->file, &key, &key_size); + hr = IDWriteFontFile_GetReferenceKey(reference->file, &key, &key_size); if (FAILED(hr)) return hr;
- hr = IDWriteFontFile_GetLoader(This->file, &loader); + hr = IDWriteFontFile_GetLoader(reference->file, &loader); if (FAILED(hr)) return hr;
- hr = IDWriteFactory5_CreateCustomFontFileReference(This->factory, key, key_size, loader, file); + hr = IDWriteFactory5_CreateCustomFontFileReference(reference->factory, key, key_size, loader, file); IDWriteFontFileLoader_Release(loader);
return hr; }
-static UINT64 WINAPI fontfacereference_GetLocalFileSize(IDWriteFontFaceReference *iface) +static UINT64 WINAPI fontfacereference_GetLocalFileSize(IDWriteFontFaceReference1 *iface) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); - - FIXME("(%p): stub\n", This); + FIXME("%p.\n", iface);
return 0; }
-static UINT64 WINAPI fontfacereference_GetFileSize(IDWriteFontFaceReference *iface) +static UINT64 WINAPI fontfacereference_GetFileSize(IDWriteFontFaceReference1 *iface) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); - - FIXME("(%p): stub\n", This); + FIXME("%p.\n", iface);
return 0; }
-static HRESULT WINAPI fontfacereference_GetFileTime(IDWriteFontFaceReference *iface, FILETIME *writetime) +static HRESULT WINAPI fontfacereference_GetFileTime(IDWriteFontFaceReference1 *iface, FILETIME *writetime) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); - - FIXME("(%p)->(%p): stub\n", This, writetime); + FIXME("%p, %p.\n", iface, writetime);
return E_NOTIMPL; }
-static DWRITE_LOCALITY WINAPI fontfacereference_GetLocality(IDWriteFontFaceReference *iface) +static DWRITE_LOCALITY WINAPI fontfacereference_GetLocality(IDWriteFontFaceReference1 *iface) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); - - FIXME("(%p): stub\n", This); + FIXME("%p.\n", iface);
return DWRITE_LOCALITY_LOCAL; }
-static HRESULT WINAPI fontfacereference_EnqueueFontDownloadRequest(IDWriteFontFaceReference *iface) +static HRESULT WINAPI fontfacereference_EnqueueFontDownloadRequest(IDWriteFontFaceReference1 *iface) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); - - FIXME("(%p): stub\n", This); + FIXME("%p.\n", iface);
return E_NOTIMPL; }
-static HRESULT WINAPI fontfacereference_EnqueueCharacterDownloadRequest(IDWriteFontFaceReference *iface, WCHAR const *chars, - UINT32 count) +static HRESULT WINAPI fontfacereference_EnqueueCharacterDownloadRequest(IDWriteFontFaceReference1 *iface, + WCHAR const *chars, UINT32 count) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); + FIXME("%p, %s, %u.\n", iface, debugstr_wn(chars, count), count);
- FIXME("(%p)->(%s:%u): stub\n", This, debugstr_wn(chars, count), count); + return E_NOTIMPL; +} + +static HRESULT WINAPI fontfacereference_EnqueueGlyphDownloadRequest(IDWriteFontFaceReference1 *iface, + UINT16 const *glyphs, UINT32 count) +{ + FIXME("%p, %p, %u.\n", iface, glyphs, count);
return E_NOTIMPL; }
-static HRESULT WINAPI fontfacereference_EnqueueGlyphDownloadRequest(IDWriteFontFaceReference *iface, UINT16 const *glyphs, - UINT32 count) +static HRESULT WINAPI fontfacereference_EnqueueFileFragmentDownloadRequest(IDWriteFontFaceReference1 *iface, + UINT64 offset, UINT64 size) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); + FIXME("%p, 0x%s, 0x%s.\n", iface, wine_dbgstr_longlong(offset), wine_dbgstr_longlong(size));
- FIXME("(%p)->(%p %u): stub\n", This, glyphs, count); + return E_NOTIMPL; +} + +static HRESULT WINAPI fontfacereference1_CreateFontFace(IDWriteFontFaceReference1 *iface, IDWriteFontFace5 **fontface) +{ + FIXME("%p, %p.\n", iface, fontface);
return E_NOTIMPL; }
-static HRESULT WINAPI fontfacereference_EnqueueFileFragmentDownloadRequest(IDWriteFontFaceReference *iface, - UINT64 offset, UINT64 size) +static UINT32 WINAPI fontfacereference1_GetFontAxisValueCount(IDWriteFontFaceReference1 *iface) { - struct dwrite_fontfacereference *This = impl_from_IDWriteFontFaceReference(iface); + FIXME("%p.\n", iface);
- FIXME("(%p)->(0x%s 0x%s): stub\n", This, wine_dbgstr_longlong(offset), wine_dbgstr_longlong(size)); + return 0; +} + +static HRESULT WINAPI fontfacereference1_GetFontAxisValues(IDWriteFontFaceReference1 *iface, + DWRITE_FONT_AXIS_VALUE *axis_values, UINT32 value_count) +{ + FIXME("%p, %p, %u.\n", iface, axis_values, value_count);
return E_NOTIMPL; }
-static const IDWriteFontFaceReferenceVtbl fontfacereferencevtbl = { +static const IDWriteFontFaceReference1Vtbl fontfacereferencevtbl = +{ fontfacereference_QueryInterface, fontfacereference_AddRef, fontfacereference_Release, @@ -6121,33 +6135,37 @@ static const IDWriteFontFaceReferenceVtbl fontfacereferencevtbl = { fontfacereference_EnqueueFontDownloadRequest, fontfacereference_EnqueueCharacterDownloadRequest, fontfacereference_EnqueueGlyphDownloadRequest, - fontfacereference_EnqueueFileFragmentDownloadRequest + fontfacereference_EnqueueFileFragmentDownloadRequest, + fontfacereference1_CreateFontFace, + fontfacereference1_GetFontAxisValueCount, + fontfacereference1_GetFontAxisValues, };
HRESULT create_fontfacereference(IDWriteFactory5 *factory, IDWriteFontFile *file, UINT32 index, DWRITE_FONT_SIMULATIONS simulations, IDWriteFontFaceReference **ret) { - struct dwrite_fontfacereference *ref; + struct dwrite_fontfacereference *object;
*ret = NULL;
if (!is_simulation_valid(simulations)) return E_INVALIDARG;
- ref = heap_alloc(sizeof(*ref)); - if (!ref) + object = heap_alloc(sizeof(*object)); + if (!object) return E_OUTOFMEMORY;
- ref->IDWriteFontFaceReference_iface.lpVtbl = &fontfacereferencevtbl; - ref->ref = 1; + object->IDWriteFontFaceReference1_iface.lpVtbl = &fontfacereferencevtbl; + object->refcount = 1; + + object->factory = factory; + IDWriteFactory5_AddRef(object->factory); + object->file = file; + IDWriteFontFile_AddRef(object->file); + object->index = index; + object->simulations = simulations;
- ref->factory = factory; - IDWriteFactory5_AddRef(ref->factory); - ref->file = file; - IDWriteFontFile_AddRef(ref->file); - ref->index = index; - ref->simulations = simulations; - *ret = &ref->IDWriteFontFaceReference_iface; + *ret = (IDWriteFontFaceReference *)&object->IDWriteFontFaceReference1_iface;
return S_OK; }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/analyzer.c | 127 ++++++++++++++++++++++------------- dlls/dwrite/dwrite_private.h | 4 +- dlls/dwrite/main.c | 16 +++-- dlls/dwrite/tests/layout.c | 16 +++++ 4 files changed, 107 insertions(+), 56 deletions(-)
diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c index 7fc955eaf8..8db5cc709b 100644 --- a/dlls/dwrite/analyzer.c +++ b/dlls/dwrite/analyzer.c @@ -234,9 +234,10 @@ static const struct fallback_mapping fontfallback_neutral_data[] = { #undef MAPPING_RANGE };
-struct dwrite_fontfallback { - IDWriteFontFallback IDWriteFontFallback_iface; - LONG ref; +struct dwrite_fontfallback +{ + IDWriteFontFallback1 IDWriteFontFallback1_iface; + LONG refcount; IDWriteFactory5 *factory; IDWriteFontCollection1 *systemcollection; struct fallback_mapping *mappings; @@ -269,9 +270,9 @@ static inline struct dwrite_numbersubstitution *impl_from_IDWriteNumberSubstitut
static struct dwrite_numbersubstitution *unsafe_impl_from_IDWriteNumberSubstitution(IDWriteNumberSubstitution *iface);
-static inline struct dwrite_fontfallback *impl_from_IDWriteFontFallback(IDWriteFontFallback *iface) +static inline struct dwrite_fontfallback *impl_from_IDWriteFontFallback1(IDWriteFontFallback1 *iface) { - return CONTAINING_RECORD(iface, struct dwrite_fontfallback, IDWriteFontFallback_iface); + return CONTAINING_RECORD(iface, struct dwrite_fontfallback, IDWriteFontFallback1_iface); }
static inline struct dwrite_fontfallback_builder *impl_from_IDWriteFontFallbackBuilder(IDWriteFontFallbackBuilder *iface) @@ -1930,15 +1931,16 @@ HRESULT create_numbersubstitution(DWRITE_NUMBER_SUBSTITUTION_METHOD method, cons }
/* IDWriteFontFallback */ -static HRESULT WINAPI fontfallback_QueryInterface(IDWriteFontFallback *iface, REFIID riid, void **obj) +static HRESULT WINAPI fontfallback_QueryInterface(IDWriteFontFallback1 *iface, REFIID riid, void **obj) { - struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback(iface); - - TRACE("(%p)->(%s %p)\n", fallback, debugstr_guid(riid), obj); + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
- if (IsEqualIID(riid, &IID_IDWriteFontFallback) || IsEqualIID(riid, &IID_IUnknown)) { + if (IsEqualIID(riid, &IID_IDWriteFontFallback1) || + IsEqualIID(riid, &IID_IDWriteFontFallback) || + IsEqualIID(riid, &IID_IUnknown)) + { *obj = iface; - IDWriteFontFallback_AddRef(iface); + IDWriteFontFallback1_AddRef(iface); return S_OK; }
@@ -1948,17 +1950,21 @@ static HRESULT WINAPI fontfallback_QueryInterface(IDWriteFontFallback *iface, RE return E_NOINTERFACE; }
-static ULONG WINAPI fontfallback_AddRef(IDWriteFontFallback *iface) +static ULONG WINAPI fontfallback_AddRef(IDWriteFontFallback1 *iface) { - struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback(iface); - TRACE("(%p)\n", fallback); + struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback1(iface); + + TRACE("%p.\n", iface); + return IDWriteFactory5_AddRef(fallback->factory); }
-static ULONG WINAPI fontfallback_Release(IDWriteFontFallback *iface) +static ULONG WINAPI fontfallback_Release(IDWriteFontFallback1 *iface) { - struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback(iface); - TRACE("(%p)\n", fallback); + struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback1(iface); + + TRACE("%p.\n", fallback); + return IDWriteFactory5_Release(fallback->factory); }
@@ -2085,18 +2091,18 @@ static HRESULT fallback_get_fallback_font(struct dwrite_fontfallback *fallback, return *mapped_length ? S_OK : E_FAIL; }
-static HRESULT WINAPI fontfallback_MapCharacters(IDWriteFontFallback *iface, IDWriteTextAnalysisSource *source, +static HRESULT WINAPI fontfallback_MapCharacters(IDWriteFontFallback1 *iface, IDWriteTextAnalysisSource *source, UINT32 position, UINT32 length, IDWriteFontCollection *basecollection, const WCHAR *basefamily, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STYLE style, DWRITE_FONT_STRETCH stretch, UINT32 *mapped_length, IDWriteFont **ret_font, FLOAT *scale) { - struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback(iface); + struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback1(iface); WCHAR *buff = NULL; const WCHAR *text; HRESULT hr;
- TRACE("(%p)->(%p %u %u %p, %s, %u, %u, %u, %p, %p, %p)\n", fallback, source, position, length, - basecollection, debugstr_w(basefamily), weight, style, stretch, mapped_length, ret_font, scale); + TRACE("%p, %p, %u, %u, %p, %s, %u, %u, %u, %p, %p, %p.\n", iface, source, position, length, basecollection, + debugstr_w(basefamily), weight, style, stretch, mapped_length, ret_font, scale);
*mapped_length = 0; *scale = 1.0f; @@ -2148,14 +2154,27 @@ done: return hr; }
-static const IDWriteFontFallbackVtbl fontfallbackvtbl = { +static HRESULT WINAPI fontfallback1_MapCharacters(IDWriteFontFallback1 *iface, IDWriteTextAnalysisSource *source, + UINT32 position, UINT32 length, IDWriteFontCollection *basecollection, const WCHAR *basefamily, + DWRITE_FONT_AXIS_VALUE const *axis_values, UINT32 values_count, UINT32 *mapped_length, FLOAT *scale, + IDWriteFontFace5 **ret_fontface) +{ + FIXME("%p, %p, %u, %u, %p, %s, %p, %u, %p, %p, %p.\n", iface, source, position, length, basecollection, + debugstr_w(basefamily), axis_values, values_count, mapped_length, scale, ret_fontface); + + return E_NOTIMPL; +} + +static const IDWriteFontFallback1Vtbl fontfallbackvtbl = +{ fontfallback_QueryInterface, fontfallback_AddRef, fontfallback_Release, - fontfallback_MapCharacters + fontfallback_MapCharacters, + fontfallback1_MapCharacters, };
-HRESULT create_system_fontfallback(IDWriteFactory5 *factory, IDWriteFontFallback **ret) +HRESULT create_system_fontfallback(IDWriteFactory5 *factory, IDWriteFontFallback1 **ret) { struct dwrite_fontfallback *fallback;
@@ -2165,65 +2184,79 @@ HRESULT create_system_fontfallback(IDWriteFactory5 *factory, IDWriteFontFallback if (!fallback) return E_OUTOFMEMORY;
- fallback->IDWriteFontFallback_iface.lpVtbl = &fontfallbackvtbl; + fallback->IDWriteFontFallback1_iface.lpVtbl = &fontfallbackvtbl; fallback->factory = factory; fallback->mappings = (struct fallback_mapping *)fontfallback_neutral_data; fallback->mappings_count = ARRAY_SIZE(fontfallback_neutral_data); IDWriteFactory5_GetSystemFontCollection(fallback->factory, FALSE, &fallback->systemcollection, FALSE);
- *ret = &fallback->IDWriteFontFallback_iface; + *ret = &fallback->IDWriteFontFallback1_iface; + return S_OK; }
-void release_system_fontfallback(IDWriteFontFallback *iface) +void release_system_fontfallback(IDWriteFontFallback1 *iface) { - struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback(iface); + struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback1(iface); IDWriteFontCollection1_Release(fallback->systemcollection); heap_free(fallback); }
-static ULONG WINAPI customfontfallback_AddRef(IDWriteFontFallback *iface) +static ULONG WINAPI customfontfallback_AddRef(IDWriteFontFallback1 *iface) { - struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback(iface); - ULONG ref = InterlockedIncrement(&fallback->ref); - TRACE("(%p)->(%d)\n", fallback, ref); - return ref; + struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback1(iface); + ULONG refcount = InterlockedIncrement(&fallback->refcount); + + TRACE("%p, refcount %u.\n", iface, refcount); + + return refcount; }
-static ULONG WINAPI customfontfallback_Release(IDWriteFontFallback *iface) +static ULONG WINAPI customfontfallback_Release(IDWriteFontFallback1 *iface) { - struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback(iface); - ULONG ref = InterlockedDecrement(&fallback->ref); + struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback1(iface); + ULONG refcount = InterlockedDecrement(&fallback->refcount);
- TRACE("(%p)->(%d)\n", fallback, ref); + TRACE("%p, refcount %u.\n", iface, refcount);
- if (!ref) { + if (!refcount) + { IDWriteFactory5_Release(fallback->factory); heap_free(fallback); }
- return ref; + return refcount; }
-static HRESULT WINAPI customfontfallback_MapCharacters(IDWriteFontFallback *iface, IDWriteTextAnalysisSource *source, +static HRESULT WINAPI customfontfallback_MapCharacters(IDWriteFontFallback1 *iface, IDWriteTextAnalysisSource *source, UINT32 position, UINT32 length, IDWriteFontCollection *basecollection, const WCHAR *basefamily, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STYLE style, DWRITE_FONT_STRETCH stretch, UINT32 *mapped_length, IDWriteFont **ret_font, FLOAT *scale) { - struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback(iface); - - FIXME("(%p)->(%p %u %u %p, %s, %u, %u, %u, %p, %p, %p)\n", fallback, source, position, length, + FIXME("%p, %p, %u, %u, %p, %s, %u, %u, %u, %p, %p, %p.\n", iface, source, position, length, basecollection, debugstr_w(basefamily), weight, style, stretch, mapped_length, ret_font, scale);
return E_NOTIMPL; }
-static const IDWriteFontFallbackVtbl customfontfallbackvtbl = +static HRESULT WINAPI customfontfallback1_MapCharacters(IDWriteFontFallback1 *iface, IDWriteTextAnalysisSource *source, + UINT32 position, UINT32 length, IDWriteFontCollection *basecollection, const WCHAR *basefamily, + DWRITE_FONT_AXIS_VALUE const *axis_values, UINT32 values_count, UINT32 *mapped_length, FLOAT *scale, + IDWriteFontFace5 **ret_fontface) +{ + FIXME("%p, %p, %u, %u, %p, %s, %p, %u, %p, %p, %p.\n", iface, source, position, length, basecollection, + debugstr_w(basefamily), axis_values, values_count, mapped_length, scale, ret_fontface); + + return E_NOTIMPL; +} + +static const IDWriteFontFallback1Vtbl customfontfallbackvtbl = { fontfallback_QueryInterface, customfontfallback_AddRef, customfontfallback_Release, customfontfallback_MapCharacters, + customfontfallback1_MapCharacters, };
static HRESULT WINAPI fontfallbackbuilder_QueryInterface(IDWriteFontFallbackBuilder *iface, REFIID riid, void **obj) @@ -2347,12 +2380,12 @@ static HRESULT WINAPI fontfallbackbuilder_CreateFontFallback(IDWriteFontFallback if (!fallback) return E_OUTOFMEMORY;
- fallback->IDWriteFontFallback_iface.lpVtbl = &customfontfallbackvtbl; - fallback->ref = 1; + fallback->IDWriteFontFallback1_iface.lpVtbl = &customfontfallbackvtbl; + fallback->refcount = 1; fallback->factory = fallbackbuilder->factory; IDWriteFactory5_AddRef(fallback->factory);
- *ret = &fallback->IDWriteFontFallback_iface; + *ret = (IDWriteFontFallback *)&fallback->IDWriteFontFallback1_iface; return S_OK; }
diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 406664a590..d3d74e0709 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -256,8 +256,8 @@ extern HRESULT get_family_names_from_stream(IDWriteFontFileStream*,UINT32,DWRITE extern HRESULT create_colorglyphenum(FLOAT,FLOAT,const DWRITE_GLYPH_RUN*,const DWRITE_GLYPH_RUN_DESCRIPTION*,DWRITE_MEASURING_MODE, const DWRITE_MATRIX*,UINT32,IDWriteColorGlyphRunEnumerator**) DECLSPEC_HIDDEN; extern BOOL lb_is_newline_char(WCHAR) DECLSPEC_HIDDEN; -extern HRESULT create_system_fontfallback(IDWriteFactory5*,IDWriteFontFallback**) DECLSPEC_HIDDEN; -extern void release_system_fontfallback(IDWriteFontFallback*) DECLSPEC_HIDDEN; +extern HRESULT create_system_fontfallback(IDWriteFactory5 *factory, IDWriteFontFallback1 **fallback) DECLSPEC_HIDDEN; +extern void release_system_fontfallback(IDWriteFontFallback1 *fallback) DECLSPEC_HIDDEN; extern HRESULT create_fontfallback_builder(IDWriteFactory5*,IDWriteFontFallbackBuilder**) DECLSPEC_HIDDEN; extern HRESULT create_matching_font(IDWriteFontCollection*,const WCHAR*,DWRITE_FONT_WEIGHT,DWRITE_FONT_STYLE,DWRITE_FONT_STRETCH, IDWriteFont**) DECLSPEC_HIDDEN; diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index ccf4cb51b9..fb3ed090e6 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -547,14 +547,15 @@ struct fileloader IDWriteFontFileLoader *loader; };
-struct dwritefactory { +struct dwritefactory +{ IDWriteFactory5 IDWriteFactory5_iface; LONG ref;
IDWriteFontCollection1 *system_collection; IDWriteFontCollection1 *eudc_collection; IDWriteGdiInterop1 *gdiinterop; - IDWriteFontFallback *fallback; + IDWriteFontFallback1 *fallback;
IDWriteFontFileLoader *localfontfileloader; struct list localfontfaces; @@ -1333,19 +1334,20 @@ static HRESULT WINAPI dwritefactory1_CreateCustomRenderingParams(IDWriteFactory5
static HRESULT WINAPI dwritefactory2_GetSystemFontFallback(IDWriteFactory5 *iface, IDWriteFontFallback **fallback) { - struct dwritefactory *This = impl_from_IDWriteFactory5(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory5(iface);
- TRACE("(%p)->(%p)\n", This, fallback); + TRACE("%p, %p.\n", iface, fallback);
*fallback = NULL;
- if (!This->fallback) { - HRESULT hr = create_system_fontfallback(iface, &This->fallback); + if (!factory->fallback) + { + HRESULT hr = create_system_fontfallback(iface, &factory->fallback); if (FAILED(hr)) return hr; }
- *fallback = This->fallback; + *fallback = (IDWriteFontFallback *)factory->fallback; IDWriteFontFallback_AddRef(*fallback); return S_OK; } diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index b153bcbb69..b96c0f4b37 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -4704,6 +4704,7 @@ static void test_FontFallbackBuilder(void) static const WCHAR strW[] = {'A',0}; IDWriteFontFallback *fallback, *fallback2; IDWriteFontFallbackBuilder *builder; + IDWriteFontFallback1 *fallback1; DWRITE_UNICODE_RANGE range; IDWriteFactory2 *factory2; IDWriteFactory *factory; @@ -4891,6 +4892,13 @@ todo_wine { if (font) IDWriteFont_Release(font);
+ if (SUCCEEDED(IDWriteFontFallback_QueryInterface(fallback, &IID_IDWriteFontFallback1, (void **)&fallback1))) + { + IDWriteFontFallback1_Release(fallback1); + } + else + win_skip("IDWriteFontFallback1 is not supported.\n"); + IDWriteFontFallback_Release(fallback);
IDWriteFontFallbackBuilder_Release(builder); @@ -4902,6 +4910,7 @@ static void test_fallback(void) { static const WCHAR strW[] = {'a','b','c','d',0}; IDWriteFontFallback *fallback, *fallback2; + IDWriteFontFallback1 *fallback1; DWRITE_CLUSTER_METRICS clusters[4]; DWRITE_TEXT_METRICS metrics; IDWriteTextLayout2 *layout2; @@ -5002,6 +5011,13 @@ todo_wine { ok(hr == S_OK, "got 0x%08x\n", hr); ok(fallback2 == NULL, "got %p\n", fallback2);
+ if (SUCCEEDED(IDWriteFontFallback_QueryInterface(fallback, &IID_IDWriteFontFallback1, (void **)&fallback1))) + { + IDWriteFontFallback1_Release(fallback1); + } + else + win_skip("IDWriteFontFallback1 is not supported.\n"); + IDWriteFontFallback_Release(fallback); IDWriteTextFormat1_Release(format1); IDWriteTextLayout2_Release(layout2);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=57680
Your paranoid android.
=== wvistau64 (task log) ===
Task errors: The task timed out
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/font.c | 131 +++++++++++++++++++++------------------ dlls/dwrite/tests/font.c | 8 +++ 2 files changed, 79 insertions(+), 60 deletions(-)
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index f83c14381f..6432acb231 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -135,9 +135,10 @@ struct dwrite_fontfamily struct dwrite_fontcollection *collection; };
-struct dwrite_fontlist { - IDWriteFontList1 IDWriteFontList1_iface; - LONG ref; +struct dwrite_fontlist +{ + IDWriteFontList2 IDWriteFontList2_iface; + LONG refcount;
struct dwrite_font_data **fonts; UINT32 font_count; @@ -313,9 +314,9 @@ static inline struct dwrite_colorglyphenum *impl_from_IDWriteColorGlyphRunEnumer return CONTAINING_RECORD(iface, struct dwrite_colorglyphenum, IDWriteColorGlyphRunEnumerator_iface); }
-static inline struct dwrite_fontlist *impl_from_IDWriteFontList1(IDWriteFontList1 *iface) +static inline struct dwrite_fontlist *impl_from_IDWriteFontList2(IDWriteFontList2 *iface) { - return CONTAINING_RECORD(iface, struct dwrite_fontlist, IDWriteFontList1_iface); + return CONTAINING_RECORD(iface, struct dwrite_fontlist, IDWriteFontList2_iface); }
static inline struct dwrite_fontfacereference *impl_from_IDWriteFontFaceReference1(IDWriteFontFaceReference1 *iface) @@ -1842,19 +1843,18 @@ static HRESULT create_font(struct dwrite_fontfamily *family, UINT32 index, IDWri return S_OK; }
-/* IDWriteFontList1 */ -static HRESULT WINAPI dwritefontlist_QueryInterface(IDWriteFontList1 *iface, REFIID riid, void **obj) +/* IDWriteFontList2 */ +static HRESULT WINAPI dwritefontlist_QueryInterface(IDWriteFontList2 *iface, REFIID riid, void **obj) { - struct dwrite_fontlist *This = impl_from_IDWriteFontList1(iface); - - TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
- if (IsEqualIID(riid, &IID_IDWriteFontList1) || + if (IsEqualIID(riid, &IID_IDWriteFontList2) || + IsEqualIID(riid, &IID_IDWriteFontList1) || IsEqualIID(riid, &IID_IDWriteFontList) || IsEqualIID(riid, &IID_IUnknown)) { *obj = iface; - IDWriteFontList1_AddRef(iface); + IDWriteFontList2_AddRef(iface); return S_OK; }
@@ -1864,102 +1864,104 @@ static HRESULT WINAPI dwritefontlist_QueryInterface(IDWriteFontList1 *iface, REF return E_NOINTERFACE; }
-static ULONG WINAPI dwritefontlist_AddRef(IDWriteFontList1 *iface) +static ULONG WINAPI dwritefontlist_AddRef(IDWriteFontList2 *iface) { - struct dwrite_fontlist *This = impl_from_IDWriteFontList1(iface); - ULONG ref = InterlockedIncrement(&This->ref); - TRACE("(%p)->(%d)\n", This, ref); - return ref; + struct dwrite_fontlist *fontlist = impl_from_IDWriteFontList2(iface); + ULONG refcount = InterlockedIncrement(&fontlist->refcount); + + TRACE("%p, refcount %u.\n", iface, refcount); + + return refcount; }
-static ULONG WINAPI dwritefontlist_Release(IDWriteFontList1 *iface) +static ULONG WINAPI dwritefontlist_Release(IDWriteFontList2 *iface) { - struct dwrite_fontlist *This = impl_from_IDWriteFontList1(iface); - ULONG ref = InterlockedDecrement(&This->ref); + struct dwrite_fontlist *fontlist = impl_from_IDWriteFontList2(iface); + ULONG refcount = InterlockedDecrement(&fontlist->refcount);
- TRACE("(%p)->(%d)\n", This, ref); + TRACE("%p, refcount %u.\n", iface, refcount);
- if (!ref) { + if (!refcount) + { UINT32 i;
- for (i = 0; i < This->font_count; i++) - release_font_data(This->fonts[i]); - IDWriteFontFamily2_Release(&This->family->IDWriteFontFamily2_iface); - heap_free(This->fonts); - heap_free(This); + for (i = 0; i < fontlist->font_count; i++) + release_font_data(fontlist->fonts[i]); + IDWriteFontFamily2_Release(&fontlist->family->IDWriteFontFamily2_iface); + heap_free(fontlist->fonts); + heap_free(fontlist); }
- return ref; + return refcount; }
-static HRESULT WINAPI dwritefontlist_GetFontCollection(IDWriteFontList1 *iface, IDWriteFontCollection **collection) +static HRESULT WINAPI dwritefontlist_GetFontCollection(IDWriteFontList2 *iface, IDWriteFontCollection **collection) { - struct dwrite_fontlist *This = impl_from_IDWriteFontList1(iface); - return IDWriteFontFamily2_GetFontCollection(&This->family->IDWriteFontFamily2_iface, collection); + struct dwrite_fontlist *fontlist = impl_from_IDWriteFontList2(iface); + return IDWriteFontFamily2_GetFontCollection(&fontlist->family->IDWriteFontFamily2_iface, collection); }
-static UINT32 WINAPI dwritefontlist_GetFontCount(IDWriteFontList1 *iface) +static UINT32 WINAPI dwritefontlist_GetFontCount(IDWriteFontList2 *iface) { - struct dwrite_fontlist *This = impl_from_IDWriteFontList1(iface); - TRACE("(%p)\n", This); - return This->font_count; + struct dwrite_fontlist *fontlist = impl_from_IDWriteFontList2(iface); + + TRACE("%p.\n", iface); + + return fontlist->font_count; }
-static HRESULT WINAPI dwritefontlist_GetFont(IDWriteFontList1 *iface, UINT32 index, IDWriteFont **font) +static HRESULT WINAPI dwritefontlist_GetFont(IDWriteFontList2 *iface, UINT32 index, IDWriteFont **font) { - struct dwrite_fontlist *This = impl_from_IDWriteFontList1(iface); + struct dwrite_fontlist *fontlist = impl_from_IDWriteFontList2(iface);
- TRACE("(%p)->(%u %p)\n", This, index, font); + TRACE("%p, %u, %p.\n", iface, index, font);
*font = NULL;
- if (This->font_count == 0) + if (fontlist->font_count == 0) return S_FALSE;
- if (index >= This->font_count) + if (index >= fontlist->font_count) return E_INVALIDARG;
- return create_font(This->family, index, (IDWriteFont3 **)font); + return create_font(fontlist->family, index, (IDWriteFont3 **)font); }
-static DWRITE_LOCALITY WINAPI dwritefontlist1_GetFontLocality(IDWriteFontList1 *iface, UINT32 index) +static DWRITE_LOCALITY WINAPI dwritefontlist1_GetFontLocality(IDWriteFontList2 *iface, UINT32 index) { - struct dwrite_fontlist *This = impl_from_IDWriteFontList1(iface); - - FIXME("(%p)->(%u): stub\n", This, index); + FIXME("%p, %u.\n", iface, index);
return DWRITE_LOCALITY_LOCAL; }
-static HRESULT WINAPI dwritefontlist1_GetFont(IDWriteFontList1 *iface, UINT32 index, IDWriteFont3 **font) +static HRESULT WINAPI dwritefontlist1_GetFont(IDWriteFontList2 *iface, UINT32 index, IDWriteFont3 **font) { - struct dwrite_fontlist *This = impl_from_IDWriteFontList1(iface); + struct dwrite_fontlist *fontlist = impl_from_IDWriteFontList2(iface);
- TRACE("(%p)->(%u %p)\n", This, index, font); + TRACE("%p, %u, %p.\n", iface, index, font);
*font = NULL;
- if (This->font_count == 0) + if (fontlist->font_count == 0) return S_FALSE;
- if (index >= This->font_count) + if (index >= fontlist->font_count) return E_FAIL;
- return create_font(This->family, index, font); + return create_font(fontlist->family, index, font); }
-static HRESULT WINAPI dwritefontlist1_GetFontFaceReference(IDWriteFontList1 *iface, UINT32 index, +static HRESULT WINAPI dwritefontlist1_GetFontFaceReference(IDWriteFontList2 *iface, UINT32 index, IDWriteFontFaceReference **reference) { - struct dwrite_fontlist *This = impl_from_IDWriteFontList1(iface); IDWriteFont3 *font; HRESULT hr;
- TRACE("(%p)->(%u %p)\n", This, index, reference); + TRACE("%p, %u, %p.\n", iface, index, reference);
*reference = NULL;
- hr = IDWriteFontList1_GetFont(iface, index, &font); + hr = IDWriteFontList2_GetFont(iface, index, &font); if (FAILED(hr)) return hr;
@@ -1969,7 +1971,15 @@ static HRESULT WINAPI dwritefontlist1_GetFontFaceReference(IDWriteFontList1 *ifa return hr; }
-static const IDWriteFontList1Vtbl dwritefontlistvtbl = { +static HRESULT WINAPI dwritefontlist2_GetFontSet(IDWriteFontList2 *iface, IDWriteFontSet1 **fontset) +{ + FIXME("%p, %p.\n", iface, fontset); + + return E_NOTIMPL; +} + +static const IDWriteFontList2Vtbl dwritefontlistvtbl = +{ dwritefontlist_QueryInterface, dwritefontlist_AddRef, dwritefontlist_Release, @@ -1978,7 +1988,8 @@ static const IDWriteFontList1Vtbl dwritefontlistvtbl = { dwritefontlist_GetFont, dwritefontlist1_GetFontLocality, dwritefontlist1_GetFont, - dwritefontlist1_GetFontFaceReference + dwritefontlist1_GetFontFaceReference, + dwritefontlist2_GetFontSet, };
static HRESULT WINAPI dwritefontfamily_QueryInterface(IDWriteFontFamily2 *iface, REFIID riid, void **obj) @@ -2207,8 +2218,8 @@ static HRESULT WINAPI dwritefontfamily_GetMatchingFonts(IDWriteFontFamily2 *ifac return E_OUTOFMEMORY; }
- fonts->IDWriteFontList1_iface.lpVtbl = &dwritefontlistvtbl; - fonts->ref = 1; + fonts->IDWriteFontList2_iface.lpVtbl = &dwritefontlistvtbl; + fonts->refcount = 1; fonts->family = family; IDWriteFontFamily2_AddRef(&fonts->family->IDWriteFontFamily2_iface); fonts->font_count = 0; @@ -2237,7 +2248,7 @@ static HRESULT WINAPI dwritefontfamily_GetMatchingFonts(IDWriteFontFamily2 *ifac init_font_prop_vec(weight, stretch, style, &req); matchingfonts_sort(fonts, &req);
- *ret = (IDWriteFontList *)&fonts->IDWriteFontList1_iface; + *ret = (IDWriteFontList *)&fonts->IDWriteFontList2_iface; return S_OK; }
diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 2fdf93106b..8b44c43e86 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -3897,6 +3897,7 @@ static void test_GetMatchingFonts(void) IDWriteFactory *factory; IDWriteFontList *fontlist, *fontlist2; IDWriteFontList1 *fontlist1; + IDWriteFontList2 *fontlist3; HRESULT hr; ULONG ref;
@@ -3971,6 +3972,13 @@ static void test_GetMatchingFonts(void) else win_skip("IDWriteFontList1 is not supported.\n");
+ if (SUCCEEDED(IDWriteFontList_QueryInterface(fontlist, &IID_IDWriteFontList2, (void **)&fontlist3))) + { + IDWriteFontList2_Release(fontlist3); + } + else + win_skip("IDWriteFontList2 is not supported.\n"); + IDWriteFontList_Release(fontlist); IDWriteFontFamily_Release(family);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/font.c | 95 ++++++++++++++++++++++------------------ dlls/dwrite/tests/font.c | 10 +++++ 2 files changed, 62 insertions(+), 43 deletions(-)
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 6432acb231..d9b22b15b4 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -128,7 +128,7 @@ struct dwrite_fontcollection struct dwrite_fontfamily { IDWriteFontFamily2 IDWriteFontFamily2_iface; - IDWriteFontList1 IDWriteFontList1_iface; + IDWriteFontList2 IDWriteFontList2_iface; LONG refcount;
struct dwrite_fontfamily_data *data; @@ -294,9 +294,9 @@ static inline struct dwrite_fontfamily *impl_from_IDWriteFontFamily2(IDWriteFont return CONTAINING_RECORD(iface, struct dwrite_fontfamily, IDWriteFontFamily2_iface); }
-static inline struct dwrite_fontfamily *impl_family_from_IDWriteFontList1(IDWriteFontList1 *iface) +static inline struct dwrite_fontfamily *impl_family_from_IDWriteFontList2(IDWriteFontList2 *iface) { - return CONTAINING_RECORD(iface, struct dwrite_fontfamily, IDWriteFontList1_iface); + return CONTAINING_RECORD(iface, struct dwrite_fontfamily, IDWriteFontList2_iface); }
static inline struct dwrite_fontcollection *impl_from_IDWriteFontCollection3(IDWriteFontCollection3 *iface) @@ -2004,22 +2004,22 @@ static HRESULT WINAPI dwritefontfamily_QueryInterface(IDWriteFontFamily2 *iface, IsEqualIID(riid, &IID_IUnknown)) { *obj = iface; - IDWriteFontFamily2_AddRef(iface); - return S_OK; } - - if (IsEqualIID(riid, &IID_IDWriteFontList1) || + else if (IsEqualIID(riid, &IID_IDWriteFontList2) || + IsEqualIID(riid, &IID_IDWriteFontList1) || IsEqualIID(riid, &IID_IDWriteFontList)) { - *obj = &family->IDWriteFontList1_iface; - IDWriteFontList1_AddRef(&family->IDWriteFontList1_iface); - return S_OK; + *obj = &family->IDWriteFontList2_iface; + } + else + { + WARN("%s not implemented.\n", debugstr_guid(riid)); + *obj = NULL; + return E_NOINTERFACE; }
- WARN("%s not implemented.\n", debugstr_guid(riid)); - - *obj = NULL; - return E_NOINTERFACE; + IUnknown_AddRef((IUnknown *)*obj); + return S_OK; }
static ULONG WINAPI dwritefontfamily_AddRef(IDWriteFontFamily2 *iface) @@ -2329,63 +2329,71 @@ static const IDWriteFontFamily2Vtbl fontfamilyvtbl = dwritefontfamily2_GetFontSet, };
-static HRESULT WINAPI dwritefontfamilylist_QueryInterface(IDWriteFontList1 *iface, REFIID riid, void **obj) +static HRESULT WINAPI dwritefontfamilylist_QueryInterface(IDWriteFontList2 *iface, REFIID riid, void **obj) { - struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily_QueryInterface(&This->IDWriteFontFamily2_iface, riid, obj); + struct dwrite_fontfamily *family = impl_family_from_IDWriteFontList2(iface); + return dwritefontfamily_QueryInterface(&family->IDWriteFontFamily2_iface, riid, obj); }
-static ULONG WINAPI dwritefontfamilylist_AddRef(IDWriteFontList1 *iface) +static ULONG WINAPI dwritefontfamilylist_AddRef(IDWriteFontList2 *iface) { - struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily_AddRef(&This->IDWriteFontFamily2_iface); + struct dwrite_fontfamily *family = impl_family_from_IDWriteFontList2(iface); + return dwritefontfamily_AddRef(&family->IDWriteFontFamily2_iface); }
-static ULONG WINAPI dwritefontfamilylist_Release(IDWriteFontList1 *iface) +static ULONG WINAPI dwritefontfamilylist_Release(IDWriteFontList2 *iface) { - struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily_Release(&This->IDWriteFontFamily2_iface); + struct dwrite_fontfamily *family = impl_family_from_IDWriteFontList2(iface); + return dwritefontfamily_Release(&family->IDWriteFontFamily2_iface); }
-static HRESULT WINAPI dwritefontfamilylist_GetFontCollection(IDWriteFontList1 *iface, +static HRESULT WINAPI dwritefontfamilylist_GetFontCollection(IDWriteFontList2 *iface, IDWriteFontCollection **collection) { - struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily_GetFontCollection(&This->IDWriteFontFamily2_iface, collection); + struct dwrite_fontfamily *family = impl_family_from_IDWriteFontList2(iface); + return dwritefontfamily_GetFontCollection(&family->IDWriteFontFamily2_iface, collection); }
-static UINT32 WINAPI dwritefontfamilylist_GetFontCount(IDWriteFontList1 *iface) +static UINT32 WINAPI dwritefontfamilylist_GetFontCount(IDWriteFontList2 *iface) { - struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily_GetFontCount(&This->IDWriteFontFamily2_iface); + struct dwrite_fontfamily *family = impl_family_from_IDWriteFontList2(iface); + return dwritefontfamily_GetFontCount(&family->IDWriteFontFamily2_iface); }
-static HRESULT WINAPI dwritefontfamilylist_GetFont(IDWriteFontList1 *iface, UINT32 index, IDWriteFont **font) +static HRESULT WINAPI dwritefontfamilylist_GetFont(IDWriteFontList2 *iface, UINT32 index, IDWriteFont **font) { - struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily_GetFont(&This->IDWriteFontFamily2_iface, index, font); + struct dwrite_fontfamily *family = impl_family_from_IDWriteFontList2(iface); + return dwritefontfamily_GetFont(&family->IDWriteFontFamily2_iface, index, font); }
-static DWRITE_LOCALITY WINAPI dwritefontfamilylist1_GetFontLocality(IDWriteFontList1 *iface, UINT32 index) +static DWRITE_LOCALITY WINAPI dwritefontfamilylist1_GetFontLocality(IDWriteFontList2 *iface, UINT32 index) { - struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily1_GetFontLocality(&This->IDWriteFontFamily2_iface, index); + struct dwrite_fontfamily *family = impl_family_from_IDWriteFontList2(iface); + return dwritefontfamily1_GetFontLocality(&family->IDWriteFontFamily2_iface, index); }
-static HRESULT WINAPI dwritefontfamilylist1_GetFont(IDWriteFontList1 *iface, UINT32 index, IDWriteFont3 **font) +static HRESULT WINAPI dwritefontfamilylist1_GetFont(IDWriteFontList2 *iface, UINT32 index, IDWriteFont3 **font) { - struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily1_GetFont(&This->IDWriteFontFamily2_iface, index, font); + struct dwrite_fontfamily *family = impl_family_from_IDWriteFontList2(iface); + return dwritefontfamily1_GetFont(&family->IDWriteFontFamily2_iface, index, font); }
-static HRESULT WINAPI dwritefontfamilylist1_GetFontFaceReference(IDWriteFontList1 *iface, UINT32 index, +static HRESULT WINAPI dwritefontfamilylist1_GetFontFaceReference(IDWriteFontList2 *iface, UINT32 index, IDWriteFontFaceReference **reference) { - struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily1_GetFontFaceReference(&This->IDWriteFontFamily2_iface, index, reference); + struct dwrite_fontfamily *family = impl_family_from_IDWriteFontList2(iface); + return dwritefontfamily1_GetFontFaceReference(&family->IDWriteFontFamily2_iface, index, reference); +} + +static HRESULT WINAPI dwritefontfamilylist2_GetFontSet(IDWriteFontList2 *iface, IDWriteFontSet1 **fontset) +{ + FIXME("%p, %p.\n", iface, fontset); + + return E_NOTIMPL; }
-static const IDWriteFontList1Vtbl fontfamilylistvtbl = { +static const IDWriteFontList2Vtbl fontfamilylistvtbl = +{ dwritefontfamilylist_QueryInterface, dwritefontfamilylist_AddRef, dwritefontfamilylist_Release, @@ -2395,6 +2403,7 @@ static const IDWriteFontList1Vtbl fontfamilylistvtbl = { dwritefontfamilylist1_GetFontLocality, dwritefontfamilylist1_GetFont, dwritefontfamilylist1_GetFontFaceReference, + dwritefontfamilylist2_GetFontSet, };
static HRESULT create_fontfamily(struct dwrite_fontcollection *collection, UINT32 index, @@ -2409,7 +2418,7 @@ static HRESULT create_fontfamily(struct dwrite_fontcollection *collection, UINT3 return E_OUTOFMEMORY;
object->IDWriteFontFamily2_iface.lpVtbl = &fontfamilyvtbl; - object->IDWriteFontList1_iface.lpVtbl = &fontfamilylistvtbl; + object->IDWriteFontList2_iface.lpVtbl = &fontfamilylistvtbl; object->refcount = 1; object->collection = collection; IDWriteFontCollection3_AddRef(&collection->IDWriteFontCollection3_iface); diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 8b44c43e86..32156fdedd 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -1601,6 +1601,7 @@ if (0) /* crashes on native */ if (hr == S_OK) { IDWriteFontFaceReference *ref, *ref1; IDWriteFontList1 *fontlist1; + IDWriteFontList2 *fontlist2; IDWriteFontList *fontlist; IDWriteFont3 *font3; IDWriteFont1 *font1; @@ -1629,6 +1630,15 @@ if (0) /* crashes on native */ ok(fontlist == (IDWriteFontList *)fontlist1, "Unexpected interface pointer.\n"); ok(fontlist != (IDWriteFontList *)family1, "Unexpected interface pointer.\n"); ok(fontlist != (IDWriteFontList *)family, "Unexpected interface pointer.\n"); + + if (SUCCEEDED(IDWriteFontFamily1_QueryInterface(family1, &IID_IDWriteFontList2, (void **)&fontlist2))) + { + ok(fontlist == (IDWriteFontList *)fontlist2, "Unexpected interface pointer.\n"); + IDWriteFontList2_Release(fontlist2); + } + else + win_skip("IDWriteFontList2 is not supported.\n"); + IDWriteFontList1_Release(fontlist1); IDWriteFontList_Release(fontlist); }