From d04a54857cc84f881393e4bc794185650a302084 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 28 Mar 2016 13:33:57 +0300 Subject: [PATCH] dwrite: Update to IDWriteFactory3. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/dwrite/analyzer.c | 10 +- dlls/dwrite/dwrite_private.h | 16 +- dlls/dwrite/font.c | 36 ++--- dlls/dwrite/gdiinterop.c | 14 +- dlls/dwrite/layout.c | 18 +-- dlls/dwrite/main.c | 297 ++++++++++++++++++++++++----------- dlls/dwrite/tests/font.c | 3 +- 7 files changed, 253 insertions(+), 141 deletions(-) diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c index 29557a686d9..c7ef039f3d0 100644 --- a/dlls/dwrite/analyzer.c +++ b/dlls/dwrite/analyzer.c @@ -198,7 +198,7 @@ static const struct fallback_mapping fontfallback_neutral_data[] = { struct dwrite_fontfallback { IDWriteFontFallback IDWriteFontFallback_iface; - IDWriteFactory2 *factory; + IDWriteFactory3 *factory; IDWriteFontCollection *systemcollection; const struct fallback_mapping *mappings; UINT32 count; @@ -1748,14 +1748,14 @@ static ULONG WINAPI fontfallback_AddRef(IDWriteFontFallback *iface) { struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback(iface); TRACE("(%p)\n", fallback); - return IDWriteFactory2_AddRef(fallback->factory); + return IDWriteFactory3_AddRef(fallback->factory); } static ULONG WINAPI fontfallback_Release(IDWriteFontFallback *iface) { struct dwrite_fontfallback *fallback = impl_from_IDWriteFontFallback(iface); TRACE("(%p)\n", fallback); - return IDWriteFactory2_Release(fallback->factory); + return IDWriteFactory3_Release(fallback->factory); } static int compare_fallback_mapping(const void *a, const void *b) @@ -1931,7 +1931,7 @@ static const IDWriteFontFallbackVtbl fontfallbackvtbl = { fontfallback_MapCharacters }; -HRESULT create_system_fontfallback(IDWriteFactory2 *factory, IDWriteFontFallback **ret) +HRESULT create_system_fontfallback(IDWriteFactory3 *factory, IDWriteFontFallback **ret) { struct dwrite_fontfallback *fallback; @@ -1945,7 +1945,7 @@ HRESULT create_system_fontfallback(IDWriteFactory2 *factory, IDWriteFontFallback fallback->factory = factory; fallback->mappings = fontfallback_neutral_data; fallback->count = sizeof(fontfallback_neutral_data)/sizeof(fontfallback_neutral_data[0]); - IDWriteFactory2_GetSystemFontCollection(fallback->factory, &fallback->systemcollection, FALSE); + IDWriteFactory2_GetSystemFontCollection((IDWriteFactory2*)fallback->factory, &fallback->systemcollection, FALSE); *ret = &fallback->IDWriteFontFallback_iface; return S_OK; diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h index 0810a3ebc2d..5c8880a9381 100644 --- a/dlls/dwrite/dwrite_private.h +++ b/dlls/dwrite/dwrite_private.h @@ -115,24 +115,24 @@ extern HRESULT convert_fontface_to_logfont(IDWriteFontFace*, LOGFONTW*) DECLSPEC extern HRESULT create_numbersubstitution(DWRITE_NUMBER_SUBSTITUTION_METHOD,const WCHAR *locale,BOOL,IDWriteNumberSubstitution**) DECLSPEC_HIDDEN; extern HRESULT create_textformat(const WCHAR*,IDWriteFontCollection*,DWRITE_FONT_WEIGHT,DWRITE_FONT_STYLE,DWRITE_FONT_STRETCH, FLOAT,const WCHAR*,IDWriteTextFormat**) DECLSPEC_HIDDEN; -extern HRESULT create_textlayout(IDWriteFactory2*,const WCHAR*,UINT32,IDWriteTextFormat*,FLOAT,FLOAT,IDWriteTextLayout**) DECLSPEC_HIDDEN; -extern HRESULT create_gdicompat_textlayout(IDWriteFactory2*,const WCHAR*,UINT32,IDWriteTextFormat*,FLOAT,FLOAT,FLOAT, +extern HRESULT create_textlayout(IDWriteFactory3*,const WCHAR*,UINT32,IDWriteTextFormat*,FLOAT,FLOAT,IDWriteTextLayout**) DECLSPEC_HIDDEN; +extern HRESULT create_gdicompat_textlayout(IDWriteFactory3*,const WCHAR*,UINT32,IDWriteTextFormat*,FLOAT,FLOAT,FLOAT, const DWRITE_MATRIX*,BOOL,IDWriteTextLayout**) DECLSPEC_HIDDEN; -extern HRESULT create_trimmingsign(IDWriteFactory2*,IDWriteTextFormat*,IDWriteInlineObject**) DECLSPEC_HIDDEN; +extern HRESULT create_trimmingsign(IDWriteFactory3*,IDWriteTextFormat*,IDWriteInlineObject**) DECLSPEC_HIDDEN; extern HRESULT create_typography(IDWriteTypography**) DECLSPEC_HIDDEN; -extern HRESULT create_gdiinterop(IDWriteFactory2*,IDWriteGdiInterop**) DECLSPEC_HIDDEN; +extern HRESULT create_gdiinterop(IDWriteFactory3*,IDWriteGdiInterop**) DECLSPEC_HIDDEN; extern void release_gdiinterop(IDWriteGdiInterop*) DECLSPEC_HIDDEN; extern HRESULT create_localizedstrings(IDWriteLocalizedStrings**) DECLSPEC_HIDDEN; extern HRESULT add_localizedstring(IDWriteLocalizedStrings*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN; extern HRESULT clone_localizedstring(IDWriteLocalizedStrings *iface, IDWriteLocalizedStrings **strings) DECLSPEC_HIDDEN; extern void set_en_localizedstring(IDWriteLocalizedStrings*,const WCHAR*) DECLSPEC_HIDDEN; -extern HRESULT get_system_fontcollection(IDWriteFactory2*,IDWriteFontCollection**) DECLSPEC_HIDDEN; -extern HRESULT get_eudc_fontcollection(IDWriteFactory2*,IDWriteFontCollection**) DECLSPEC_HIDDEN; +extern HRESULT get_system_fontcollection(IDWriteFactory3*,IDWriteFontCollection**) DECLSPEC_HIDDEN; +extern HRESULT get_eudc_fontcollection(IDWriteFactory3*,IDWriteFontCollection**) DECLSPEC_HIDDEN; extern HRESULT get_textanalyzer(IDWriteTextAnalyzer**) DECLSPEC_HIDDEN; extern HRESULT create_font_file(IDWriteFontFileLoader *loader, const void *reference_key, UINT32 key_size, IDWriteFontFile **font_file) DECLSPEC_HIDDEN; extern HRESULT create_localfontfileloader(IDWriteLocalFontFileLoader** iface) DECLSPEC_HIDDEN; extern HRESULT create_fontface(DWRITE_FONT_FACE_TYPE,UINT32,IDWriteFontFile* const*,UINT32,DWRITE_FONT_SIMULATIONS,IDWriteFontFace3**) DECLSPEC_HIDDEN; -extern HRESULT create_font_collection(IDWriteFactory2*,IDWriteFontFileEnumerator*,BOOL,IDWriteFontCollection**) DECLSPEC_HIDDEN; +extern HRESULT create_font_collection(IDWriteFactory3*,IDWriteFontFileEnumerator*,BOOL,IDWriteFontCollection**) DECLSPEC_HIDDEN; extern HRESULT create_glyphrunanalysis(DWRITE_RENDERING_MODE,DWRITE_MEASURING_MODE,DWRITE_GLYPH_RUN const*,FLOAT,const DWRITE_MATRIX*, DWRITE_GRID_FIT_MODE,DWRITE_TEXT_ANTIALIAS_MODE,FLOAT,FLOAT,IDWriteGlyphRunAnalysis**) DECLSPEC_HIDDEN; extern BOOL is_system_collection(IDWriteFontCollection*) DECLSPEC_HIDDEN; @@ -143,7 +143,7 @@ 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(IDWriteFactory2*,IDWriteFontFallback**) DECLSPEC_HIDDEN; +extern HRESULT create_system_fontfallback(IDWriteFactory3*,IDWriteFontFallback**) DECLSPEC_HIDDEN; extern void release_system_fontfallback(IDWriteFontFallback*) 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/font.c b/dlls/dwrite/font.c index 32bd9bb8fae..4120cf6df24 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -82,7 +82,7 @@ struct dwrite_font_data { IDWriteLocalizedStrings *names; /* data needed to create fontface instance */ - IDWriteFactory2 *factory; + IDWriteFactory3 *factory; DWRITE_FONT_FACE_TYPE face_type; IDWriteFontFile *file; UINT32 face_index; @@ -390,7 +390,7 @@ static void release_font_data(struct dwrite_font_data *data) IDWriteLocalizedStrings_Release(data->names); IDWriteFontFile_Release(data->file); - IDWriteFactory2_Release(data->factory); + IDWriteFactory3_Release(data->factory); heap_free(data->facename); heap_free(data); } @@ -1211,7 +1211,7 @@ static HRESULT get_fontface_from_font(struct dwrite_font *font, IDWriteFontFace3 *fontface = NULL; - hr = IDWriteFactory2_CreateFontFace(data->factory, data->face_type, 1, &data->file, + hr = IDWriteFactory3_CreateFontFace(data->factory, data->face_type, 1, &data->file, data->face_index, font->data->simulations, &face); if (FAILED(hr)) return hr; @@ -3022,7 +3022,7 @@ static BOOL font_apply_differentiation_rules(struct dwrite_font_data *font, WCHA return TRUE; } -static HRESULT init_font_data(IDWriteFactory2 *factory, IDWriteFontFile *file, DWRITE_FONT_FACE_TYPE face_type, UINT32 face_index, +static HRESULT init_font_data(IDWriteFactory3 *factory, IDWriteFontFile *file, DWRITE_FONT_FACE_TYPE face_type, UINT32 face_index, IDWriteLocalizedStrings **family_name, struct dwrite_font_data **ret) { struct dwrite_font_props props; @@ -3051,7 +3051,7 @@ static HRESULT init_font_data(IDWriteFactory2 *factory, IDWriteFontFile *file, D data->bold_sim_tested = 0; data->oblique_sim_tested = 0; IDWriteFontFile_AddRef(file); - IDWriteFactory2_AddRef(factory); + IDWriteFactory3_AddRef(factory); opentype_get_font_properties(stream, face_type, face_index, &props); opentype_get_font_metrics(stream, face_type, face_index, &data->metrics, NULL); @@ -3103,7 +3103,7 @@ static HRESULT init_font_data_from_font(const struct dwrite_font_data *src, DWRI data->style = DWRITE_FONT_STYLE_OBLIQUE; memset(data->info_strings, 0, sizeof(data->info_strings)); data->names = NULL; - IDWriteFactory2_AddRef(data->factory); + IDWriteFactory3_AddRef(data->factory); IDWriteFontFile_AddRef(data->file); create_localizedstrings(&data->names); @@ -3359,7 +3359,7 @@ static void fontcollection_add_replacements(struct dwrite_fontcollection *collec RegCloseKey(hkey); } -HRESULT create_font_collection(IDWriteFactory2* factory, IDWriteFontFileEnumerator *enumerator, BOOL is_system, IDWriteFontCollection **ret) +HRESULT create_font_collection(IDWriteFactory3 *factory, IDWriteFontFileEnumerator *enumerator, BOOL is_system, IDWriteFontCollection **ret) { struct fontfile_enum { struct list entry; @@ -3493,7 +3493,7 @@ struct system_fontfile_enumerator IDWriteFontFileEnumerator IDWriteFontFileEnumerator_iface; LONG ref; - IDWriteFactory2 *factory; + IDWriteFactory3 *factory; HKEY hkey; int index; }; @@ -3528,7 +3528,7 @@ static ULONG WINAPI systemfontfileenumerator_Release(IDWriteFontFileEnumerator * ULONG ref = InterlockedDecrement(&enumerator->ref); if (!ref) { - IDWriteFactory2_Release(enumerator->factory); + IDWriteFactory3_Release(enumerator->factory); RegCloseKey(enumerator->hkey); heap_free(enumerator); } @@ -3536,7 +3536,7 @@ static ULONG WINAPI systemfontfileenumerator_Release(IDWriteFontFileEnumerator * return ref; } -static HRESULT create_local_file_reference(IDWriteFactory2 *factory, const WCHAR *filename, IDWriteFontFile **file) +static HRESULT create_local_file_reference(IDWriteFactory3 *factory, const WCHAR *filename, IDWriteFontFile **file) { HRESULT hr; @@ -3549,10 +3549,10 @@ static HRESULT create_local_file_reference(IDWriteFactory2 *factory, const WCHAR strcatW(fullpathW, fontsW); strcatW(fullpathW, filename); - hr = IDWriteFactory2_CreateFontFileReference(factory, fullpathW, NULL, file); + hr = IDWriteFactory3_CreateFontFileReference(factory, fullpathW, NULL, file); } else - hr = IDWriteFactory2_CreateFontFileReference(factory, filename, NULL, file); + hr = IDWriteFactory3_CreateFontFileReference(factory, filename, NULL, file); return hr; } @@ -3640,7 +3640,7 @@ static const struct IDWriteFontFileEnumeratorVtbl systemfontfileenumeratorvtbl = systemfontfileenumerator_GetCurrentFontFile }; -static HRESULT create_system_fontfile_enumerator(IDWriteFactory2 *factory, IDWriteFontFileEnumerator **ret) +static HRESULT create_system_fontfile_enumerator(IDWriteFactory3 *factory, IDWriteFontFileEnumerator **ret) { struct system_fontfile_enumerator *enumerator; static const WCHAR fontslistW[] = { @@ -3659,11 +3659,11 @@ static HRESULT create_system_fontfile_enumerator(IDWriteFactory2 *factory, IDWri enumerator->ref = 1; enumerator->factory = factory; enumerator->index = -1; - IDWriteFactory2_AddRef(factory); + IDWriteFactory3_AddRef(factory); if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, fontslistW, 0, GENERIC_READ, &enumerator->hkey)) { ERR("failed to open fonts list key\n"); - IDWriteFactory2_Release(factory); + IDWriteFactory3_Release(factory); heap_free(enumerator); return E_FAIL; } @@ -3673,7 +3673,7 @@ static HRESULT create_system_fontfile_enumerator(IDWriteFactory2 *factory, IDWri return S_OK; } -HRESULT get_system_fontcollection(IDWriteFactory2 *factory, IDWriteFontCollection **collection) +HRESULT get_system_fontcollection(IDWriteFactory3 *factory, IDWriteFontCollection **collection) { IDWriteFontFileEnumerator *enumerator; HRESULT hr; @@ -3690,7 +3690,7 @@ HRESULT get_system_fontcollection(IDWriteFactory2 *factory, IDWriteFontCollectio return hr; } -static HRESULT eudc_collection_add_family(IDWriteFactory2 *factory, struct dwrite_fontcollection *collection, +static HRESULT eudc_collection_add_family(IDWriteFactory3 *factory, struct dwrite_fontcollection *collection, const WCHAR *keynameW, const WCHAR *pathW) { static const WCHAR defaultfontW[] = {'S','y','s','t','e','m','D','e','f','a','u','l','t','E','U','D','C','F','o','n','t',0}; @@ -3760,7 +3760,7 @@ static HRESULT eudc_collection_add_family(IDWriteFactory2 *factory, struct dwrit return hr; } -HRESULT get_eudc_fontcollection(IDWriteFactory2 *factory, IDWriteFontCollection **ret) +HRESULT get_eudc_fontcollection(IDWriteFactory3 *factory, IDWriteFontCollection **ret) { static const WCHAR eudckeyfmtW[] = {'E','U','D','C','\\','%','u',0}; struct dwrite_fontcollection *collection; diff --git a/dlls/dwrite/gdiinterop.c b/dlls/dwrite/gdiinterop.c index dcc2f7abb22..3585cd73873 100644 --- a/dlls/dwrite/gdiinterop.c +++ b/dlls/dwrite/gdiinterop.c @@ -34,7 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dwrite); struct gdiinterop { IDWriteGdiInterop IDWriteGdiInterop_iface; - IDWriteFactory2 *factory; + IDWriteFactory3 *factory; }; struct dib_data { @@ -605,14 +605,14 @@ static ULONG WINAPI gdiinterop_AddRef(IDWriteGdiInterop *iface) { struct gdiinterop *This = impl_from_IDWriteGdiInterop(iface); TRACE("(%p)\n", This); - return IDWriteFactory2_AddRef(This->factory); + return IDWriteFactory3_AddRef(This->factory); } static ULONG WINAPI gdiinterop_Release(IDWriteGdiInterop *iface) { struct gdiinterop *This = impl_from_IDWriteGdiInterop(iface); TRACE("(%p)\n", This); - return IDWriteFactory2_Release(This->factory); + return IDWriteFactory3_Release(This->factory); } static HRESULT WINAPI gdiinterop_CreateFontFromLOGFONT(IDWriteGdiInterop *iface, @@ -632,7 +632,7 @@ static HRESULT WINAPI gdiinterop_CreateFontFromLOGFONT(IDWriteGdiInterop *iface, if (!logfont) return E_INVALIDARG; - hr = IDWriteFactory2_GetSystemFontCollection(This->factory, &collection, FALSE); + hr = IDWriteFactory2_GetSystemFontCollection((IDWriteFactory2*)This->factory, &collection, FALSE); if (FAILED(hr)) { ERR("failed to get system font collection: 0x%08x.\n", hr); return hr; @@ -847,7 +847,7 @@ static HRESULT WINAPI gdiinterop_CreateFontFaceFromHdc(IDWriteGdiInterop *iface, return E_FAIL; } - hr = IDWriteFactory2_CreateFontFileReference(This->factory, fileinfo->path, &fileinfo->writetime, + hr = IDWriteFactory3_CreateFontFileReference(This->factory, fileinfo->path, &fileinfo->writetime, &file); heap_free(fileinfo); if (FAILED(hr)) @@ -861,7 +861,7 @@ static HRESULT WINAPI gdiinterop_CreateFontFaceFromHdc(IDWriteGdiInterop *iface, } /* Simulations flags values match DWRITE_FONT_SIMULATIONS */ - hr = IDWriteFactory2_CreateFontFace(This->factory, facetype, 1, &file, info.face_index, info.simulations, + hr = IDWriteFactory3_CreateFontFace(This->factory, facetype, 1, &file, info.face_index, info.simulations, fontface); IDWriteFontFile_Release(file); return hr; @@ -886,7 +886,7 @@ static const struct IDWriteGdiInteropVtbl gdiinteropvtbl = { gdiinterop_CreateBitmapRenderTarget }; -HRESULT create_gdiinterop(IDWriteFactory2 *factory, IDWriteGdiInterop **ret) +HRESULT create_gdiinterop(IDWriteFactory3 *factory, IDWriteGdiInterop **ret) { struct gdiinterop *This; diff --git a/dlls/dwrite/layout.c b/dlls/dwrite/layout.c index 38b5e32de57..1c14681ec96 100644 --- a/dlls/dwrite/layout.c +++ b/dlls/dwrite/layout.c @@ -238,7 +238,7 @@ struct dwrite_textlayout { IDWriteTextAnalysisSource1 IDWriteTextAnalysisSource1_iface; LONG ref; - IDWriteFactory2 *factory; + IDWriteFactory3 *factory; WCHAR *str; UINT32 len; @@ -781,7 +781,7 @@ static HRESULT layout_compute_runs(struct dwrite_textlayout *layout) IDWriteFontFallback_AddRef(fallback); } else { - hr = IDWriteFactory2_GetSystemFontFallback(layout->factory, &fallback); + hr = IDWriteFactory3_GetSystemFontFallback(layout->factory, &fallback); if (FAILED(hr)) return hr; } @@ -2599,7 +2599,7 @@ static ULONG WINAPI dwritetextlayout_Release(IDWriteTextLayout3 *iface) TRACE("(%p)->(%d)\n", This, ref); if (!ref) { - IDWriteFactory2_Release(This->factory); + IDWriteFactory3_Release(This->factory); free_layout_ranges_list(This); free_layout_eruns(This); free_layout_runs(This); @@ -4441,7 +4441,7 @@ static HRESULT layout_format_from_textformat(struct dwrite_textlayout *layout, I return IDWriteTextFormat_GetFontCollection(format, &layout->format.collection); } -static HRESULT init_textlayout(IDWriteFactory2 *factory, const WCHAR *str, UINT32 len, IDWriteTextFormat *format, +static HRESULT init_textlayout(IDWriteFactory3 *factory, const WCHAR *str, UINT32 len, IDWriteTextFormat *format, FLOAT maxwidth, FLOAT maxheight, struct dwrite_textlayout *layout) { struct layout_range_header *range, *strike, *underline, *effect, *spacing, *typography; @@ -4511,7 +4511,7 @@ static HRESULT init_textlayout(IDWriteFactory2 *factory, const WCHAR *str, UINT3 } layout->factory = factory; - IDWriteFactory2_AddRef(layout->factory); + IDWriteFactory3_AddRef(layout->factory); list_add_head(&layout->ranges, &range->entry); list_add_head(&layout->strike_ranges, &strike->entry); list_add_head(&layout->underline_ranges, &underline->entry); @@ -4525,7 +4525,7 @@ fail: return hr; } -HRESULT create_textlayout(IDWriteFactory2 *factory, const WCHAR *str, UINT32 len, IDWriteTextFormat *format, +HRESULT create_textlayout(IDWriteFactory3 *factory, const WCHAR *str, UINT32 len, IDWriteTextFormat *format, FLOAT maxwidth, FLOAT maxheight, IDWriteTextLayout **ret) { struct dwrite_textlayout *layout; @@ -4546,7 +4546,7 @@ HRESULT create_textlayout(IDWriteFactory2 *factory, const WCHAR *str, UINT32 len return hr; } -HRESULT create_gdicompat_textlayout(IDWriteFactory2 *factory, const WCHAR *str, UINT32 len, IDWriteTextFormat *format, +HRESULT create_gdicompat_textlayout(IDWriteFactory3 *factory, const WCHAR *str, UINT32 len, IDWriteTextFormat *format, FLOAT maxwidth, FLOAT maxheight, FLOAT ppdip, const DWRITE_MATRIX *transform, BOOL use_gdi_natural, IDWriteTextLayout **ret) { struct dwrite_textlayout *layout; @@ -4701,7 +4701,7 @@ static inline BOOL is_flow_direction_vert(DWRITE_FLOW_DIRECTION direction) (direction == DWRITE_FLOW_DIRECTION_BOTTOM_TO_TOP); } -HRESULT create_trimmingsign(IDWriteFactory2 *factory, IDWriteTextFormat *format, IDWriteInlineObject **sign) +HRESULT create_trimmingsign(IDWriteFactory3 *factory, IDWriteTextFormat *format, IDWriteInlineObject **sign) { static const WCHAR ellipsisW = 0x2026; struct dwrite_trimmingsign *This; @@ -4727,7 +4727,7 @@ HRESULT create_trimmingsign(IDWriteFactory2 *factory, IDWriteTextFormat *format, This->IDWriteInlineObject_iface.lpVtbl = &dwritetrimmingsignvtbl; This->ref = 1; - hr = IDWriteFactory2_CreateTextLayout(factory, &ellipsisW, 1, format, 0.0f, 0.0f, &This->layout); + hr = IDWriteFactory3_CreateTextLayout(factory, &ellipsisW, 1, format, 0.0f, 0.0f, &This->layout); if (FAILED(hr)) { heap_free(This); return hr; diff --git a/dlls/dwrite/main.c b/dlls/dwrite/main.c index b82a4b07b69..a612261b611 100644 --- a/dlls/dwrite/main.c +++ b/dlls/dwrite/main.c @@ -34,8 +34,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dwrite); -static IDWriteFactory2 *shared_factory; -static void release_shared_factory(IDWriteFactory2*); +static IDWriteFactory3 *shared_factory; +static void release_shared_factory(IDWriteFactory3*); BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved) { @@ -506,7 +506,7 @@ struct fileloader }; struct dwritefactory { - IDWriteFactory2 IDWriteFactory2_iface; + IDWriteFactory3 IDWriteFactory3_iface; LONG ref; IDWriteFontCollection *system_collection; @@ -521,14 +521,14 @@ struct dwritefactory { struct list file_loaders; }; -static inline struct dwritefactory *impl_from_IDWriteFactory2(IDWriteFactory2 *iface) +static inline struct dwritefactory *impl_from_IDWriteFactory3(IDWriteFactory3 *iface) { - return CONTAINING_RECORD(iface, struct dwritefactory, IDWriteFactory2_iface); + return CONTAINING_RECORD(iface, struct dwritefactory, IDWriteFactory3_iface); } -void notify_factory_fallback_removed(IDWriteFactory2 *iface) +void notify_factory_fallback_removed(IDWriteFactory3 *iface) { - struct dwritefactory *factory = impl_from_IDWriteFactory2(iface); + struct dwritefactory *factory = impl_from_IDWriteFactory3(iface); factory->fallback = NULL; } @@ -579,11 +579,11 @@ static void release_dwritefactory(struct dwritefactory *factory) heap_free(factory); } -static void release_shared_factory(IDWriteFactory2 *iface) +static void release_shared_factory(IDWriteFactory3 *iface) { struct dwritefactory *factory; if (!iface) return; - factory = impl_from_IDWriteFactory2(iface); + factory = impl_from_IDWriteFactory3(iface); release_dwritefactory(factory); } @@ -615,19 +615,20 @@ static struct collectionloader *factory_get_collection_loader(struct dwritefacto return found; } -static HRESULT WINAPI dwritefactory_QueryInterface(IDWriteFactory2 *iface, REFIID riid, void **obj) +static HRESULT WINAPI dwritefactory_QueryInterface(IDWriteFactory3 *iface, REFIID riid, void **obj) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); - if (IsEqualIID(riid, &IID_IDWriteFactory2) || + if (IsEqualIID(riid, &IID_IDWriteFactory3) || + IsEqualIID(riid, &IID_IDWriteFactory2) || IsEqualIID(riid, &IID_IDWriteFactory1) || IsEqualIID(riid, &IID_IDWriteFactory) || IsEqualIID(riid, &IID_IUnknown)) { *obj = iface; - IDWriteFactory2_AddRef(iface); + IDWriteFactory3_AddRef(iface); return S_OK; } @@ -636,17 +637,17 @@ static HRESULT WINAPI dwritefactory_QueryInterface(IDWriteFactory2 *iface, REFII return E_NOINTERFACE; } -static ULONG WINAPI dwritefactory_AddRef(IDWriteFactory2 *iface) +static ULONG WINAPI dwritefactory_AddRef(IDWriteFactory3 *iface) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("(%p)->(%d)\n", This, ref); return ref; } -static ULONG WINAPI dwritefactory_Release(IDWriteFactory2 *iface) +static ULONG WINAPI dwritefactory_Release(IDWriteFactory3 *iface) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p)->(%d)\n", This, ref); @@ -657,11 +658,11 @@ static ULONG WINAPI dwritefactory_Release(IDWriteFactory2 *iface) return ref; } -static HRESULT WINAPI dwritefactory_GetSystemFontCollection(IDWriteFactory2 *iface, +static HRESULT WINAPI dwritefactory_GetSystemFontCollection(IDWriteFactory3 *iface, IDWriteFontCollection **collection, BOOL check_for_updates) { HRESULT hr = S_OK; - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)->(%p %d)\n", This, collection, check_for_updates); if (check_for_updates) @@ -678,10 +679,10 @@ static HRESULT WINAPI dwritefactory_GetSystemFontCollection(IDWriteFactory2 *ifa return hr; } -static HRESULT WINAPI dwritefactory_CreateCustomFontCollection(IDWriteFactory2 *iface, +static HRESULT WINAPI dwritefactory_CreateCustomFontCollection(IDWriteFactory3 *iface, IDWriteFontCollectionLoader *loader, void const *key, UINT32 key_size, IDWriteFontCollection **collection) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); IDWriteFontFileEnumerator *enumerator; struct collectionloader *found; HRESULT hr; @@ -706,10 +707,10 @@ static HRESULT WINAPI dwritefactory_CreateCustomFontCollection(IDWriteFactory2 * return hr; } -static HRESULT WINAPI dwritefactory_RegisterFontCollectionLoader(IDWriteFactory2 *iface, +static HRESULT WINAPI dwritefactory_RegisterFontCollectionLoader(IDWriteFactory3 *iface, IDWriteFontCollectionLoader *loader) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); struct collectionloader *entry; TRACE("(%p)->(%p)\n", This, loader); @@ -731,10 +732,10 @@ static HRESULT WINAPI dwritefactory_RegisterFontCollectionLoader(IDWriteFactory2 return S_OK; } -static HRESULT WINAPI dwritefactory_UnregisterFontCollectionLoader(IDWriteFactory2 *iface, +static HRESULT WINAPI dwritefactory_UnregisterFontCollectionLoader(IDWriteFactory3 *iface, IDWriteFontCollectionLoader *loader) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); struct collectionloader *found; TRACE("(%p)->(%p)\n", This, loader); @@ -753,10 +754,10 @@ static HRESULT WINAPI dwritefactory_UnregisterFontCollectionLoader(IDWriteFactor return S_OK; } -static HRESULT WINAPI dwritefactory_CreateFontFileReference(IDWriteFactory2 *iface, +static HRESULT WINAPI dwritefactory_CreateFontFileReference(IDWriteFactory3 *iface, WCHAR const *path, FILETIME const *writetime, IDWriteFontFile **font_file) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); UINT32 key_size; HRESULT hr; void *key; @@ -781,10 +782,10 @@ static HRESULT WINAPI dwritefactory_CreateFontFileReference(IDWriteFactory2 *ifa return hr; } -static HRESULT WINAPI dwritefactory_CreateCustomFontFileReference(IDWriteFactory2 *iface, +static HRESULT WINAPI dwritefactory_CreateCustomFontFileReference(IDWriteFactory3 *iface, void const *reference_key, UINT32 key_size, IDWriteFontFileLoader *loader, IDWriteFontFile **font_file) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)->(%p %u %p %p)\n", This, reference_key, key_size, loader, font_file); @@ -796,11 +797,11 @@ static HRESULT WINAPI dwritefactory_CreateCustomFontFileReference(IDWriteFactory return create_font_file(loader, reference_key, key_size, font_file); } -static HRESULT WINAPI dwritefactory_CreateFontFace(IDWriteFactory2 *iface, +static HRESULT WINAPI dwritefactory_CreateFontFace(IDWriteFactory3 *iface, DWRITE_FONT_FACE_TYPE req_facetype, UINT32 files_number, IDWriteFontFile* const* font_files, UINT32 index, DWRITE_FONT_SIMULATIONS simulations, IDWriteFontFace **font_face) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); DWRITE_FONT_FILE_TYPE file_type; DWRITE_FONT_FACE_TYPE face_type; IDWriteFontFileLoader *loader; @@ -906,9 +907,9 @@ static HRESULT WINAPI dwritefactory_CreateFontFace(IDWriteFactory2 *iface, return S_OK; } -static HRESULT WINAPI dwritefactory_CreateRenderingParams(IDWriteFactory2 *iface, IDWriteRenderingParams **params) +static HRESULT WINAPI dwritefactory_CreateRenderingParams(IDWriteFactory3 *iface, IDWriteRenderingParams **params) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); HMONITOR monitor; POINT pt; @@ -916,13 +917,13 @@ static HRESULT WINAPI dwritefactory_CreateRenderingParams(IDWriteFactory2 *iface pt.x = pt.y = 0; monitor = MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY); - return IDWriteFactory2_CreateMonitorRenderingParams(iface, monitor, params); + return IDWriteFactory3_CreateMonitorRenderingParams(iface, monitor, params); } -static HRESULT WINAPI dwritefactory_CreateMonitorRenderingParams(IDWriteFactory2 *iface, HMONITOR monitor, +static HRESULT WINAPI dwritefactory_CreateMonitorRenderingParams(IDWriteFactory3 *iface, HMONITOR monitor, IDWriteRenderingParams **params) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); IDWriteRenderingParams2 *params2; static int fixme_once = 0; HRESULT hr; @@ -932,30 +933,30 @@ static HRESULT WINAPI dwritefactory_CreateMonitorRenderingParams(IDWriteFactory2 if (!fixme_once++) FIXME("(%p): monitor setting ignored\n", monitor); - hr = IDWriteFactory2_CreateCustomRenderingParams(iface, 0.0f, 0.0f, 1.0f, 0.0f, DWRITE_PIXEL_GEOMETRY_FLAT, DWRITE_RENDERING_MODE_DEFAULT, + hr = IDWriteFactory2_CreateCustomRenderingParams((IDWriteFactory2*)iface, 0.0f, 0.0f, 1.0f, 0.0f, DWRITE_PIXEL_GEOMETRY_FLAT, DWRITE_RENDERING_MODE_DEFAULT, DWRITE_GRID_FIT_MODE_DEFAULT, ¶ms2); *params = (IDWriteRenderingParams*)params2; return hr; } -static HRESULT WINAPI dwritefactory_CreateCustomRenderingParams(IDWriteFactory2 *iface, FLOAT gamma, FLOAT enhancedContrast, +static HRESULT WINAPI dwritefactory_CreateCustomRenderingParams(IDWriteFactory3 *iface, FLOAT gamma, FLOAT enhancedContrast, FLOAT cleartype_level, DWRITE_PIXEL_GEOMETRY geometry, DWRITE_RENDERING_MODE mode, IDWriteRenderingParams **params) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); IDWriteRenderingParams2 *params2; HRESULT hr; TRACE("(%p)->(%f %f %f %d %d %p)\n", This, gamma, enhancedContrast, cleartype_level, geometry, mode, params); - hr = IDWriteFactory2_CreateCustomRenderingParams(iface, gamma, enhancedContrast, 1.0f, cleartype_level, geometry, + hr = IDWriteFactory2_CreateCustomRenderingParams((IDWriteFactory2*)iface, gamma, enhancedContrast, 1.0f, cleartype_level, geometry, mode, DWRITE_GRID_FIT_MODE_DEFAULT, ¶ms2); *params = (IDWriteRenderingParams*)params2; return hr; } -static HRESULT WINAPI dwritefactory_RegisterFontFileLoader(IDWriteFactory2 *iface, IDWriteFontFileLoader *loader) +static HRESULT WINAPI dwritefactory_RegisterFontFileLoader(IDWriteFactory3 *iface, IDWriteFontFileLoader *loader) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); struct fileloader *entry; TRACE("(%p)->(%p)\n", This, loader); @@ -981,9 +982,9 @@ static HRESULT WINAPI dwritefactory_RegisterFontFileLoader(IDWriteFactory2 *ifac return S_OK; } -static HRESULT WINAPI dwritefactory_UnregisterFontFileLoader(IDWriteFactory2 *iface, IDWriteFontFileLoader *loader) +static HRESULT WINAPI dwritefactory_UnregisterFontFileLoader(IDWriteFactory3 *iface, IDWriteFontFileLoader *loader) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); struct fileloader *found; TRACE("(%p)->(%p)\n", This, loader); @@ -1002,11 +1003,11 @@ static HRESULT WINAPI dwritefactory_UnregisterFontFileLoader(IDWriteFactory2 *if return S_OK; } -static HRESULT WINAPI dwritefactory_CreateTextFormat(IDWriteFactory2 *iface, WCHAR const* family_name, +static HRESULT WINAPI dwritefactory_CreateTextFormat(IDWriteFactory3 *iface, WCHAR const* family_name, IDWriteFontCollection *collection, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STYLE style, DWRITE_FONT_STRETCH stretch, FLOAT size, WCHAR const *locale, IDWriteTextFormat **format) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); IDWriteFontCollection *syscollection = NULL; HRESULT hr; @@ -1014,7 +1015,7 @@ static HRESULT WINAPI dwritefactory_CreateTextFormat(IDWriteFactory2 *iface, WCH size, debugstr_w(locale), format); if (!collection) { - hr = IDWriteFactory2_GetSystemFontCollection(iface, &syscollection, FALSE); + hr = IDWriteFactory2_GetSystemFontCollection((IDWriteFactory2*)iface, &syscollection, FALSE); if (FAILED(hr)) return hr; } @@ -1025,16 +1026,16 @@ static HRESULT WINAPI dwritefactory_CreateTextFormat(IDWriteFactory2 *iface, WCH return hr; } -static HRESULT WINAPI dwritefactory_CreateTypography(IDWriteFactory2 *iface, IDWriteTypography **typography) +static HRESULT WINAPI dwritefactory_CreateTypography(IDWriteFactory3 *iface, IDWriteTypography **typography) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)->(%p)\n", This, typography); return create_typography(typography); } -static HRESULT WINAPI dwritefactory_GetGdiInterop(IDWriteFactory2 *iface, IDWriteGdiInterop **gdi_interop) +static HRESULT WINAPI dwritefactory_GetGdiInterop(IDWriteFactory3 *iface, IDWriteGdiInterop **gdi_interop) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)->(%p)\n", This, gdi_interop); @@ -1052,21 +1053,21 @@ static HRESULT WINAPI dwritefactory_GetGdiInterop(IDWriteFactory2 *iface, IDWrit return S_OK; } -static HRESULT WINAPI dwritefactory_CreateTextLayout(IDWriteFactory2 *iface, WCHAR const* string, +static HRESULT WINAPI dwritefactory_CreateTextLayout(IDWriteFactory3 *iface, WCHAR const* string, UINT32 len, IDWriteTextFormat *format, FLOAT max_width, FLOAT max_height, IDWriteTextLayout **layout) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)->(%s:%u %p %f %f %p)\n", This, debugstr_wn(string, len), len, format, max_width, max_height, layout); return create_textlayout(iface, string, len, format, max_width, max_height, layout); } -static HRESULT WINAPI dwritefactory_CreateGdiCompatibleTextLayout(IDWriteFactory2 *iface, WCHAR const* string, +static HRESULT WINAPI dwritefactory_CreateGdiCompatibleTextLayout(IDWriteFactory3 *iface, WCHAR const* string, UINT32 len, IDWriteTextFormat *format, FLOAT layout_width, FLOAT layout_height, FLOAT pixels_per_dip, DWRITE_MATRIX const* transform, BOOL use_gdi_natural, IDWriteTextLayout **layout) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)->(%s:%u %p %f %f %f %p %d %p)\n", This, debugstr_wn(string, len), len, format, layout_width, layout_height, pixels_per_dip, transform, use_gdi_natural, layout); @@ -1075,34 +1076,34 @@ static HRESULT WINAPI dwritefactory_CreateGdiCompatibleTextLayout(IDWriteFactory use_gdi_natural, layout); } -static HRESULT WINAPI dwritefactory_CreateEllipsisTrimmingSign(IDWriteFactory2 *iface, IDWriteTextFormat *format, +static HRESULT WINAPI dwritefactory_CreateEllipsisTrimmingSign(IDWriteFactory3 *iface, IDWriteTextFormat *format, IDWriteInlineObject **trimming_sign) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)->(%p %p)\n", This, format, trimming_sign); return create_trimmingsign(iface, format, trimming_sign); } -static HRESULT WINAPI dwritefactory_CreateTextAnalyzer(IDWriteFactory2 *iface, IDWriteTextAnalyzer **analyzer) +static HRESULT WINAPI dwritefactory_CreateTextAnalyzer(IDWriteFactory3 *iface, IDWriteTextAnalyzer **analyzer) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)->(%p)\n", This, analyzer); return get_textanalyzer(analyzer); } -static HRESULT WINAPI dwritefactory_CreateNumberSubstitution(IDWriteFactory2 *iface, DWRITE_NUMBER_SUBSTITUTION_METHOD method, +static HRESULT WINAPI dwritefactory_CreateNumberSubstitution(IDWriteFactory3 *iface, DWRITE_NUMBER_SUBSTITUTION_METHOD method, WCHAR const* locale, BOOL ignore_user_override, IDWriteNumberSubstitution **substitution) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)->(%d %s %d %p)\n", This, method, debugstr_w(locale), ignore_user_override, substitution); return create_numbersubstitution(method, locale, ignore_user_override, substitution); } -static HRESULT WINAPI dwritefactory_CreateGlyphRunAnalysis(IDWriteFactory2 *iface, DWRITE_GLYPH_RUN const *run, +static HRESULT WINAPI dwritefactory_CreateGlyphRunAnalysis(IDWriteFactory3 *iface, DWRITE_GLYPH_RUN const *run, FLOAT ppdip, DWRITE_MATRIX const* transform, DWRITE_RENDERING_MODE rendering_mode, DWRITE_MEASURING_MODE measuring_mode, FLOAT originX, FLOAT originY, IDWriteGlyphRunAnalysis **analysis) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)->(%p %.2f %p %d %d %.2f %.2f %p)\n", This, run, ppdip, transform, rendering_mode, measuring_mode, originX, originY, analysis); @@ -1116,10 +1117,10 @@ static HRESULT WINAPI dwritefactory_CreateGlyphRunAnalysis(IDWriteFactory2 *ifac DWRITE_TEXT_ANTIALIAS_MODE_CLEARTYPE, originX, originY, analysis); } -static HRESULT WINAPI dwritefactory1_GetEudcFontCollection(IDWriteFactory2 *iface, IDWriteFontCollection **collection, +static HRESULT WINAPI dwritefactory1_GetEudcFontCollection(IDWriteFactory3 *iface, IDWriteFontCollection **collection, BOOL check_for_updates) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); HRESULT hr = S_OK; TRACE("(%p)->(%p %d)\n", This, collection, check_for_updates); @@ -1138,25 +1139,25 @@ static HRESULT WINAPI dwritefactory1_GetEudcFontCollection(IDWriteFactory2 *ifac return hr; } -static HRESULT WINAPI dwritefactory1_CreateCustomRenderingParams(IDWriteFactory2 *iface, FLOAT gamma, +static HRESULT WINAPI dwritefactory1_CreateCustomRenderingParams(IDWriteFactory3 *iface, FLOAT gamma, FLOAT enhcontrast, FLOAT enhcontrast_grayscale, FLOAT cleartype_level, DWRITE_PIXEL_GEOMETRY geometry, DWRITE_RENDERING_MODE mode, IDWriteRenderingParams1** params) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); IDWriteRenderingParams2 *params2; HRESULT hr; TRACE("(%p)->(%.2f %.2f %.2f %.2f %d %d %p)\n", This, gamma, enhcontrast, enhcontrast_grayscale, cleartype_level, geometry, mode, params); - hr = IDWriteFactory2_CreateCustomRenderingParams(iface, gamma, enhcontrast, enhcontrast_grayscale, + hr = IDWriteFactory2_CreateCustomRenderingParams((IDWriteFactory2*)iface, gamma, enhcontrast, enhcontrast_grayscale, cleartype_level, geometry, mode, DWRITE_GRID_FIT_MODE_DEFAULT, ¶ms2); *params = (IDWriteRenderingParams1*)params2; return hr; } -static HRESULT WINAPI dwritefactory2_GetSystemFontFallback(IDWriteFactory2 *iface, IDWriteFontFallback **fallback) +static HRESULT WINAPI dwritefactory2_GetSystemFontFallback(IDWriteFactory3 *iface, IDWriteFontFallback **fallback) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)->(%p)\n", This, fallback); @@ -1173,39 +1174,39 @@ static HRESULT WINAPI dwritefactory2_GetSystemFontFallback(IDWriteFactory2 *ifac return S_OK; } -static HRESULT WINAPI dwritefactory2_CreateFontFallbackBuilder(IDWriteFactory2 *iface, IDWriteFontFallbackBuilder **fallbackbuilder) +static HRESULT WINAPI dwritefactory2_CreateFontFallbackBuilder(IDWriteFactory3 *iface, IDWriteFontFallbackBuilder **fallbackbuilder) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); FIXME("(%p)->(%p): stub\n", This, fallbackbuilder); return E_NOTIMPL; } -static HRESULT WINAPI dwritefactory2_TranslateColorGlyphRun(IDWriteFactory2 *iface, FLOAT originX, FLOAT originY, +static HRESULT WINAPI dwritefactory2_TranslateColorGlyphRun(IDWriteFactory3 *iface, FLOAT originX, FLOAT originY, const DWRITE_GLYPH_RUN *run, const DWRITE_GLYPH_RUN_DESCRIPTION *rundescr, DWRITE_MEASURING_MODE mode, const DWRITE_MATRIX *transform, UINT32 palette, IDWriteColorGlyphRunEnumerator **colorlayers) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)->(%.2f %.2f %p %p %d %p %u %p)\n", This, originX, originY, run, rundescr, mode, transform, palette, colorlayers); return create_colorglyphenum(originX, originY, run, rundescr, mode, transform, palette, colorlayers); } -static HRESULT WINAPI dwritefactory2_CreateCustomRenderingParams(IDWriteFactory2 *iface, FLOAT gamma, FLOAT contrast, +static HRESULT WINAPI dwritefactory2_CreateCustomRenderingParams(IDWriteFactory3 *iface, FLOAT gamma, FLOAT contrast, FLOAT grayscalecontrast, FLOAT cleartype_level, DWRITE_PIXEL_GEOMETRY geometry, DWRITE_RENDERING_MODE mode, DWRITE_GRID_FIT_MODE gridfit, IDWriteRenderingParams2 **params) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)->(%.2f %.2f %.2f %.2f %d %d %d %p)\n", This, gamma, contrast, grayscalecontrast, cleartype_level, geometry, mode, gridfit, params); return create_renderingparams(gamma, contrast, grayscalecontrast, cleartype_level, geometry, mode, gridfit, params); } -static HRESULT WINAPI dwritefactory2_CreateGlyphRunAnalysis(IDWriteFactory2 *iface, const DWRITE_GLYPH_RUN *run, +static HRESULT WINAPI dwritefactory2_CreateGlyphRunAnalysis(IDWriteFactory3 *iface, const DWRITE_GLYPH_RUN *run, const DWRITE_MATRIX *transform, DWRITE_RENDERING_MODE rendering_mode, DWRITE_MEASURING_MODE measuring_mode, DWRITE_GRID_FIT_MODE gridfit_mode, DWRITE_TEXT_ANTIALIAS_MODE aa_mode, FLOAT originX, FLOAT originY, IDWriteGlyphRunAnalysis **analysis) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)->(%p %p %d %d %d %d %.2f %.2f %p)\n", This, run, transform, rendering_mode, measuring_mode, gridfit_mode, aa_mode, originX, originY, analysis); @@ -1213,7 +1214,99 @@ static HRESULT WINAPI dwritefactory2_CreateGlyphRunAnalysis(IDWriteFactory2 *ifa return create_glyphrunanalysis(rendering_mode, measuring_mode, run, 1.0f, transform, gridfit_mode, aa_mode, originX, originY, analysis); } -static const struct IDWriteFactory2Vtbl dwritefactoryvtbl = { +static HRESULT WINAPI dwritefactory3_CreateGlyphRunAnalysis(IDWriteFactory3 *iface, DWRITE_GLYPH_RUN const *run, + DWRITE_MATRIX const *transform, DWRITE_RENDERING_MODE1 rendering_mode, DWRITE_MEASURING_MODE measuring_mode, + DWRITE_GRID_FIT_MODE gridfit_mode, DWRITE_TEXT_ANTIALIAS_MODE aa_mode, FLOAT originX, FLOAT originY, + IDWriteGlyphRunAnalysis **analysis) +{ + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); + + FIXME("(%p)->(%p %p %d %d %d %d %.2f %.2f %p): stub\n", This, run, transform, rendering_mode, measuring_mode, + gridfit_mode, aa_mode, originX, originY, analysis); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dwritefactory3_CreateCustomRenderingParams(IDWriteFactory3 *iface, FLOAT gamma, FLOAT contrast, + FLOAT grayscale_contrast, FLOAT cleartype_level, DWRITE_PIXEL_GEOMETRY pixel_geometry, DWRITE_RENDERING_MODE1 rendering_mode, + DWRITE_GRID_FIT_MODE gridfit_mode, IDWriteRenderingParams3 **params) +{ + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); + + FIXME("(%p)->(%.2f %.2f %.2f %.2f %d %d %d %p): stub\n", This, gamma, contrast, grayscale_contrast, cleartype_level, + pixel_geometry, rendering_mode, gridfit_mode, params); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dwritefactory3_CreateFontFaceReference(IDWriteFactory3 *iface, WCHAR const *path, FILETIME const *writetime, + UINT32 index, DWRITE_FONT_SIMULATIONS simulations, IDWriteFontFaceReference **reference) +{ + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); + + FIXME("(%p)->(%s %p %u %x, %p): stub\n", This, debugstr_w(path), writetime, index, simulations, reference); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dwritefactory3_CreateFontFaceReference_(IDWriteFactory3 *iface, IDWriteFontFile *file, UINT32 index, + DWRITE_FONT_SIMULATIONS simulations, IDWriteFontFaceReference **reference) +{ + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); + + FIXME("(%p)->(%p %u %x %p): stub\n", This, file, index, simulations, reference); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dwritefactory3_GetSystemFontSet(IDWriteFactory3 *iface, IDWriteFontSet **fontset) +{ + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); + + FIXME("(%p)->(%p): stub\n", This, fontset); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dwritefactory3_CreateFontSetBuilder(IDWriteFactory3 *iface, IDWriteFontSetBuilder **builder) +{ + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); + + FIXME("(%p)->(%p): stub\n", This, builder); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dwritefactory3_CreateFontCollectionFromFontSet(IDWriteFactory3 *iface, IDWriteFontSet *fontset, + IDWriteFontCollection1 **collection) +{ + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); + + FIXME("(%p)->(%p %p): stub\n", This, fontset, collection); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dwritefactory3_GetSystemFontCollection(IDWriteFactory3 *iface, BOOL include_downloadable, + IDWriteFontCollection1 **collection, BOOL check_for_updates) +{ + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); + + FIXME("(%p)->(%d %p %d): stub\n", This, include_downloadable, collection, check_for_updates); + + return E_NOTIMPL; +} + +static HRESULT WINAPI dwritefactory3_GetFontDownloadQueue(IDWriteFactory3 *iface, IDWriteFontDownloadQueue **queue) +{ + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); + + FIXME("(%p)->(%p): stub\n", This, queue); + + return E_NOTIMPL; +} + +static const struct IDWriteFactory3Vtbl dwritefactoryvtbl = { dwritefactory_QueryInterface, dwritefactory_AddRef, dwritefactory_Release, @@ -1244,24 +1337,33 @@ static const struct IDWriteFactory2Vtbl dwritefactoryvtbl = { dwritefactory2_CreateFontFallbackBuilder, dwritefactory2_TranslateColorGlyphRun, dwritefactory2_CreateCustomRenderingParams, - dwritefactory2_CreateGlyphRunAnalysis + dwritefactory2_CreateGlyphRunAnalysis, + dwritefactory3_CreateGlyphRunAnalysis, + dwritefactory3_CreateCustomRenderingParams, + dwritefactory3_CreateFontFaceReference, + dwritefactory3_CreateFontFaceReference_, + dwritefactory3_GetSystemFontSet, + dwritefactory3_CreateFontSetBuilder, + dwritefactory3_CreateFontCollectionFromFontSet, + dwritefactory3_GetSystemFontCollection, + dwritefactory3_GetFontDownloadQueue }; -static ULONG WINAPI shareddwritefactory_AddRef(IDWriteFactory2 *iface) +static ULONG WINAPI shareddwritefactory_AddRef(IDWriteFactory3 *iface) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)\n", This); return 2; } -static ULONG WINAPI shareddwritefactory_Release(IDWriteFactory2 *iface) +static ULONG WINAPI shareddwritefactory_Release(IDWriteFactory3 *iface) { - struct dwritefactory *This = impl_from_IDWriteFactory2(iface); + struct dwritefactory *This = impl_from_IDWriteFactory3(iface); TRACE("(%p)\n", This); return 1; } -static const struct IDWriteFactory2Vtbl shareddwritefactoryvtbl = { +static const struct IDWriteFactory3Vtbl shareddwritefactoryvtbl = { dwritefactory_QueryInterface, shareddwritefactory_AddRef, shareddwritefactory_Release, @@ -1292,12 +1394,21 @@ static const struct IDWriteFactory2Vtbl shareddwritefactoryvtbl = { dwritefactory2_CreateFontFallbackBuilder, dwritefactory2_TranslateColorGlyphRun, dwritefactory2_CreateCustomRenderingParams, - dwritefactory2_CreateGlyphRunAnalysis + dwritefactory2_CreateGlyphRunAnalysis, + dwritefactory3_CreateGlyphRunAnalysis, + dwritefactory3_CreateCustomRenderingParams, + dwritefactory3_CreateFontFaceReference, + dwritefactory3_CreateFontFaceReference_, + dwritefactory3_GetSystemFontSet, + dwritefactory3_CreateFontSetBuilder, + dwritefactory3_CreateFontCollectionFromFontSet, + dwritefactory3_GetSystemFontCollection, + dwritefactory3_GetFontDownloadQueue }; static void init_dwritefactory(struct dwritefactory *factory, DWRITE_FACTORY_TYPE type) { - factory->IDWriteFactory2_iface.lpVtbl = type == DWRITE_FACTORY_TYPE_SHARED ? &shareddwritefactoryvtbl : &dwritefactoryvtbl; + factory->IDWriteFactory3_iface.lpVtbl = type == DWRITE_FACTORY_TYPE_SHARED ? &shareddwritefactoryvtbl : &dwritefactoryvtbl; factory->ref = 1; factory->localfontfileloader = NULL; factory->system_collection = NULL; @@ -1320,7 +1431,7 @@ HRESULT WINAPI DWriteCreateFactory(DWRITE_FACTORY_TYPE type, REFIID riid, IUnkno *ret = NULL; if (type == DWRITE_FACTORY_TYPE_SHARED && shared_factory) - return IDWriteFactory2_QueryInterface(shared_factory, riid, (void**)ret); + return IDWriteFactory3_QueryInterface(shared_factory, riid, (void**)ret); factory = heap_alloc(sizeof(struct dwritefactory)); if (!factory) return E_OUTOFMEMORY; @@ -1328,12 +1439,12 @@ HRESULT WINAPI DWriteCreateFactory(DWRITE_FACTORY_TYPE type, REFIID riid, IUnkno init_dwritefactory(factory, type); if (type == DWRITE_FACTORY_TYPE_SHARED) - if (InterlockedCompareExchangePointer((void**)&shared_factory, &factory->IDWriteFactory2_iface, NULL)) { - release_shared_factory(&factory->IDWriteFactory2_iface); - return IDWriteFactory2_QueryInterface(shared_factory, riid, (void**)ret); + if (InterlockedCompareExchangePointer((void**)&shared_factory, &factory->IDWriteFactory3_iface, NULL)) { + release_shared_factory(&factory->IDWriteFactory3_iface); + return IDWriteFactory3_QueryInterface(shared_factory, riid, (void**)ret); } - hr = IDWriteFactory2_QueryInterface(&factory->IDWriteFactory2_iface, riid, (void**)ret); - IDWriteFactory2_Release(&factory->IDWriteFactory2_iface); + hr = IDWriteFactory3_QueryInterface(&factory->IDWriteFactory3_iface, riid, (void**)ret); + IDWriteFactory3_Release(&factory->IDWriteFactory3_iface); return hr; } diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 766df393309..9ba8b6dfd30 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -5425,13 +5425,14 @@ static void test_HasCharacter(void) ok(hr == S_OK, "got 0x%08x\n", hr); ret = IDWriteFont3_HasCharacter(font3, 'A'); + todo_wine ok(ret, "got %d\n", ret); IDWriteFont3_Release(font3); IDWriteFactory3_Release(factory3); } else - skip("IDWriteFont3 is not supported.\n"); + win_skip("IDWriteFont3 is not supported.\n"); IDWriteFont_Release(font); IDWriteFactory_Release(factory);