dwrite: Added IDWriteGdiInterop stub.
[wine/multimedia.git] / dlls / dwrite / main.c
blobca7de8e0f980722d5baa01f05ead8a7c4be19a11
1 /*
2 * DWrite
4 * Copyright 2012 Nikolay Sivov for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #include "windef.h"
24 #include "winbase.h"
26 #include "initguid.h"
27 #include "dwrite.h"
29 #include "dwrite_private.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
34 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, LPVOID reserved)
36 switch (reason)
38 case DLL_WINE_PREATTACH:
39 return FALSE; /* prefer native version */
40 case DLL_PROCESS_ATTACH:
41 DisableThreadLibraryCalls( hinstDLL );
42 break;
44 return TRUE;
47 static HRESULT WINAPI dwritefactory_QueryInterface(IDWriteFactory *iface, REFIID riid, void **obj)
49 TRACE("(%s %p)\n", debugstr_guid(riid), obj);
51 if (IsEqualIID(riid, &IID_IUnknown) ||
52 IsEqualIID(riid, &IID_IDWriteFactory))
54 *obj = iface;
55 return S_OK;
58 *obj = NULL;
60 return E_NOINTERFACE;
63 static ULONG WINAPI dwritefactory_AddRef(IDWriteFactory *iface)
65 return 2;
68 static ULONG WINAPI dwritefactory_Release(IDWriteFactory *iface)
70 return 1;
73 static HRESULT WINAPI dwritefactory_GetSystemFontCollection(IDWriteFactory *iface,
74 IDWriteFontCollection **collection, BOOL check_for_updates)
76 FIXME("(%p %d): stub\n", collection, check_for_updates);
77 return E_NOTIMPL;
80 static HRESULT WINAPI dwritefactory_CreateCustomFontCollection(IDWriteFactory *iface,
81 IDWriteFontCollectionLoader *loader, void const *key, UINT32 key_size, IDWriteFontCollection **collection)
83 FIXME("(%p %p %u %p): stub\n", loader, key, key_size, collection);
84 return E_NOTIMPL;
87 static HRESULT WINAPI dwritefactory_RegisterFontCollectionLoader(IDWriteFactory *iface,
88 IDWriteFontCollectionLoader *loader)
90 FIXME("(%p): stub\n", loader);
91 return E_NOTIMPL;
94 static HRESULT WINAPI dwritefactory_UnregisterFontCollectionLoader(IDWriteFactory *iface,
95 IDWriteFontCollectionLoader *loader)
97 FIXME("(%p): stub\n", loader);
98 return E_NOTIMPL;
101 static HRESULT WINAPI dwritefactory_CreateFontFileReference(IDWriteFactory *iface,
102 WCHAR const *path, FILETIME const *writetime, IDWriteFontFile **font_file)
104 FIXME("(%s %p %p): stub\n", debugstr_w(path), writetime, font_file);
105 return E_NOTIMPL;
108 static HRESULT WINAPI dwritefactory_CreateCustomFontFileReference(IDWriteFactory *iface,
109 void const *reference_key, UINT32 key_size, IDWriteFontFileLoader *loader, IDWriteFontFile **font_file)
111 FIXME("(%p %u %p %p): stub\n", reference_key, key_size, loader, font_file);
112 return E_NOTIMPL;
115 static HRESULT WINAPI dwritefactory_CreateFontFace(IDWriteFactory *iface,
116 DWRITE_FONT_FACE_TYPE facetype, UINT32 files_number, IDWriteFontFile* const* font_files,
117 UINT32 index, DWRITE_FONT_SIMULATIONS sim_flags, IDWriteFontFace **font_face)
119 FIXME("(%d %u %p %u 0x%x %p): stub\n", facetype, files_number, font_files, index, sim_flags, font_face);
120 return E_NOTIMPL;
123 static HRESULT WINAPI dwritefactory_CreateRenderingParams(IDWriteFactory *iface, IDWriteRenderingParams **params)
125 FIXME("(%p): stub\n", params);
126 return E_NOTIMPL;
129 static HRESULT WINAPI dwritefactory_CreateMonitorRenderingParams(IDWriteFactory *iface, HMONITOR monitor,
130 IDWriteRenderingParams **params)
132 FIXME("(%p %p): stub\n", monitor, params);
133 return E_NOTIMPL;
136 static HRESULT WINAPI dwritefactory_CreateCustomRenderingParams(IDWriteFactory *iface, FLOAT gamma, FLOAT enhancedContrast,
137 FLOAT cleartype_level, DWRITE_PIXEL_GEOMETRY geometry, DWRITE_RENDERING_MODE mode, IDWriteRenderingParams **params)
139 FIXME("(%f %f %f %d %d %p): stub\n", gamma, enhancedContrast, cleartype_level, geometry, mode, params);
140 return E_NOTIMPL;
143 static HRESULT WINAPI dwritefactory_RegisterFontFileLoader(IDWriteFactory *iface, IDWriteFontFileLoader *loader)
145 FIXME("(%p): stub\n", loader);
146 return E_NOTIMPL;
149 static HRESULT WINAPI dwritefactory_UnregisterFontFileLoader(IDWriteFactory *iface, IDWriteFontFileLoader *loader)
151 FIXME("(%p): stub\n", loader);
152 return E_NOTIMPL;
155 static HRESULT WINAPI dwritefactory_CreateTextFormat(IDWriteFactory *iface, WCHAR const* family_name,
156 IDWriteFontCollection *collection, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STYLE style,
157 DWRITE_FONT_STRETCH stretch, FLOAT size, WCHAR const *locale, IDWriteTextFormat **format)
159 FIXME("(%s %p %d %d %d %f %s %p): stub\n", debugstr_w(family_name), collection, weight, style, stretch,
160 size, debugstr_w(locale), format);
161 return E_NOTIMPL;
164 static HRESULT WINAPI dwritefactory_CreateTypography(IDWriteFactory *iface, IDWriteTypography **typography)
166 FIXME("(%p): stub\n", typography);
167 return E_NOTIMPL;
170 static HRESULT WINAPI dwritefactory_GetGdiInterop(IDWriteFactory *iface, IDWriteGdiInterop **gdi_interop)
172 TRACE("(%p)\n", gdi_interop);
173 return create_gdiinterop(gdi_interop);
176 static HRESULT WINAPI dwritefactory_CreateTextLayout(IDWriteFactory *iface, WCHAR const* string,
177 UINT32 len, IDWriteTextFormat *format, FLOAT max_width, FLOAT max_height, IDWriteTextLayout **layout)
179 FIXME("(%s %u %p %f %f %p): stub\n", debugstr_w(string), len, format, max_width, max_height, layout);
180 return E_NOTIMPL;
183 static HRESULT WINAPI dwritefactory_CreateGdiCompatibleTextLayout(IDWriteFactory *iface, WCHAR const* string,
184 UINT32 len, IDWriteTextFormat *format, FLOAT layout_width, FLOAT layout_height, FLOAT pixels_per_dip,
185 DWRITE_MATRIX const* transform, BOOL use_gdi_natural, IDWriteTextLayout **layout)
187 FIXME("(%s:%u %p %f %f %f %p %d %p): stub\n", debugstr_wn(string, len), len, format, layout_width, layout_height,
188 pixels_per_dip, transform, use_gdi_natural, layout);
189 return E_NOTIMPL;
192 static HRESULT WINAPI dwritefactory_CreateEllipsisTrimmingSign(IDWriteFactory *iface, IDWriteTextFormat *format,
193 IDWriteInlineObject **trimming_sign)
195 FIXME("(%p %p): stub\n", format, trimming_sign);
196 return E_NOTIMPL;
199 static HRESULT WINAPI dwritefactory_CreateTextAnalyzer(IDWriteFactory *iface, IDWriteTextAnalyzer **analyzer)
201 FIXME("(%p): stub\n", analyzer);
202 return E_NOTIMPL;
205 static HRESULT WINAPI dwritefactory_CreateNumberSubstitution(IDWriteFactory *iface, DWRITE_NUMBER_SUBSTITUTION_METHOD method,
206 WCHAR const* locale, BOOL ignore_user_override, IDWriteNumberSubstitution **substitution)
208 FIXME("(%d %s %d %p): stub\n", method, debugstr_w(locale), ignore_user_override, substitution);
209 return E_NOTIMPL;
212 static HRESULT WINAPI dwritefactory_CreateGlyphRunAnalysis(IDWriteFactory *iface, DWRITE_GLYPH_RUN const *glyph_run,
213 FLOAT pixels_per_dip, DWRITE_MATRIX const* transform, DWRITE_RENDERING_MODE rendering_mode,
214 DWRITE_MEASURING_MODE measuring_mode, FLOAT baseline_x, FLOAT baseline_y, IDWriteGlyphRunAnalysis **analysis)
216 FIXME("(%p %f %p %d %d %f %f %p): stub\n", glyph_run, pixels_per_dip, transform, rendering_mode,
217 measuring_mode, baseline_x, baseline_y, analysis);
218 return E_NOTIMPL;
221 static const struct IDWriteFactoryVtbl dwritefactoryvtbl = {
222 dwritefactory_QueryInterface,
223 dwritefactory_AddRef,
224 dwritefactory_Release,
225 dwritefactory_GetSystemFontCollection,
226 dwritefactory_CreateCustomFontCollection,
227 dwritefactory_RegisterFontCollectionLoader,
228 dwritefactory_UnregisterFontCollectionLoader,
229 dwritefactory_CreateFontFileReference,
230 dwritefactory_CreateCustomFontFileReference,
231 dwritefactory_CreateFontFace,
232 dwritefactory_CreateRenderingParams,
233 dwritefactory_CreateMonitorRenderingParams,
234 dwritefactory_CreateCustomRenderingParams,
235 dwritefactory_RegisterFontFileLoader,
236 dwritefactory_UnregisterFontFileLoader,
237 dwritefactory_CreateTextFormat,
238 dwritefactory_CreateTypography,
239 dwritefactory_GetGdiInterop,
240 dwritefactory_CreateTextLayout,
241 dwritefactory_CreateGdiCompatibleTextLayout,
242 dwritefactory_CreateEllipsisTrimmingSign,
243 dwritefactory_CreateTextAnalyzer,
244 dwritefactory_CreateNumberSubstitution,
245 dwritefactory_CreateGlyphRunAnalysis
248 static IDWriteFactory dwritefactory = { &dwritefactoryvtbl };
250 HRESULT WINAPI DWriteCreateFactory(DWRITE_FACTORY_TYPE type, REFIID riid, IUnknown **factory)
252 TRACE("(%d, %s, %p)\n", type, debugstr_guid(riid), factory);
254 if (!IsEqualIID(riid, &IID_IDWriteFactory)) return E_FAIL;
256 *factory = (IUnknown*)&dwritefactory;
258 return S_OK;