Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/tests/layout.c | 16 ---------------- 1 file changed, 16 deletions(-)
diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index 2c90e31a85..b153bcbb69 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -1702,14 +1702,6 @@ static const struct drawcall_entry draw_ltr_reordered_run_seq[] = { { DRAW_LAST_KIND } };
-static const struct drawcall_entry draw_rtl_reordered_run_seq[] = { - { DRAW_GLYPHRUN, {'1','2','3','-','5','2',0}, {'r','u',0}, 6, 2 }, - { DRAW_GLYPHRUN, {0x64a,0x64f,0x633,0x627,0x648,0x650,0x64a,0}, {'r','u',0}, 7, 1 }, - { DRAW_GLYPHRUN, {'7','1',0}, {'r','u',0}, 2, 2 }, - { DRAW_GLYPHRUN, {'.',0}, {'r','u',0}, 1, 1 }, - { DRAW_LAST_KIND } -}; - static void test_Draw(void) { static const WCHAR str3W[] = {'1','2','3','-','5','2',0x64a,0x64f,0x633,0x627,0x648,0x650, @@ -1916,14 +1908,6 @@ todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); ok_sequence(sequences, RENDERER_ID, draw_ltr_reordered_run_seq, "draw test 11", FALSE);
- hr = IDWriteTextLayout_SetReadingDirection(layout, DWRITE_READING_DIRECTION_RIGHT_TO_LEFT); - ok(hr == S_OK, "Failed to set reading direction, hr %#x.\n", hr); - - flush_sequence(sequences, RENDERER_ID); - hr = IDWriteTextLayout_Draw(layout, &ctxt, &testrenderer, 0.0f, 0.0f); - ok(hr == S_OK, "got 0x%08x\n", hr); - ok_sequence(sequences, RENDERER_ID, draw_rtl_reordered_run_seq, "draw test 12", FALSE); - IDWriteTextLayout_Release(layout);
IDWriteTextFormat_Release(format);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/layout.c | 228 ++++++++++++++++++++++++++----------------- 1 file changed, 137 insertions(+), 91 deletions(-)
diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 5140decbfa..b9c712cd7f 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -290,9 +290,10 @@ struct dwrite_textlayout { DWRITE_MATRIX transform; };
-struct dwrite_textformat { - IDWriteTextFormat2 IDWriteTextFormat2_iface; - LONG ref; +struct dwrite_textformat +{ + IDWriteTextFormat3 IDWriteTextFormat3_iface; + LONG refcount; struct dwrite_textformat_data format; };
@@ -312,7 +313,7 @@ struct dwrite_typography { size_t count; };
-static const IDWriteTextFormat2Vtbl dwritetextformatvtbl; +static const IDWriteTextFormat3Vtbl dwritetextformatvtbl;
static void release_format_data(struct dwrite_textformat_data *data) { @@ -343,9 +344,9 @@ static inline struct dwrite_textlayout *impl_from_IDWriteTextAnalysisSource1(IDW return CONTAINING_RECORD(iface, struct dwrite_textlayout, IDWriteTextAnalysisSource1_iface); }
-static inline struct dwrite_textformat *impl_from_IDWriteTextFormat2(IDWriteTextFormat2 *iface) +static inline struct dwrite_textformat *impl_from_IDWriteTextFormat3(IDWriteTextFormat3 *iface) { - return CONTAINING_RECORD(iface, struct dwrite_textformat, IDWriteTextFormat2_iface); + return CONTAINING_RECORD(iface, struct dwrite_textformat, IDWriteTextFormat3_iface); }
static struct dwrite_textformat *unsafe_impl_from_IDWriteTextFormat(IDWriteTextFormat*); @@ -5226,17 +5227,18 @@ HRESULT create_trimmingsign(IDWriteFactory5 *factory, IDWriteTextFormat *format, return S_OK; }
-static HRESULT WINAPI dwritetextformat_QueryInterface(IDWriteTextFormat2 *iface, REFIID riid, void **obj) +static HRESULT WINAPI dwritetextformat_QueryInterface(IDWriteTextFormat3 *iface, REFIID riid, void **obj) { TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
- if (IsEqualIID(riid, &IID_IDWriteTextFormat2) || + if (IsEqualIID(riid, &IID_IDWriteTextFormat3) || + IsEqualIID(riid, &IID_IDWriteTextFormat2) || IsEqualIID(riid, &IID_IDWriteTextFormat1) || IsEqualIID(riid, &IID_IDWriteTextFormat) || IsEqualIID(riid, &IID_IUnknown)) { *obj = iface; - IDWriteTextFormat2_AddRef(iface); + IDWriteTextFormat3_AddRef(iface); return S_OK; }
@@ -5247,20 +5249,20 @@ static HRESULT WINAPI dwritetextformat_QueryInterface(IDWriteTextFormat2 *iface, return E_NOINTERFACE; }
-static ULONG WINAPI dwritetextformat_AddRef(IDWriteTextFormat2 *iface) +static ULONG WINAPI dwritetextformat_AddRef(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); - ULONG refcount = InterlockedIncrement(&format->ref); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface); + ULONG refcount = InterlockedIncrement(&format->refcount);
TRACE("%p, refcount %d.\n", iface, refcount);
return refcount; }
-static ULONG WINAPI dwritetextformat_Release(IDWriteTextFormat2 *iface) +static ULONG WINAPI dwritetextformat_Release(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); - ULONG refcount = InterlockedDecrement(&format->ref); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface); + ULONG refcount = InterlockedDecrement(&format->refcount);
TRACE("%p, refcount %d.\n", iface, refcount);
@@ -5273,55 +5275,55 @@ static ULONG WINAPI dwritetextformat_Release(IDWriteTextFormat2 *iface) return refcount; }
-static HRESULT WINAPI dwritetextformat_SetTextAlignment(IDWriteTextFormat2 *iface, DWRITE_TEXT_ALIGNMENT alignment) +static HRESULT WINAPI dwritetextformat_SetTextAlignment(IDWriteTextFormat3 *iface, DWRITE_TEXT_ALIGNMENT alignment) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %d.\n", iface, alignment);
return format_set_textalignment(&format->format, alignment, NULL); }
-static HRESULT WINAPI dwritetextformat_SetParagraphAlignment(IDWriteTextFormat2 *iface, +static HRESULT WINAPI dwritetextformat_SetParagraphAlignment(IDWriteTextFormat3 *iface, DWRITE_PARAGRAPH_ALIGNMENT alignment) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %d.\n", iface, alignment);
return format_set_paralignment(&format->format, alignment, NULL); }
-static HRESULT WINAPI dwritetextformat_SetWordWrapping(IDWriteTextFormat2 *iface, DWRITE_WORD_WRAPPING wrapping) +static HRESULT WINAPI dwritetextformat_SetWordWrapping(IDWriteTextFormat3 *iface, DWRITE_WORD_WRAPPING wrapping) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %d.\n", iface, wrapping);
return format_set_wordwrapping(&format->format, wrapping, NULL); }
-static HRESULT WINAPI dwritetextformat_SetReadingDirection(IDWriteTextFormat2 *iface, DWRITE_READING_DIRECTION direction) +static HRESULT WINAPI dwritetextformat_SetReadingDirection(IDWriteTextFormat3 *iface, DWRITE_READING_DIRECTION direction) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %d.\n", iface, direction);
return format_set_readingdirection(&format->format, direction, NULL); }
-static HRESULT WINAPI dwritetextformat_SetFlowDirection(IDWriteTextFormat2 *iface, DWRITE_FLOW_DIRECTION direction) +static HRESULT WINAPI dwritetextformat_SetFlowDirection(IDWriteTextFormat3 *iface, DWRITE_FLOW_DIRECTION direction) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %d.\n", iface, direction);
return format_set_flowdirection(&format->format, direction, NULL); }
-static HRESULT WINAPI dwritetextformat_SetIncrementalTabStop(IDWriteTextFormat2 *iface, FLOAT tabstop) +static HRESULT WINAPI dwritetextformat_SetIncrementalTabStop(IDWriteTextFormat3 *iface, FLOAT tabstop) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %f.\n", iface, tabstop);
@@ -5332,20 +5334,20 @@ static HRESULT WINAPI dwritetextformat_SetIncrementalTabStop(IDWriteTextFormat2 return S_OK; }
-static HRESULT WINAPI dwritetextformat_SetTrimming(IDWriteTextFormat2 *iface, DWRITE_TRIMMING const *trimming, +static HRESULT WINAPI dwritetextformat_SetTrimming(IDWriteTextFormat3 *iface, DWRITE_TRIMMING const *trimming, IDWriteInlineObject *trimming_sign) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %p, %p.\n", iface, trimming, trimming_sign);
return format_set_trimming(&format->format, trimming, trimming_sign, NULL); }
-static HRESULT WINAPI dwritetextformat_SetLineSpacing(IDWriteTextFormat2 *iface, DWRITE_LINE_SPACING_METHOD method, +static HRESULT WINAPI dwritetextformat_SetLineSpacing(IDWriteTextFormat3 *iface, DWRITE_LINE_SPACING_METHOD method, FLOAT height, FLOAT baseline) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface); DWRITE_LINE_SPACING spacing;
TRACE("%p, %d, %f, %f.\n", iface, method, height, baseline); @@ -5358,64 +5360,64 @@ static HRESULT WINAPI dwritetextformat_SetLineSpacing(IDWriteTextFormat2 *iface, return format_set_linespacing(&format->format, &spacing, NULL); }
-static DWRITE_TEXT_ALIGNMENT WINAPI dwritetextformat_GetTextAlignment(IDWriteTextFormat2 *iface) +static DWRITE_TEXT_ALIGNMENT WINAPI dwritetextformat_GetTextAlignment(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p.\n", iface);
return format->format.textalignment; }
-static DWRITE_PARAGRAPH_ALIGNMENT WINAPI dwritetextformat_GetParagraphAlignment(IDWriteTextFormat2 *iface) +static DWRITE_PARAGRAPH_ALIGNMENT WINAPI dwritetextformat_GetParagraphAlignment(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p.\n", iface);
return format->format.paralign; }
-static DWRITE_WORD_WRAPPING WINAPI dwritetextformat_GetWordWrapping(IDWriteTextFormat2 *iface) +static DWRITE_WORD_WRAPPING WINAPI dwritetextformat_GetWordWrapping(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p.\n", iface);
return format->format.wrapping; }
-static DWRITE_READING_DIRECTION WINAPI dwritetextformat_GetReadingDirection(IDWriteTextFormat2 *iface) +static DWRITE_READING_DIRECTION WINAPI dwritetextformat_GetReadingDirection(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p.\n", iface);
return format->format.readingdir; }
-static DWRITE_FLOW_DIRECTION WINAPI dwritetextformat_GetFlowDirection(IDWriteTextFormat2 *iface) +static DWRITE_FLOW_DIRECTION WINAPI dwritetextformat_GetFlowDirection(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p.\n", iface);
return format->format.flow; }
-static FLOAT WINAPI dwritetextformat_GetIncrementalTabStop(IDWriteTextFormat2 *iface) +static FLOAT WINAPI dwritetextformat_GetIncrementalTabStop(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p.\n", iface);
return format->format.tabstop; }
-static HRESULT WINAPI dwritetextformat_GetTrimming(IDWriteTextFormat2 *iface, DWRITE_TRIMMING *options, +static HRESULT WINAPI dwritetextformat_GetTrimming(IDWriteTextFormat3 *iface, DWRITE_TRIMMING *options, IDWriteInlineObject **trimming_sign) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %p, %p.\n", iface, options, trimming_sign);
@@ -5426,10 +5428,10 @@ static HRESULT WINAPI dwritetextformat_GetTrimming(IDWriteTextFormat2 *iface, DW return S_OK; }
-static HRESULT WINAPI dwritetextformat_GetLineSpacing(IDWriteTextFormat2 *iface, DWRITE_LINE_SPACING_METHOD *method, +static HRESULT WINAPI dwritetextformat_GetLineSpacing(IDWriteTextFormat3 *iface, DWRITE_LINE_SPACING_METHOD *method, FLOAT *spacing, FLOAT *baseline) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %p, %p, %p.\n", iface, method, spacing, baseline);
@@ -5439,9 +5441,9 @@ static HRESULT WINAPI dwritetextformat_GetLineSpacing(IDWriteTextFormat2 *iface, return S_OK; }
-static HRESULT WINAPI dwritetextformat_GetFontCollection(IDWriteTextFormat2 *iface, IDWriteFontCollection **collection) +static HRESULT WINAPI dwritetextformat_GetFontCollection(IDWriteTextFormat3 *iface, IDWriteFontCollection **collection) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %p.\n", iface, collection);
@@ -5451,18 +5453,18 @@ static HRESULT WINAPI dwritetextformat_GetFontCollection(IDWriteTextFormat2 *ifa return S_OK; }
-static UINT32 WINAPI dwritetextformat_GetFontFamilyNameLength(IDWriteTextFormat2 *iface) +static UINT32 WINAPI dwritetextformat_GetFontFamilyNameLength(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p.\n", iface);
return format->format.family_len; }
-static HRESULT WINAPI dwritetextformat_GetFontFamilyName(IDWriteTextFormat2 *iface, WCHAR *name, UINT32 size) +static HRESULT WINAPI dwritetextformat_GetFontFamilyName(IDWriteTextFormat3 *iface, WCHAR *name, UINT32 size) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %p, %u.\n", iface, name, size);
@@ -5472,54 +5474,54 @@ static HRESULT WINAPI dwritetextformat_GetFontFamilyName(IDWriteTextFormat2 *ifa return S_OK; }
-static DWRITE_FONT_WEIGHT WINAPI dwritetextformat_GetFontWeight(IDWriteTextFormat2 *iface) +static DWRITE_FONT_WEIGHT WINAPI dwritetextformat_GetFontWeight(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p.\n", iface);
return format->format.weight; }
-static DWRITE_FONT_STYLE WINAPI dwritetextformat_GetFontStyle(IDWriteTextFormat2 *iface) +static DWRITE_FONT_STYLE WINAPI dwritetextformat_GetFontStyle(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p.\n", iface);
return format->format.style; }
-static DWRITE_FONT_STRETCH WINAPI dwritetextformat_GetFontStretch(IDWriteTextFormat2 *iface) +static DWRITE_FONT_STRETCH WINAPI dwritetextformat_GetFontStretch(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p.\n", iface);
return format->format.stretch; }
-static FLOAT WINAPI dwritetextformat_GetFontSize(IDWriteTextFormat2 *iface) +static FLOAT WINAPI dwritetextformat_GetFontSize(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p.\n", iface);
return format->format.fontsize; }
-static UINT32 WINAPI dwritetextformat_GetLocaleNameLength(IDWriteTextFormat2 *iface) +static UINT32 WINAPI dwritetextformat_GetLocaleNameLength(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p.\n", iface);
return format->format.locale_len; }
-static HRESULT WINAPI dwritetextformat_GetLocaleName(IDWriteTextFormat2 *iface, WCHAR *name, UINT32 size) +static HRESULT WINAPI dwritetextformat_GetLocaleName(IDWriteTextFormat3 *iface, WCHAR *name, UINT32 size) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %p %u.\n", iface, name, size);
@@ -5529,9 +5531,10 @@ static HRESULT WINAPI dwritetextformat_GetLocaleName(IDWriteTextFormat2 *iface, return S_OK; }
-static HRESULT WINAPI dwritetextformat1_SetVerticalGlyphOrientation(IDWriteTextFormat2 *iface, DWRITE_VERTICAL_GLYPH_ORIENTATION orientation) +static HRESULT WINAPI dwritetextformat1_SetVerticalGlyphOrientation(IDWriteTextFormat3 *iface, + DWRITE_VERTICAL_GLYPH_ORIENTATION orientation) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %d.\n", iface, orientation);
@@ -5542,18 +5545,18 @@ static HRESULT WINAPI dwritetextformat1_SetVerticalGlyphOrientation(IDWriteTextF return S_OK; }
-static DWRITE_VERTICAL_GLYPH_ORIENTATION WINAPI dwritetextformat1_GetVerticalGlyphOrientation(IDWriteTextFormat2 *iface) +static DWRITE_VERTICAL_GLYPH_ORIENTATION WINAPI dwritetextformat1_GetVerticalGlyphOrientation(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p.\n", iface);
return format->format.vertical_orientation; }
-static HRESULT WINAPI dwritetextformat1_SetLastLineWrapping(IDWriteTextFormat2 *iface, BOOL lastline_wrapping_enabled) +static HRESULT WINAPI dwritetextformat1_SetLastLineWrapping(IDWriteTextFormat3 *iface, BOOL lastline_wrapping_enabled) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %d.\n", iface, lastline_wrapping_enabled);
@@ -5561,63 +5564,63 @@ static HRESULT WINAPI dwritetextformat1_SetLastLineWrapping(IDWriteTextFormat2 * return S_OK; }
-static BOOL WINAPI dwritetextformat1_GetLastLineWrapping(IDWriteTextFormat2 *iface) +static BOOL WINAPI dwritetextformat1_GetLastLineWrapping(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p.\n", iface);
return format->format.last_line_wrapping; }
-static HRESULT WINAPI dwritetextformat1_SetOpticalAlignment(IDWriteTextFormat2 *iface, DWRITE_OPTICAL_ALIGNMENT alignment) +static HRESULT WINAPI dwritetextformat1_SetOpticalAlignment(IDWriteTextFormat3 *iface, DWRITE_OPTICAL_ALIGNMENT alignment) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %d.\n", iface, alignment);
return format_set_optical_alignment(&format->format, alignment); }
-static DWRITE_OPTICAL_ALIGNMENT WINAPI dwritetextformat1_GetOpticalAlignment(IDWriteTextFormat2 *iface) +static DWRITE_OPTICAL_ALIGNMENT WINAPI dwritetextformat1_GetOpticalAlignment(IDWriteTextFormat3 *iface) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p.\n", iface);
return format->format.optical_alignment; }
-static HRESULT WINAPI dwritetextformat1_SetFontFallback(IDWriteTextFormat2 *iface, IDWriteFontFallback *fallback) +static HRESULT WINAPI dwritetextformat1_SetFontFallback(IDWriteTextFormat3 *iface, IDWriteFontFallback *fallback) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %p.\n", iface, fallback);
return set_fontfallback_for_format(&format->format, fallback); }
-static HRESULT WINAPI dwritetextformat1_GetFontFallback(IDWriteTextFormat2 *iface, IDWriteFontFallback **fallback) +static HRESULT WINAPI dwritetextformat1_GetFontFallback(IDWriteTextFormat3 *iface, IDWriteFontFallback **fallback) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %p.\n", iface, fallback);
return get_fontfallback_from_format(&format->format, fallback); }
-static HRESULT WINAPI dwritetextformat2_SetLineSpacing(IDWriteTextFormat2 *iface, DWRITE_LINE_SPACING const *spacing) +static HRESULT WINAPI dwritetextformat2_SetLineSpacing(IDWriteTextFormat3 *iface, DWRITE_LINE_SPACING const *spacing) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %p.\n", iface, spacing);
return format_set_linespacing(&format->format, spacing, NULL); }
-static HRESULT WINAPI dwritetextformat2_GetLineSpacing(IDWriteTextFormat2 *iface, DWRITE_LINE_SPACING *spacing) +static HRESULT WINAPI dwritetextformat2_GetLineSpacing(IDWriteTextFormat3 *iface, DWRITE_LINE_SPACING *spacing) { - struct dwrite_textformat *format = impl_from_IDWriteTextFormat2(iface); + struct dwrite_textformat *format = impl_from_IDWriteTextFormat3(iface);
TRACE("%p, %p.\n", iface, spacing);
@@ -5625,7 +5628,45 @@ static HRESULT WINAPI dwritetextformat2_GetLineSpacing(IDWriteTextFormat2 *iface return S_OK; }
-static const IDWriteTextFormat2Vtbl dwritetextformatvtbl = { +static HRESULT WINAPI dwritetextformat3_SetFontAxisValues(IDWriteTextFormat3 *iface, + DWRITE_FONT_AXIS_VALUE const *axis_values, UINT32 num_values) +{ + FIXME("%p, %p, %u.\n", iface, axis_values, num_values); + + return E_NOTIMPL; +} + +static UINT32 WINAPI dwritetextformat3_GetFontAxisValueCount(IDWriteTextFormat3 *iface) +{ + FIXME("%p.\n", iface); + + return 0; +} + +static HRESULT WINAPI dwritetextformat3_GetFontAxisValues(IDWriteTextFormat3 *iface, + DWRITE_FONT_AXIS_VALUE const *axis_values, UINT32 num_values) +{ + FIXME("%p, %p, %u.\n", iface, axis_values, num_values); + + return E_NOTIMPL; +} + +static DWRITE_AUTOMATIC_FONT_AXES WINAPI dwritetextformat3_GetAutomaticFontAxes(IDWriteTextFormat3 *iface) +{ + FIXME("%p.\n", iface); + + return DWRITE_AUTOMATIC_FONT_AXES_NONE; +} + +static HRESULT WINAPI dwritetextformat3_SetAutomaticFontAxes(IDWriteTextFormat3 *iface, DWRITE_AUTOMATIC_FONT_AXES axes) +{ + FIXME("%p, %d.\n", iface, axes); + + return E_NOTIMPL; +} + +static const IDWriteTextFormat3Vtbl dwritetextformatvtbl = +{ dwritetextformat_QueryInterface, dwritetextformat_AddRef, dwritetextformat_Release, @@ -5663,13 +5704,18 @@ static const IDWriteTextFormat2Vtbl dwritetextformatvtbl = { dwritetextformat1_SetFontFallback, dwritetextformat1_GetFontFallback, dwritetextformat2_SetLineSpacing, - dwritetextformat2_GetLineSpacing + dwritetextformat2_GetLineSpacing, + dwritetextformat3_SetFontAxisValues, + dwritetextformat3_GetFontAxisValueCount, + dwritetextformat3_GetFontAxisValues, + dwritetextformat3_GetAutomaticFontAxes, + dwritetextformat3_SetAutomaticFontAxes, };
static struct dwrite_textformat *unsafe_impl_from_IDWriteTextFormat(IDWriteTextFormat *iface) { return (iface->lpVtbl == (IDWriteTextFormatVtbl*)&dwritetextformatvtbl) ? - CONTAINING_RECORD(iface, struct dwrite_textformat, IDWriteTextFormat2_iface) : NULL; + CONTAINING_RECORD(iface, struct dwrite_textformat, IDWriteTextFormat3_iface) : NULL; }
HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *collection, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STYLE style, @@ -5690,8 +5736,8 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle This = heap_alloc(sizeof(struct dwrite_textformat)); if (!This) return E_OUTOFMEMORY;
- This->IDWriteTextFormat2_iface.lpVtbl = &dwritetextformatvtbl; - This->ref = 1; + This->IDWriteTextFormat3_iface.lpVtbl = &dwritetextformatvtbl; + This->refcount = 1; This->format.family_name = heap_strdupW(family_name); This->format.family_len = strlenW(family_name); This->format.locale = heap_strdupW(locale); @@ -5724,7 +5770,7 @@ HRESULT create_textformat(const WCHAR *family_name, IDWriteFontCollection *colle This->format.fallback = NULL; IDWriteFontCollection_AddRef(collection);
- *format = (IDWriteTextFormat*)&This->IDWriteTextFormat2_iface; + *format = (IDWriteTextFormat *)&This->IDWriteTextFormat3_iface;
return S_OK; }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/dwrite_private.h | 7 +- dlls/dwrite/font.c | 147 ++++++++++++++++++++++++----------- dlls/dwrite/main.c | 8 +- dlls/dwrite/tests/font.c | 15 ++++ include/dwrite_3.idl | 2 +- 5 files changed, 125 insertions(+), 54 deletions(-)
diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index d0fed98d6f..406664a590 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -239,13 +239,14 @@ extern HRESULT clone_localizedstring(IDWriteLocalizedStrings *iface, IDWriteLoca extern void set_en_localizedstring(IDWriteLocalizedStrings*,const WCHAR*) DECLSPEC_HIDDEN; extern void sort_localizedstrings(IDWriteLocalizedStrings*) DECLSPEC_HIDDEN; extern HRESULT get_system_fontcollection(IDWriteFactory5*,IDWriteFontCollection1**) DECLSPEC_HIDDEN; -extern HRESULT get_eudc_fontcollection(IDWriteFactory5*,IDWriteFontCollection1**) DECLSPEC_HIDDEN; +extern HRESULT get_eudc_fontcollection(IDWriteFactory5 *factory, IDWriteFontCollection3 **collection) DECLSPEC_HIDDEN; extern IDWriteTextAnalyzer *get_text_analyzer(void) DECLSPEC_HIDDEN; extern HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *reference_key, UINT32 key_size, IDWriteFontFile **font_file) DECLSPEC_HIDDEN; extern void init_local_fontfile_loader(void) DECLSPEC_HIDDEN; extern IDWriteFontFileLoader *get_local_fontfile_loader(void) DECLSPEC_HIDDEN; extern HRESULT create_fontface(const struct fontface_desc*,struct list*,IDWriteFontFace4**) DECLSPEC_HIDDEN; -extern HRESULT create_font_collection(IDWriteFactory5*,IDWriteFontFileEnumerator*,BOOL,IDWriteFontCollection1**) DECLSPEC_HIDDEN; +extern HRESULT create_font_collection(IDWriteFactory5 *factory, IDWriteFontFileEnumerator *enumerator, BOOL is_system, + IDWriteFontCollection3 **collection) DECLSPEC_HIDDEN; extern HRESULT create_glyphrunanalysis(const struct glyphrunanalysis_desc*,IDWriteGlyphRunAnalysis**) DECLSPEC_HIDDEN; extern BOOL is_system_collection(IDWriteFontCollection*) DECLSPEC_HIDDEN; extern HRESULT get_local_refkey(const WCHAR*,const FILETIME*,void**,UINT32*) DECLSPEC_HIDDEN; @@ -264,7 +265,7 @@ extern HRESULT create_fontfacereference(IDWriteFactory5*,IDWriteFontFile*,UINT32 IDWriteFontFaceReference**) DECLSPEC_HIDDEN; extern HRESULT factory_get_cached_fontface(IDWriteFactory5*,IDWriteFontFile*const*,UINT32,DWRITE_FONT_SIMULATIONS, struct list**,REFIID,void**) DECLSPEC_HIDDEN; -extern void factory_detach_fontcollection(IDWriteFactory5*,IDWriteFontCollection1*) DECLSPEC_HIDDEN; +extern void factory_detach_fontcollection(IDWriteFactory5 *factory, IDWriteFontCollection3 *collection) DECLSPEC_HIDDEN; extern void factory_detach_gdiinterop(IDWriteFactory5*,IDWriteGdiInterop1*) DECLSPEC_HIDDEN; extern struct fontfacecached *factory_cache_fontface(IDWriteFactory5*,struct list*,IDWriteFontFace4*) DECLSPEC_HIDDEN; extern void get_logfont_from_font(IDWriteFont*,LOGFONTW*) DECLSPEC_HIDDEN; diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 604c67f565..ce376e339f 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -116,7 +116,7 @@ struct dwrite_fontfamily_data
struct dwrite_fontcollection { - IDWriteFontCollection1 IDWriteFontCollection1_iface; + IDWriteFontCollection3 IDWriteFontCollection3_iface; LONG refcount;
IDWriteFactory5 *factory; @@ -296,9 +296,9 @@ static inline struct dwrite_fontfamily *impl_family_from_IDWriteFontList1(IDWrit return CONTAINING_RECORD(iface, struct dwrite_fontfamily, IDWriteFontList1_iface); }
-static inline struct dwrite_fontcollection *impl_from_IDWriteFontCollection1(IDWriteFontCollection1 *iface) +static inline struct dwrite_fontcollection *impl_from_IDWriteFontCollection3(IDWriteFontCollection3 *iface) { - return CONTAINING_RECORD(iface, struct dwrite_fontcollection, IDWriteFontCollection1_iface); + return CONTAINING_RECORD(iface, struct dwrite_fontcollection, IDWriteFontCollection3_iface); }
static inline struct dwrite_glyphrunanalysis *impl_from_IDWriteGlyphRunAnalysis(IDWriteGlyphRunAnalysis *iface) @@ -2025,7 +2025,7 @@ static ULONG WINAPI dwritefontfamily_Release(IDWriteFontFamily1 *iface)
if (!ref) { - IDWriteFontCollection1_Release(&This->collection->IDWriteFontCollection1_iface); + IDWriteFontCollection3_Release(&This->collection->IDWriteFontCollection3_iface); release_fontfamily_data(This->data); heap_free(This); } @@ -2380,7 +2380,7 @@ static HRESULT create_fontfamily(struct dwrite_fontcollection *collection, UINT3 object->IDWriteFontList1_iface.lpVtbl = &fontfamilylistvtbl; object->ref = 1; object->collection = collection; - IDWriteFontCollection1_AddRef(&collection->IDWriteFontCollection1_iface); + IDWriteFontCollection3_AddRef(&collection->IDWriteFontCollection3_iface); object->data = collection->family_data[index]; InterlockedIncrement(&object->data->refcount);
@@ -2395,17 +2395,20 @@ BOOL is_system_collection(IDWriteFontCollection *collection) return IDWriteFontCollection_QueryInterface(collection, &IID_issystemcollection, &obj) == S_OK; }
-static HRESULT WINAPI dwritesystemfontcollection_QueryInterface(IDWriteFontCollection1 *iface, REFIID riid, void **obj) +static HRESULT WINAPI dwritesystemfontcollection_QueryInterface(IDWriteFontCollection3 *iface, REFIID riid, void **obj) { - struct dwrite_fontcollection *This = impl_from_IDWriteFontCollection1(iface); - TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection3(iface); + + TRACE("%p, %s, %p.\n", collection, debugstr_guid(riid), obj);
- if (IsEqualIID(riid, &IID_IDWriteFontCollection1) || + if (IsEqualIID(riid, &IID_IDWriteFontCollection3) || + IsEqualIID(riid, &IID_IDWriteFontCollection2) || + IsEqualIID(riid, &IID_IDWriteFontCollection1) || IsEqualIID(riid, &IID_IDWriteFontCollection) || IsEqualIID(riid, &IID_IUnknown)) { *obj = iface; - IDWriteFontCollection1_AddRef(iface); + IDWriteFontCollection3_AddRef(iface); return S_OK; }
@@ -2419,17 +2422,18 @@ static HRESULT WINAPI dwritesystemfontcollection_QueryInterface(IDWriteFontColle return E_NOINTERFACE; }
-static HRESULT WINAPI dwritefontcollection_QueryInterface(IDWriteFontCollection1 *iface, REFIID riid, void **obj) +static HRESULT WINAPI dwritefontcollection_QueryInterface(IDWriteFontCollection3 *iface, REFIID riid, void **obj) { - struct dwrite_fontcollection *This = impl_from_IDWriteFontCollection1(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_IDWriteFontCollection1) || + if (IsEqualIID(riid, &IID_IDWriteFontCollection3) || + IsEqualIID(riid, &IID_IDWriteFontCollection2) || + IsEqualIID(riid, &IID_IDWriteFontCollection1) || IsEqualIID(riid, &IID_IDWriteFontCollection) || IsEqualIID(riid, &IID_IUnknown)) { *obj = iface; - IDWriteFontCollection1_AddRef(iface); + IDWriteFontCollection3_AddRef(iface); return S_OK; }
@@ -2440,9 +2444,9 @@ static HRESULT WINAPI dwritefontcollection_QueryInterface(IDWriteFontCollection1 return E_NOINTERFACE; }
-static ULONG WINAPI dwritefontcollection_AddRef(IDWriteFontCollection1 *iface) +static ULONG WINAPI dwritefontcollection_AddRef(IDWriteFontCollection3 *iface) { - struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection1(iface); + struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection3(iface); ULONG refcount = InterlockedIncrement(&collection->refcount);
TRACE("%p, refcount %d.\n", collection, refcount); @@ -2450,9 +2454,9 @@ static ULONG WINAPI dwritefontcollection_AddRef(IDWriteFontCollection1 *iface) return refcount; }
-static ULONG WINAPI dwritefontcollection_Release(IDWriteFontCollection1 *iface) +static ULONG WINAPI dwritefontcollection_Release(IDWriteFontCollection3 *iface) { - struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection1(iface); + struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection3(iface); ULONG refcount = InterlockedDecrement(&collection->refcount); size_t i;
@@ -2470,19 +2474,19 @@ static ULONG WINAPI dwritefontcollection_Release(IDWriteFontCollection1 *iface) return refcount; }
-static UINT32 WINAPI dwritefontcollection_GetFontFamilyCount(IDWriteFontCollection1 *iface) +static UINT32 WINAPI dwritefontcollection_GetFontFamilyCount(IDWriteFontCollection3 *iface) { - struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection1(iface); + struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection3(iface);
TRACE("%p.\n", iface);
return collection->count; }
-static HRESULT WINAPI dwritefontcollection_GetFontFamily(IDWriteFontCollection1 *iface, UINT32 index, +static HRESULT WINAPI dwritefontcollection_GetFontFamily(IDWriteFontCollection3 *iface, UINT32 index, IDWriteFontFamily **family) { - struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection1(iface); + struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection3(iface);
TRACE("%p, %u, %p.\n", iface, index, family);
@@ -2516,11 +2520,14 @@ static UINT32 collection_find_family(struct dwrite_fontcollection *collection, c return ~0u; }
-static HRESULT WINAPI dwritefontcollection_FindFamilyName(IDWriteFontCollection1 *iface, const WCHAR *name, UINT32 *index, BOOL *exists) +static HRESULT WINAPI dwritefontcollection_FindFamilyName(IDWriteFontCollection3 *iface, const WCHAR *name, + UINT32 *index, BOOL *exists) { - struct dwrite_fontcollection *This = impl_from_IDWriteFontCollection1(iface); - TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(name), index, exists); - *index = collection_find_family(This, name); + struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection3(iface); + + TRACE("%p, %s, %p, %p.\n", iface, debugstr_w(name), index, exists); + + *index = collection_find_family(collection, name); *exists = *index != ~0u; return S_OK; } @@ -2548,10 +2555,10 @@ static BOOL is_same_fontfile(IDWriteFontFile *left, IDWriteFontFile *right) return !memcmp(left_key, right_key, left_key_size); }
-static HRESULT WINAPI dwritefontcollection_GetFontFromFontFace(IDWriteFontCollection1 *iface, IDWriteFontFace *face, +static HRESULT WINAPI dwritefontcollection_GetFontFromFontFace(IDWriteFontCollection3 *iface, IDWriteFontFace *face, IDWriteFont **font) { - struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection1(iface); + struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection3(iface); IDWriteFontFamily1 *family; BOOL found_font = FALSE; IDWriteFontFile *file; @@ -2604,19 +2611,17 @@ static HRESULT WINAPI dwritefontcollection_GetFontFromFontFace(IDWriteFontCollec return hr; }
-static HRESULT WINAPI dwritefontcollection1_GetFontSet(IDWriteFontCollection1 *iface, IDWriteFontSet **fontset) +static HRESULT WINAPI dwritefontcollection1_GetFontSet(IDWriteFontCollection3 *iface, IDWriteFontSet **fontset) { - struct dwrite_fontcollection *This = impl_from_IDWriteFontCollection1(iface); - - FIXME("(%p)->(%p): stub\n", This, fontset); + FIXME("%p, %p.\n", iface, fontset);
return E_NOTIMPL; }
-static HRESULT WINAPI dwritefontcollection1_GetFontFamily(IDWriteFontCollection1 *iface, UINT32 index, +static HRESULT WINAPI dwritefontcollection1_GetFontFamily(IDWriteFontCollection3 *iface, UINT32 index, IDWriteFontFamily1 **family) { - struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection1(iface); + struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection3(iface);
TRACE("%p, %u, %p.\n", iface, index, family);
@@ -2629,7 +2634,46 @@ static HRESULT WINAPI dwritefontcollection1_GetFontFamily(IDWriteFontCollection1 return create_fontfamily(collection, index, family); }
-static const IDWriteFontCollection1Vtbl fontcollectionvtbl = { +static HRESULT WINAPI dwritefontcollection2_GetFontFamily(IDWriteFontCollection3 *iface, + UINT32 index, IDWriteFontFamily2 **family) +{ + FIXME("%p, %u, %p.\n", iface, index, family); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dwritefontcollection2_GetMatchingFonts(IDWriteFontCollection3 *iface, + const WCHAR *familyname, DWRITE_FONT_AXIS_VALUE const *axis_values, UINT32 num_values, + IDWriteFontList2 **fontlist) +{ + FIXME("%p, %s, %p, %u, %p.\n", iface, debugstr_w(familyname), axis_values, num_values, fontlist); + + return E_NOTIMPL; +} + +static DWRITE_FONT_FAMILY_MODEL WINAPI dwritefontcollection2_GetFontFamilyModel(IDWriteFontCollection3 *iface) +{ + FIXME("%p.\n", iface); + + return DWRITE_FONT_FAMILY_MODEL_WEIGHT_STRETCH_STYLE; +} + +static HRESULT WINAPI dwritefontcollection2_GetFontSet(IDWriteFontCollection3 *iface, IDWriteFontSet1 **fontset) +{ + FIXME("%p, %p.\n", iface, fontset); + + return E_NOTIMPL; +} + +static HANDLE WINAPI dwritefontcollection3_GetExpirationEvent(IDWriteFontCollection3 *iface) +{ + FIXME("%p.\n", iface); + + return NULL; +} + +static const IDWriteFontCollection3Vtbl fontcollectionvtbl = +{ dwritefontcollection_QueryInterface, dwritefontcollection_AddRef, dwritefontcollection_Release, @@ -2638,10 +2682,16 @@ static const IDWriteFontCollection1Vtbl fontcollectionvtbl = { dwritefontcollection_FindFamilyName, dwritefontcollection_GetFontFromFontFace, dwritefontcollection1_GetFontSet, - dwritefontcollection1_GetFontFamily + dwritefontcollection1_GetFontFamily, + dwritefontcollection2_GetFontFamily, + dwritefontcollection2_GetMatchingFonts, + dwritefontcollection2_GetFontFamilyModel, + dwritefontcollection2_GetFontSet, + dwritefontcollection3_GetExpirationEvent, };
-static const IDWriteFontCollection1Vtbl systemfontcollectionvtbl = { +static const IDWriteFontCollection3Vtbl systemfontcollectionvtbl = +{ dwritesystemfontcollection_QueryInterface, dwritefontcollection_AddRef, dwritefontcollection_Release, @@ -2650,7 +2700,12 @@ static const IDWriteFontCollection1Vtbl systemfontcollectionvtbl = { dwritefontcollection_FindFamilyName, dwritefontcollection_GetFontFromFontFace, dwritefontcollection1_GetFontSet, - dwritefontcollection1_GetFontFamily + dwritefontcollection1_GetFontFamily, + dwritefontcollection2_GetFontFamily, + dwritefontcollection2_GetMatchingFonts, + dwritefontcollection2_GetFontFamilyModel, + dwritefontcollection2_GetFontSet, + dwritefontcollection3_GetExpirationEvent, };
static HRESULT fontfamily_add_font(struct dwrite_fontfamily_data *family_data, struct dwrite_font_data *font_data) @@ -2686,7 +2741,7 @@ static HRESULT fontcollection_add_family(struct dwrite_fontcollection *collectio
static HRESULT init_font_collection(struct dwrite_fontcollection *collection, BOOL is_system) { - collection->IDWriteFontCollection1_iface.lpVtbl = is_system ? &systemfontcollectionvtbl : &fontcollectionvtbl; + collection->IDWriteFontCollection3_iface.lpVtbl = is_system ? &systemfontcollectionvtbl : &fontcollectionvtbl; collection->refcount = 1; collection->count = 0; collection->size = 0; @@ -3765,7 +3820,7 @@ static void fontcollection_add_replacements(struct dwrite_fontcollection *collec }
HRESULT create_font_collection(IDWriteFactory5 *factory, IDWriteFontFileEnumerator *enumerator, BOOL is_system, - IDWriteFontCollection1 **ret) + IDWriteFontCollection3 **ret) { struct fontfile_enum { struct list entry; @@ -3789,7 +3844,7 @@ HRESULT create_font_collection(IDWriteFactory5 *factory, IDWriteFontFileEnumerat return hr; }
- *ret = &collection->IDWriteFontCollection1_iface; + *ret = &collection->IDWriteFontCollection3_iface;
TRACE("building font collection:\n");
@@ -4130,7 +4185,7 @@ HRESULT get_system_fontcollection(IDWriteFactory5 *factory, IDWriteFontCollectio return hr;
TRACE("building system font collection for factory %p\n", factory); - hr = create_font_collection(factory, enumerator, TRUE, collection); + hr = create_font_collection(factory, enumerator, TRUE, (IDWriteFontCollection3 **)collection); IDWriteFontFileEnumerator_Release(enumerator); return hr; } @@ -4223,7 +4278,7 @@ static HRESULT eudc_collection_add_family(IDWriteFactory5 *factory, struct dwrit return hr; }
-HRESULT get_eudc_fontcollection(IDWriteFactory5 *factory, IDWriteFontCollection1 **ret) +HRESULT get_eudc_fontcollection(IDWriteFactory5 *factory, IDWriteFontCollection3 **ret) { static const WCHAR eudckeyfmtW[] = {'E','U','D','C','\','%','u',0}; struct dwrite_fontcollection *collection; @@ -4249,7 +4304,7 @@ HRESULT get_eudc_fontcollection(IDWriteFactory5 *factory, IDWriteFontCollection1 return hr; }
- *ret = &collection->IDWriteFontCollection1_iface; + *ret = &collection->IDWriteFontCollection3_iface; collection->factory = factory; IDWriteFactory5_AddRef(factory);
@@ -4278,7 +4333,7 @@ HRESULT get_eudc_fontcollection(IDWriteFactory5 *factory, IDWriteFontCollection1
/* try to add global default if not defined for specific codepage */ exists = FALSE; - hr = IDWriteFontCollection1_FindFamilyName(&collection->IDWriteFontCollection1_iface, emptyW, + hr = IDWriteFontCollection3_FindFamilyName(&collection->IDWriteFontCollection3_iface, emptyW, &index, &exists); if (FAILED(hr) || !exists) { static const WCHAR globaldefaultW[] = {'E','U','D','C','.','T','T','E',0}; diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index fc72013feb..ccf4cb51b9 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -753,7 +753,7 @@ static HRESULT WINAPI dwritefactory_CreateCustomFontCollection(IDWriteFactory5 * if (FAILED(hr)) return hr;
- hr = create_font_collection(iface, enumerator, FALSE, (IDWriteFontCollection1**)collection); + hr = create_font_collection(iface, enumerator, FALSE, (IDWriteFontCollection3 **)collection); IDWriteFontFileEnumerator_Release(enumerator); return hr; } @@ -1292,7 +1292,7 @@ static HRESULT WINAPI dwritefactory1_GetEudcFontCollection(IDWriteFactory5 *ifac if (This->eudc_collection) IDWriteFontCollection1_AddRef(This->eudc_collection); else { - IDWriteFontCollection1 *eudc_collection; + IDWriteFontCollection3 *eudc_collection;
if (FAILED(hr = get_eudc_fontcollection(iface, &eudc_collection))) { *collection = NULL; @@ -1301,7 +1301,7 @@ static HRESULT WINAPI dwritefactory1_GetEudcFontCollection(IDWriteFactory5 *ifac }
if (InterlockedCompareExchangePointer((void **)&This->eudc_collection, eudc_collection, NULL)) - IDWriteFontCollection1_Release(eudc_collection); + IDWriteFontCollection3_Release(eudc_collection); }
*collection = (IDWriteFontCollection *)This->eudc_collection; @@ -1827,7 +1827,7 @@ static void init_dwritefactory(struct dwritefactory *factory, DWRITE_FACTORY_TYP factory->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": dwritefactory.lock"); }
-void factory_detach_fontcollection(IDWriteFactory5 *iface, IDWriteFontCollection1 *collection) +void factory_detach_fontcollection(IDWriteFactory5 *iface, IDWriteFontCollection3 *collection) { struct dwritefactory *factory = impl_from_IDWriteFactory5(iface); InterlockedCompareExchangePointer((void **)&factory->system_collection, NULL, collection); diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 7d434222a3..2fdf93106b 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -2365,6 +2365,7 @@ static void test_system_fontcollection(void) IDWriteFontCollection *collection, *coll2; IDWriteLocalFontFileLoader *localloader; IDWriteFontCollection1 *collection1; + IDWriteFontCollection3 *collection3; IDWriteFactory *factory, *factory2; IDWriteFontFileLoader *loader; IDWriteFontFamily *family; @@ -2540,6 +2541,20 @@ static void test_system_fontcollection(void) else win_skip("IDWriteFontCollection1 is not supported.\n");
+ hr = IDWriteFontCollection_QueryInterface(collection, &IID_IDWriteFontCollection3, (void **)&collection3); + if (SUCCEEDED(hr)) + { + HANDLE event; + + event = IDWriteFontCollection3_GetExpirationEvent(collection3); +todo_wine + ok(!!event, "Expected event handle.\n"); + + IDWriteFontCollection3_Release(collection3); + } + else + win_skip("IDWriteFontCollection3 is not supported.\n"); + ref = IDWriteFontCollection_Release(collection); ok(ref == 0, "collection not released, %u\n", ref); ref = IDWriteFactory_Release(factory); diff --git a/include/dwrite_3.idl b/include/dwrite_3.idl index b148bd725b..f7cb97dff6 100644 --- a/include/dwrite_3.idl +++ b/include/dwrite_3.idl @@ -377,7 +377,7 @@ interface IDWriteFontCollection2 : IDWriteFontCollection1 ] interface IDWriteFontCollection3 : IDWriteFontCollection2 { - HANDLE GetExiprationEvent(); + HANDLE GetExpirationEvent(); }
[
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/dwrite/font.c | 206 +++++++++++++++++++++++++-------------------- 1 file changed, 117 insertions(+), 89 deletions(-)
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index ce376e339f..be9ff88fe4 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -125,10 +125,11 @@ struct dwrite_fontcollection size_t count; };
-struct dwrite_fontfamily { - IDWriteFontFamily1 IDWriteFontFamily1_iface; +struct dwrite_fontfamily +{ + IDWriteFontFamily2 IDWriteFontFamily2_iface; IDWriteFontList1 IDWriteFontList1_iface; - LONG ref; + LONG refcount;
struct dwrite_fontfamily_data *data; struct dwrite_fontcollection *collection; @@ -286,9 +287,9 @@ static inline struct dwrite_fontfile *impl_from_IDWriteFontFile(IDWriteFontFile return CONTAINING_RECORD(iface, struct dwrite_fontfile, IDWriteFontFile_iface); }
-static inline struct dwrite_fontfamily *impl_from_IDWriteFontFamily1(IDWriteFontFamily1 *iface) +static inline struct dwrite_fontfamily *impl_from_IDWriteFontFamily2(IDWriteFontFamily2 *iface) { - return CONTAINING_RECORD(iface, struct dwrite_fontfamily, IDWriteFontFamily1_iface); + return CONTAINING_RECORD(iface, struct dwrite_fontfamily, IDWriteFontFamily2_iface); }
static inline struct dwrite_fontfamily *impl_family_from_IDWriteFontList1(IDWriteFontList1 *iface) @@ -1473,7 +1474,7 @@ static ULONG WINAPI dwritefont_Release(IDWriteFont3 *iface) TRACE("(%p)->(%d)\n", This, ref);
if (!ref) { - IDWriteFontFamily1_Release(&This->family->IDWriteFontFamily1_iface); + IDWriteFontFamily2_Release(&This->family->IDWriteFontFamily2_iface); release_font_data(This->data); heap_free(This); } @@ -1830,7 +1831,7 @@ static HRESULT create_font(struct dwrite_fontfamily *family, UINT32 index, IDWri This->IDWriteFont3_iface.lpVtbl = &dwritefontvtbl; This->ref = 1; This->family = family; - IDWriteFontFamily1_AddRef(&family->IDWriteFontFamily1_iface); + IDWriteFontFamily2_AddRef(&family->IDWriteFontFamily2_iface); This->data = family->data->fonts[index]; This->style = This->data->style; addref_font_data(This->data); @@ -1882,7 +1883,7 @@ static ULONG WINAPI dwritefontlist_Release(IDWriteFontList1 *iface)
for (i = 0; i < This->font_count; i++) release_font_data(This->fonts[i]); - IDWriteFontFamily1_Release(&This->family->IDWriteFontFamily1_iface); + IDWriteFontFamily2_Release(&This->family->IDWriteFontFamily2_iface); heap_free(This->fonts); heap_free(This); } @@ -1893,7 +1894,7 @@ static ULONG WINAPI dwritefontlist_Release(IDWriteFontList1 *iface) static HRESULT WINAPI dwritefontlist_GetFontCollection(IDWriteFontList1 *iface, IDWriteFontCollection **collection) { struct dwrite_fontlist *This = impl_from_IDWriteFontList1(iface); - return IDWriteFontFamily1_GetFontCollection(&This->family->IDWriteFontFamily1_iface, collection); + return IDWriteFontFamily2_GetFontCollection(&This->family->IDWriteFontFamily2_iface, collection); }
static UINT32 WINAPI dwritefontlist_GetFontCount(IDWriteFontList1 *iface) @@ -1979,26 +1980,27 @@ static const IDWriteFontList1Vtbl dwritefontlistvtbl = { dwritefontlist1_GetFontFaceReference };
-static HRESULT WINAPI dwritefontfamily_QueryInterface(IDWriteFontFamily1 *iface, REFIID riid, void **obj) +static HRESULT WINAPI dwritefontfamily_QueryInterface(IDWriteFontFamily2 *iface, REFIID riid, void **obj) { - struct dwrite_fontfamily *This = impl_from_IDWriteFontFamily1(iface); + struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily2(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_IDWriteFontFamily1) || + if (IsEqualIID(riid, &IID_IDWriteFontFamily2) || + IsEqualIID(riid, &IID_IDWriteFontFamily1) || IsEqualIID(riid, &IID_IDWriteFontFamily) || IsEqualIID(riid, &IID_IUnknown)) { *obj = iface; - IDWriteFontFamily1_AddRef(iface); + IDWriteFontFamily2_AddRef(iface); return S_OK; }
if (IsEqualIID(riid, &IID_IDWriteFontList1) || IsEqualIID(riid, &IID_IDWriteFontList)) { - *obj = &This->IDWriteFontList1_iface; - IDWriteFontList1_AddRef(&This->IDWriteFontList1_iface); + *obj = &family->IDWriteFontList1_iface; + IDWriteFontList1_AddRef(&family->IDWriteFontList1_iface); return S_OK; }
@@ -2008,54 +2010,56 @@ static HRESULT WINAPI dwritefontfamily_QueryInterface(IDWriteFontFamily1 *iface, return E_NOINTERFACE; }
-static ULONG WINAPI dwritefontfamily_AddRef(IDWriteFontFamily1 *iface) +static ULONG WINAPI dwritefontfamily_AddRef(IDWriteFontFamily2 *iface) { - struct dwrite_fontfamily *This = impl_from_IDWriteFontFamily1(iface); - ULONG ref = InterlockedIncrement(&This->ref); - TRACE("(%p)->(%d)\n", This, ref); - return ref; + struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily2(iface); + ULONG refcount = InterlockedIncrement(&family->refcount); + + TRACE("%p, %u.\n", iface, refcount); + + return refcount; }
-static ULONG WINAPI dwritefontfamily_Release(IDWriteFontFamily1 *iface) +static ULONG WINAPI dwritefontfamily_Release(IDWriteFontFamily2 *iface) { - struct dwrite_fontfamily *This = impl_from_IDWriteFontFamily1(iface); - ULONG ref = InterlockedDecrement(&This->ref); + struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily2(iface); + ULONG refcount = InterlockedDecrement(&family->refcount);
- TRACE("(%p)->(%d)\n", This, ref); + TRACE("%p, %u.\n", iface, refcount);
- if (!ref) + if (!refcount) { - IDWriteFontCollection3_Release(&This->collection->IDWriteFontCollection3_iface); - release_fontfamily_data(This->data); - heap_free(This); + IDWriteFontCollection3_Release(&family->collection->IDWriteFontCollection3_iface); + release_fontfamily_data(family->data); + heap_free(family); }
- return ref; + return refcount; }
-static HRESULT WINAPI dwritefontfamily_GetFontCollection(IDWriteFontFamily1 *iface, IDWriteFontCollection **collection) +static HRESULT WINAPI dwritefontfamily_GetFontCollection(IDWriteFontFamily2 *iface, IDWriteFontCollection **collection) { - struct dwrite_fontfamily *This = impl_from_IDWriteFontFamily1(iface); + struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily2(iface);
- TRACE("(%p)->(%p)\n", This, collection); + TRACE("%p, %p.\n", iface, collection);
- *collection = (IDWriteFontCollection*)This->collection; + *collection = (IDWriteFontCollection *)family->collection; IDWriteFontCollection_AddRef(*collection); return S_OK; }
-static UINT32 WINAPI dwritefontfamily_GetFontCount(IDWriteFontFamily1 *iface) +static UINT32 WINAPI dwritefontfamily_GetFontCount(IDWriteFontFamily2 *iface) { - struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily1(iface); + struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily2(iface);
TRACE("%p.\n", iface);
return family->data->count; }
-static HRESULT WINAPI dwritefontfamily_GetFont(IDWriteFontFamily1 *iface, UINT32 index, IDWriteFont **font) +static HRESULT WINAPI dwritefontfamily_GetFont(IDWriteFontFamily2 *iface, UINT32 index, IDWriteFont **font) { - struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily1(iface); + struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily2(iface);
TRACE("%p, %u, %p.\n", iface, index, font);
@@ -2070,10 +2074,10 @@ static HRESULT WINAPI dwritefontfamily_GetFont(IDWriteFontFamily1 *iface, UINT32 return create_font(family, index, (IDWriteFont3 **)font); }
-static HRESULT WINAPI dwritefontfamily_GetFamilyNames(IDWriteFontFamily1 *iface, IDWriteLocalizedStrings **names) +static HRESULT WINAPI dwritefontfamily_GetFamilyNames(IDWriteFontFamily2 *iface, IDWriteLocalizedStrings **names) { - struct dwrite_fontfamily *This = impl_from_IDWriteFontFamily1(iface); - return clone_localizedstring(This->data->familyname, names); + struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily2(iface); + return clone_localizedstring(family->data->familyname, names); }
static BOOL is_better_font_match(const struct dwrite_font_propvec *next, const struct dwrite_font_propvec *cur, @@ -2117,10 +2121,10 @@ static BOOL is_better_font_match(const struct dwrite_font_propvec *next, const s return FALSE; }
-static HRESULT WINAPI dwritefontfamily_GetFirstMatchingFont(IDWriteFontFamily1 *iface, DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STRETCH stretch, DWRITE_FONT_STYLE style, IDWriteFont **font) +static HRESULT WINAPI dwritefontfamily_GetFirstMatchingFont(IDWriteFontFamily2 *iface, DWRITE_FONT_WEIGHT weight, + DWRITE_FONT_STRETCH stretch, DWRITE_FONT_STYLE style, IDWriteFont **font) { - struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily1(iface); + struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily2(iface); struct dwrite_font_propvec req; size_t i, match;
@@ -2178,10 +2182,10 @@ static void matchingfonts_sort(struct dwrite_fontlist *fonts, const struct dwrit }; }
-static HRESULT WINAPI dwritefontfamily_GetMatchingFonts(IDWriteFontFamily1 *iface, DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STRETCH stretch, DWRITE_FONT_STYLE style, IDWriteFontList **ret) +static HRESULT WINAPI dwritefontfamily_GetMatchingFonts(IDWriteFontFamily2 *iface, DWRITE_FONT_WEIGHT weight, + DWRITE_FONT_STRETCH stretch, DWRITE_FONT_STYLE style, IDWriteFontList **ret) { - struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily1(iface); + struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily2(iface); matching_filter_func func = NULL; struct dwrite_font_propvec req; struct dwrite_fontlist *fonts; @@ -2205,7 +2209,7 @@ static HRESULT WINAPI dwritefontfamily_GetMatchingFonts(IDWriteFontFamily1 *ifac fonts->IDWriteFontList1_iface.lpVtbl = &dwritefontlistvtbl; fonts->ref = 1; fonts->family = family; - IDWriteFontFamily1_AddRef(&fonts->family->IDWriteFontFamily1_iface); + IDWriteFontFamily2_AddRef(&fonts->family->IDWriteFontFamily2_iface); fonts->font_count = 0;
/* Normal style accepts Normal or Italic, Oblique and Italic - both Oblique and Italic styles */ @@ -2236,18 +2240,16 @@ static HRESULT WINAPI dwritefontfamily_GetMatchingFonts(IDWriteFontFamily1 *ifac return S_OK; }
-static DWRITE_LOCALITY WINAPI dwritefontfamily1_GetFontLocality(IDWriteFontFamily1 *iface, UINT32 index) +static DWRITE_LOCALITY WINAPI dwritefontfamily1_GetFontLocality(IDWriteFontFamily2 *iface, UINT32 index) { - struct dwrite_fontfamily *This = impl_from_IDWriteFontFamily1(iface); - - FIXME("(%p)->(%u): stub\n", This, index); + FIXME("%p, %u.\n", iface, index);
return DWRITE_LOCALITY_LOCAL; }
-static HRESULT WINAPI dwritefontfamily1_GetFont(IDWriteFontFamily1 *iface, UINT32 index, IDWriteFont3 **font) +static HRESULT WINAPI dwritefontfamily1_GetFont(IDWriteFontFamily2 *iface, UINT32 index, IDWriteFont3 **font) { - struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily1(iface); + struct dwrite_fontfamily *family = impl_from_IDWriteFontFamily2(iface);
TRACE("%p, %u, %p.\n", iface, index, font);
@@ -2262,18 +2264,17 @@ static HRESULT WINAPI dwritefontfamily1_GetFont(IDWriteFontFamily1 *iface, UINT3 return create_font(family, index, font); }
-static HRESULT WINAPI dwritefontfamily1_GetFontFaceReference(IDWriteFontFamily1 *iface, UINT32 index, - IDWriteFontFaceReference **reference) +static HRESULT WINAPI dwritefontfamily1_GetFontFaceReference(IDWriteFontFamily2 *iface, UINT32 index, + IDWriteFontFaceReference **reference) { - struct dwrite_fontfamily *This = impl_from_IDWriteFontFamily1(iface); IDWriteFont3 *font; HRESULT hr;
- TRACE("(%p)->(%u %p)\n", This, index, reference); + TRACE("%p, %u, %p.\n", iface, index, reference);
*reference = NULL;
- hr = IDWriteFontFamily1_GetFont(iface, index, &font); + hr = IDWriteFontFamily2_GetFont(iface, index, &font); if (FAILED(hr)) return hr;
@@ -2283,7 +2284,23 @@ static HRESULT WINAPI dwritefontfamily1_GetFontFaceReference(IDWriteFontFamily1 return hr; }
-static const IDWriteFontFamily1Vtbl fontfamilyvtbl = { +static HRESULT WINAPI dwritefontfamily2_GetMatchingFonts(IDWriteFontFamily2 *iface, + DWRITE_FONT_AXIS_VALUE const *axis_values, UINT32 num_values, IDWriteFontList2 **fontlist) +{ + FIXME("%p, %p, %u, %p.\n", iface, axis_values, num_values, fontlist); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dwritefontfamily2_GetFontSet(IDWriteFontFamily2 *iface, IDWriteFontSet1 **fontset) +{ + FIXME("%p, %p.\n", iface, fontset); + + return E_NOTIMPL; +} + +static const IDWriteFontFamily2Vtbl fontfamilyvtbl = +{ dwritefontfamily_QueryInterface, dwritefontfamily_AddRef, dwritefontfamily_Release, @@ -2295,63 +2312,65 @@ static const IDWriteFontFamily1Vtbl fontfamilyvtbl = { dwritefontfamily_GetMatchingFonts, dwritefontfamily1_GetFontLocality, dwritefontfamily1_GetFont, - dwritefontfamily1_GetFontFaceReference + dwritefontfamily1_GetFontFaceReference, + dwritefontfamily2_GetMatchingFonts, + dwritefontfamily2_GetFontSet, };
static HRESULT WINAPI dwritefontfamilylist_QueryInterface(IDWriteFontList1 *iface, REFIID riid, void **obj) { struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily_QueryInterface(&This->IDWriteFontFamily1_iface, riid, obj); + return dwritefontfamily_QueryInterface(&This->IDWriteFontFamily2_iface, riid, obj); }
static ULONG WINAPI dwritefontfamilylist_AddRef(IDWriteFontList1 *iface) { struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily_AddRef(&This->IDWriteFontFamily1_iface); + return dwritefontfamily_AddRef(&This->IDWriteFontFamily2_iface); }
static ULONG WINAPI dwritefontfamilylist_Release(IDWriteFontList1 *iface) { struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily_Release(&This->IDWriteFontFamily1_iface); + return dwritefontfamily_Release(&This->IDWriteFontFamily2_iface); }
static HRESULT WINAPI dwritefontfamilylist_GetFontCollection(IDWriteFontList1 *iface, IDWriteFontCollection **collection) { struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily_GetFontCollection(&This->IDWriteFontFamily1_iface, collection); + return dwritefontfamily_GetFontCollection(&This->IDWriteFontFamily2_iface, collection); }
static UINT32 WINAPI dwritefontfamilylist_GetFontCount(IDWriteFontList1 *iface) { struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily_GetFontCount(&This->IDWriteFontFamily1_iface); + return dwritefontfamily_GetFontCount(&This->IDWriteFontFamily2_iface); }
static HRESULT WINAPI dwritefontfamilylist_GetFont(IDWriteFontList1 *iface, UINT32 index, IDWriteFont **font) { struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily_GetFont(&This->IDWriteFontFamily1_iface, index, font); + return dwritefontfamily_GetFont(&This->IDWriteFontFamily2_iface, index, font); }
static DWRITE_LOCALITY WINAPI dwritefontfamilylist1_GetFontLocality(IDWriteFontList1 *iface, UINT32 index) { struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily1_GetFontLocality(&This->IDWriteFontFamily1_iface, index); + return dwritefontfamily1_GetFontLocality(&This->IDWriteFontFamily2_iface, index); }
static HRESULT WINAPI dwritefontfamilylist1_GetFont(IDWriteFontList1 *iface, UINT32 index, IDWriteFont3 **font) { struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily1_GetFont(&This->IDWriteFontFamily1_iface, index, font); + return dwritefontfamily1_GetFont(&This->IDWriteFontFamily2_iface, index, font); }
static HRESULT WINAPI dwritefontfamilylist1_GetFontFaceReference(IDWriteFontList1 *iface, UINT32 index, IDWriteFontFaceReference **reference) { struct dwrite_fontfamily *This = impl_family_from_IDWriteFontList1(iface); - return dwritefontfamily1_GetFontFaceReference(&This->IDWriteFontFamily1_iface, index, reference); + return dwritefontfamily1_GetFontFaceReference(&This->IDWriteFontFamily2_iface, index, reference); }
static const IDWriteFontList1Vtbl fontfamilylistvtbl = { @@ -2366,7 +2385,8 @@ static const IDWriteFontList1Vtbl fontfamilylistvtbl = { dwritefontfamilylist1_GetFontFaceReference, };
-static HRESULT create_fontfamily(struct dwrite_fontcollection *collection, UINT32 index, IDWriteFontFamily1 **family) +static HRESULT create_fontfamily(struct dwrite_fontcollection *collection, UINT32 index, + struct dwrite_fontfamily **family) { struct dwrite_fontfamily *object;
@@ -2376,15 +2396,15 @@ static HRESULT create_fontfamily(struct dwrite_fontcollection *collection, UINT3 if (!object) return E_OUTOFMEMORY;
- object->IDWriteFontFamily1_iface.lpVtbl = &fontfamilyvtbl; + object->IDWriteFontFamily2_iface.lpVtbl = &fontfamilyvtbl; object->IDWriteFontList1_iface.lpVtbl = &fontfamilylistvtbl; - object->ref = 1; + object->refcount = 1; object->collection = collection; IDWriteFontCollection3_AddRef(&collection->IDWriteFontCollection3_iface); object->data = collection->family_data[index]; InterlockedIncrement(&object->data->refcount);
- *family = &object->IDWriteFontFamily1_iface; + *family = object;
return S_OK; } @@ -2484,19 +2504,23 @@ static UINT32 WINAPI dwritefontcollection_GetFontFamilyCount(IDWriteFontCollecti }
static HRESULT WINAPI dwritefontcollection_GetFontFamily(IDWriteFontCollection3 *iface, UINT32 index, - IDWriteFontFamily **family) + IDWriteFontFamily **ret) { struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection3(iface); + struct dwrite_fontfamily *family; + HRESULT hr; + + TRACE("%p, %u, %p.\n", iface, index, ret);
- TRACE("%p, %u, %p.\n", iface, index, family); + *ret = NULL;
if (index >= collection->count) - { - *family = NULL; return E_FAIL; - }
- return create_fontfamily(collection, index, (IDWriteFontFamily1 **)family); + if (SUCCEEDED(hr = create_fontfamily(collection, index, &family))) + *ret = (IDWriteFontFamily *)&family->IDWriteFontFamily2_iface; + + return hr; }
static UINT32 collection_find_family(struct dwrite_fontcollection *collection, const WCHAR *name) @@ -2559,7 +2583,7 @@ static HRESULT WINAPI dwritefontcollection_GetFontFromFontFace(IDWriteFontCollec IDWriteFont **font) { struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection3(iface); - IDWriteFontFamily1 *family; + struct dwrite_fontfamily *family; BOOL found_font = FALSE; IDWriteFontFile *file; UINT32 face_index, count; @@ -2606,8 +2630,8 @@ static HRESULT WINAPI dwritefontcollection_GetFontFromFontFace(IDWriteFontCollec if (FAILED(hr)) return hr;
- hr = create_font(impl_from_IDWriteFontFamily1(family), j, (IDWriteFont3 **)font); - IDWriteFontFamily1_Release(family); + hr = create_font(family, j, (IDWriteFont3 **)font); + IDWriteFontFamily2_Release(&family->IDWriteFontFamily2_iface); return hr; }
@@ -2619,19 +2643,23 @@ static HRESULT WINAPI dwritefontcollection1_GetFontSet(IDWriteFontCollection3 *i }
static HRESULT WINAPI dwritefontcollection1_GetFontFamily(IDWriteFontCollection3 *iface, UINT32 index, - IDWriteFontFamily1 **family) + IDWriteFontFamily1 **ret) { struct dwrite_fontcollection *collection = impl_from_IDWriteFontCollection3(iface); + struct dwrite_fontfamily *family; + HRESULT hr;
- TRACE("%p, %u, %p.\n", iface, index, family); + TRACE("%p, %u, %p.\n", iface, index, ret); + + *ret = NULL;
if (index >= collection->count) - { - *family = NULL; return E_FAIL; - }
- return create_fontfamily(collection, index, family); + if (SUCCEEDED(hr = create_fontfamily(collection, index, &family))) + *ret = (IDWriteFontFamily1 *)&family->IDWriteFontFamily2_iface; + + return hr; }
static HRESULT WINAPI dwritefontcollection2_GetFontFamily(IDWriteFontCollection3 *iface,