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
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)
38 case DLL_WINE_PREATTACH:
39 return FALSE; /* prefer native version */
40 case DLL_PROCESS_ATTACH:
41 DisableThreadLibraryCalls( hinstDLL );
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))
63 static ULONG WINAPI dwritefactory_AddRef(IDWriteFactory *iface)
68 static ULONG WINAPI dwritefactory_Release(IDWriteFactory *iface)
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);
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);
87 static HRESULT WINAPI dwritefactory_RegisterFontCollectionLoader(IDWriteFactory *iface,
88 IDWriteFontCollectionLoader *loader)
90 FIXME("(%p): stub\n", loader);
94 static HRESULT WINAPI dwritefactory_UnregisterFontCollectionLoader(IDWriteFactory *iface,
95 IDWriteFontCollectionLoader *loader)
97 FIXME("(%p): stub\n", loader);
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);
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);
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);
123 static HRESULT WINAPI dwritefactory_CreateRenderingParams(IDWriteFactory *iface, IDWriteRenderingParams **params)
125 FIXME("(%p): stub\n", params);
129 static HRESULT WINAPI dwritefactory_CreateMonitorRenderingParams(IDWriteFactory *iface, HMONITOR monitor,
130 IDWriteRenderingParams **params)
132 FIXME("(%p %p): stub\n", monitor, params);
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);
143 static HRESULT WINAPI dwritefactory_RegisterFontFileLoader(IDWriteFactory *iface, IDWriteFontFileLoader *loader)
145 FIXME("(%p): stub\n", loader);
149 static HRESULT WINAPI dwritefactory_UnregisterFontFileLoader(IDWriteFactory *iface, IDWriteFontFileLoader *loader)
151 FIXME("(%p): stub\n", loader);
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);
164 static HRESULT WINAPI dwritefactory_CreateTypography(IDWriteFactory *iface, IDWriteTypography **typography)
166 FIXME("(%p): stub\n", typography);
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);
181 if (!format) return E_INVALIDARG;
182 return create_textlayout(layout);
185 static HRESULT WINAPI dwritefactory_CreateGdiCompatibleTextLayout(IDWriteFactory *iface, WCHAR const* string,
186 UINT32 len, IDWriteTextFormat *format, FLOAT layout_width, FLOAT layout_height, FLOAT pixels_per_dip,
187 DWRITE_MATRIX const* transform, BOOL use_gdi_natural, IDWriteTextLayout **layout)
189 FIXME("(%s:%u %p %f %f %f %p %d %p): semi-stub\n", debugstr_wn(string, len), len, format, layout_width, layout_height,
190 pixels_per_dip, transform, use_gdi_natural, layout);
192 if (!format) return E_INVALIDARG;
193 return create_textlayout(layout);
196 static HRESULT WINAPI dwritefactory_CreateEllipsisTrimmingSign(IDWriteFactory *iface, IDWriteTextFormat *format,
197 IDWriteInlineObject **trimming_sign)
199 FIXME("(%p %p): stub\n", format, trimming_sign);
203 static HRESULT WINAPI dwritefactory_CreateTextAnalyzer(IDWriteFactory *iface, IDWriteTextAnalyzer **analyzer)
205 FIXME("(%p): stub\n", analyzer);
209 static HRESULT WINAPI dwritefactory_CreateNumberSubstitution(IDWriteFactory *iface, DWRITE_NUMBER_SUBSTITUTION_METHOD method,
210 WCHAR const* locale, BOOL ignore_user_override, IDWriteNumberSubstitution **substitution)
212 FIXME("(%d %s %d %p): stub\n", method, debugstr_w(locale), ignore_user_override, substitution);
216 static HRESULT WINAPI dwritefactory_CreateGlyphRunAnalysis(IDWriteFactory *iface, DWRITE_GLYPH_RUN const *glyph_run,
217 FLOAT pixels_per_dip, DWRITE_MATRIX const* transform, DWRITE_RENDERING_MODE rendering_mode,
218 DWRITE_MEASURING_MODE measuring_mode, FLOAT baseline_x, FLOAT baseline_y, IDWriteGlyphRunAnalysis **analysis)
220 FIXME("(%p %f %p %d %d %f %f %p): stub\n", glyph_run, pixels_per_dip, transform, rendering_mode,
221 measuring_mode, baseline_x, baseline_y, analysis);
225 static const struct IDWriteFactoryVtbl dwritefactoryvtbl = {
226 dwritefactory_QueryInterface,
227 dwritefactory_AddRef,
228 dwritefactory_Release,
229 dwritefactory_GetSystemFontCollection,
230 dwritefactory_CreateCustomFontCollection,
231 dwritefactory_RegisterFontCollectionLoader,
232 dwritefactory_UnregisterFontCollectionLoader,
233 dwritefactory_CreateFontFileReference,
234 dwritefactory_CreateCustomFontFileReference,
235 dwritefactory_CreateFontFace,
236 dwritefactory_CreateRenderingParams,
237 dwritefactory_CreateMonitorRenderingParams,
238 dwritefactory_CreateCustomRenderingParams,
239 dwritefactory_RegisterFontFileLoader,
240 dwritefactory_UnregisterFontFileLoader,
241 dwritefactory_CreateTextFormat,
242 dwritefactory_CreateTypography,
243 dwritefactory_GetGdiInterop,
244 dwritefactory_CreateTextLayout,
245 dwritefactory_CreateGdiCompatibleTextLayout,
246 dwritefactory_CreateEllipsisTrimmingSign,
247 dwritefactory_CreateTextAnalyzer,
248 dwritefactory_CreateNumberSubstitution,
249 dwritefactory_CreateGlyphRunAnalysis
252 static IDWriteFactory dwritefactory = { &dwritefactoryvtbl };
254 HRESULT WINAPI DWriteCreateFactory(DWRITE_FACTORY_TYPE type, REFIID riid, IUnknown **factory)
256 TRACE("(%d, %s, %p)\n", type, debugstr_guid(riid), factory);
258 if (!IsEqualIID(riid, &IID_IDWriteFactory)) return E_FAIL;
260 *factory = (IUnknown*)&dwritefactory;