Commit d04a5485 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Update to IDWriteFactory3.

parent 7c6dcab7
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment