wbemprox: Support overriding the CIM to VARIANT type mapping for method parameters.
[wine] / dlls / dwrite / layout.c
1 /*
2  *    Text format and layout
3  *
4  * Copyright 2012 Nikolay Sivov for CodeWeavers
5  *
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.
10  *
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.
15  *
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
19  */
20
21 #define COBJMACROS
22
23 #include <stdarg.h>
24
25 #include "windef.h"
26 #include "winbase.h"
27 #include "wingdi.h"
28 #include "dwrite.h"
29 #include "dwrite_private.h"
30
31 #include "wine/debug.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(dwrite);
34
35 struct dwrite_textlayout {
36     IDWriteTextLayout IDWriteTextLayout_iface;
37     LONG ref;
38 };
39
40 struct dwrite_textformat {
41     IDWriteTextFormat IDWriteTextFormat_iface;
42     LONG ref;
43
44     WCHAR *family_name;
45     WCHAR *locale;
46
47     DWRITE_FONT_WEIGHT weight;
48     DWRITE_FONT_STYLE style;
49     DWRITE_FONT_STRETCH stretch;
50
51     FLOAT size;
52 };
53
54 static inline struct dwrite_textlayout *impl_from_IDWriteTextLayout(IDWriteTextLayout *iface)
55 {
56     return CONTAINING_RECORD(iface, struct dwrite_textlayout, IDWriteTextLayout_iface);
57 }
58
59 static inline struct dwrite_textformat *impl_from_IDWriteTextFormat(IDWriteTextFormat *iface)
60 {
61     return CONTAINING_RECORD(iface, struct dwrite_textformat, IDWriteTextFormat_iface);
62 }
63
64 static HRESULT WINAPI dwritetextlayout_QueryInterface(IDWriteTextLayout *iface, REFIID riid, void **obj)
65 {
66     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
67
68     TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
69
70     if (IsEqualIID(riid, &IID_IUnknown) ||
71         IsEqualIID(riid, &IID_IDWriteTextFormat) ||
72         IsEqualIID(riid, &IID_IDWriteTextLayout))
73     {
74         *obj = iface;
75         IDWriteTextLayout_AddRef(iface);
76         return S_OK;
77     }
78
79     *obj = NULL;
80
81     return E_NOINTERFACE;
82 }
83
84 static ULONG WINAPI dwritetextlayout_AddRef(IDWriteTextLayout *iface)
85 {
86     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
87     ULONG ref = InterlockedIncrement(&This->ref);
88     TRACE("(%p)->(%d)\n", This, ref);
89     return ref;
90 }
91
92 static ULONG WINAPI dwritetextlayout_Release(IDWriteTextLayout *iface)
93 {
94     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
95     ULONG ref = InterlockedDecrement(&This->ref);
96
97     TRACE("(%p)->(%d)\n", This, ref);
98
99     if (!ref)
100         heap_free(This);
101
102     return S_OK;
103 }
104
105 static HRESULT WINAPI dwritetextlayout_SetTextAlignment(IDWriteTextLayout *iface, DWRITE_TEXT_ALIGNMENT alignment)
106 {
107     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
108     FIXME("(%p)->(%d): stub\n", This, alignment);
109     return E_NOTIMPL;
110 }
111
112 static HRESULT WINAPI dwritetextlayout_SetParagraphAlignment(IDWriteTextLayout *iface, DWRITE_PARAGRAPH_ALIGNMENT alignment)
113 {
114     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
115     FIXME("(%p)->(%d): stub\n", This, alignment);
116     return E_NOTIMPL;
117 }
118
119 static HRESULT WINAPI dwritetextlayout_SetWordWrapping(IDWriteTextLayout *iface, DWRITE_WORD_WRAPPING wrapping)
120 {
121     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
122     FIXME("(%p)->(%d): stub\n", This, wrapping);
123     return E_NOTIMPL;
124 }
125
126 static HRESULT WINAPI dwritetextlayout_SetReadingDirection(IDWriteTextLayout *iface, DWRITE_READING_DIRECTION direction)
127 {
128     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
129     FIXME("(%p)->(%d): stub\n", This, direction);
130     return E_NOTIMPL;
131 }
132
133 static HRESULT WINAPI dwritetextlayout_SetFlowDirection(IDWriteTextLayout *iface, DWRITE_FLOW_DIRECTION direction)
134 {
135     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
136     FIXME("(%p)->(%d): stub\n", This, direction);
137     return E_NOTIMPL;
138 }
139
140 static HRESULT WINAPI dwritetextlayout_SetIncrementalTabStop(IDWriteTextLayout *iface, FLOAT tabstop)
141 {
142     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
143     FIXME("(%p)->(%f): stub\n", This, tabstop);
144     return E_NOTIMPL;
145 }
146
147 static HRESULT WINAPI dwritetextlayout_SetTrimming(IDWriteTextLayout *iface, DWRITE_TRIMMING const *trimming,
148     IDWriteInlineObject *trimming_sign)
149 {
150     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
151     FIXME("(%p)->(%p %p): stub\n", This, trimming, trimming_sign);
152     return E_NOTIMPL;
153 }
154
155 static HRESULT WINAPI dwritetextlayout_SetLineSpacing(IDWriteTextLayout *iface, DWRITE_LINE_SPACING_METHOD spacing,
156     FLOAT line_spacing, FLOAT baseline)
157 {
158     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
159     FIXME("(%p)->(%d %f %f): stub\n", This, spacing, line_spacing, baseline);
160     return E_NOTIMPL;
161 }
162
163 static DWRITE_TEXT_ALIGNMENT WINAPI dwritetextlayout_GetTextAlignment(IDWriteTextLayout *iface)
164 {
165     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
166     FIXME("(%p): stub\n", This);
167     return DWRITE_TEXT_ALIGNMENT_LEADING;
168 }
169
170 static DWRITE_PARAGRAPH_ALIGNMENT WINAPI dwritetextlayout_GetParagraphAlignment(IDWriteTextLayout *iface)
171 {
172     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
173     FIXME("(%p): stub\n", This);
174     return DWRITE_PARAGRAPH_ALIGNMENT_NEAR;
175 }
176
177 static DWRITE_WORD_WRAPPING WINAPI dwritetextlayout_GetWordWrapping(IDWriteTextLayout *iface)
178 {
179     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
180     FIXME("(%p): stub\n", This);
181     return DWRITE_WORD_WRAPPING_NO_WRAP;
182 }
183
184 static DWRITE_READING_DIRECTION WINAPI dwritetextlayout_GetReadingDirection(IDWriteTextLayout *iface)
185 {
186     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
187     FIXME("(%p): stub\n", This);
188     return DWRITE_READING_DIRECTION_LEFT_TO_RIGHT;
189 }
190
191 static DWRITE_FLOW_DIRECTION WINAPI dwritetextlayout_GetFlowDirection(IDWriteTextLayout *iface)
192 {
193     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
194     FIXME("(%p): stub\n", This);
195     return DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM;
196 }
197
198 static FLOAT WINAPI dwritetextlayout_GetIncrementalTabStop(IDWriteTextLayout *iface)
199 {
200     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
201     FIXME("(%p): stub\n", This);
202     return 0.0;
203 }
204
205 static HRESULT WINAPI dwritetextlayout_GetTrimming(IDWriteTextLayout *iface, DWRITE_TRIMMING *options,
206     IDWriteInlineObject **trimming_sign)
207 {
208     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
209     FIXME("(%p)->(%p %p): stub\n", This, options, trimming_sign);
210     return E_NOTIMPL;
211 }
212
213 static HRESULT WINAPI dwritetextlayout_GetLineSpacing(IDWriteTextLayout *iface, DWRITE_LINE_SPACING_METHOD *method,
214     FLOAT *spacing, FLOAT *baseline)
215 {
216     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
217     FIXME("(%p)->(%p %p %p): stub\n", This, method, spacing, baseline);
218     return E_NOTIMPL;
219 }
220
221 static HRESULT WINAPI dwritetextlayout_GetFontCollection(IDWriteTextLayout *iface, IDWriteFontCollection **collection)
222 {
223     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
224     FIXME("(%p)->(%p): stub\n", This, collection);
225     return E_NOTIMPL;
226 }
227
228 static UINT32 WINAPI dwritetextlayout_GetFontFamilyNameLength(IDWriteTextLayout *iface)
229 {
230     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
231     FIXME("(%p): stub\n", This);
232     return 0;
233 }
234
235 static HRESULT WINAPI dwritetextlayout_GetFontFamilyName(IDWriteTextLayout *iface, WCHAR *name, UINT32 size)
236 {
237     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
238     FIXME("(%p)->(%p %u): stub\n", This, name, size);
239     return E_NOTIMPL;
240 }
241
242 static DWRITE_FONT_WEIGHT WINAPI dwritetextlayout_GetFontWeight(IDWriteTextLayout *iface)
243 {
244     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
245     FIXME("(%p): stub\n", This);
246     return DWRITE_FONT_WEIGHT_NORMAL;
247 }
248
249 static DWRITE_FONT_STYLE WINAPI dwritetextlayout_GetFontStyle(IDWriteTextLayout *iface)
250 {
251     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
252     FIXME("(%p): stub\n", This);
253     return DWRITE_FONT_STYLE_NORMAL;
254 }
255
256 static DWRITE_FONT_STRETCH WINAPI dwritetextlayout_GetFontStretch(IDWriteTextLayout *iface)
257 {
258     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
259     FIXME("(%p): stub\n", This);
260     return DWRITE_FONT_STRETCH_NORMAL;
261 }
262
263 static FLOAT WINAPI dwritetextlayout_GetFontSize(IDWriteTextLayout *iface)
264 {
265     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
266     FIXME("(%p): stub\n", This);
267     return 0.0;
268 }
269
270 static UINT32 WINAPI dwritetextlayout_GetLocaleNameLength(IDWriteTextLayout *iface)
271 {
272     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
273     FIXME("(%p): stub\n", This);
274     return 0;
275 }
276
277 static HRESULT WINAPI dwritetextlayout_GetLocaleName(IDWriteTextLayout *iface, WCHAR *name, UINT32 size)
278 {
279     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
280     FIXME("(%p)->(%p %u): stub\n", This, name, size);
281     return E_NOTIMPL;
282 }
283
284 static HRESULT WINAPI dwritetextlayout_SetMaxWidth(IDWriteTextLayout *iface, FLOAT maxWidth)
285 {
286     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
287     FIXME("(%p)->(%f): stub\n", This, maxWidth);
288     return E_NOTIMPL;
289 }
290
291 static HRESULT WINAPI dwritetextlayout_SetMaxHeight(IDWriteTextLayout *iface, FLOAT maxHeight)
292 {
293     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
294     FIXME("(%p)->(%f): stub\n", This, maxHeight);
295     return E_NOTIMPL;
296 }
297
298 static HRESULT WINAPI dwritetextlayout_SetFontCollection(IDWriteTextLayout *iface, IDWriteFontCollection* collection, DWRITE_TEXT_RANGE range)
299 {
300     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
301     FIXME("(%p)->(%p %u:%u): stub\n", This, collection, range.startPosition, range.length);
302     return E_NOTIMPL;
303 }
304
305 static HRESULT WINAPI dwritetextlayout_SetFontFamilyName(IDWriteTextLayout *iface, WCHAR const *name, DWRITE_TEXT_RANGE range)
306 {
307     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
308     FIXME("(%p)->(%s %u:%u): stub\n", This, debugstr_w(name), range.startPosition, range.length);
309     return E_NOTIMPL;
310 }
311
312 static HRESULT WINAPI dwritetextlayout_SetFontWeight(IDWriteTextLayout *iface, DWRITE_FONT_WEIGHT weight, DWRITE_TEXT_RANGE range)
313 {
314     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
315     FIXME("(%p)->(%d %u:%u): stub\n", This, weight, range.startPosition, range.length);
316     return E_NOTIMPL;
317 }
318
319 static HRESULT WINAPI dwritetextlayout_SetFontStyle(IDWriteTextLayout *iface, DWRITE_FONT_STYLE style, DWRITE_TEXT_RANGE range)
320 {
321     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
322     FIXME("(%p)->(%d %u:%u): stub\n", This, style, range.startPosition, range.length);
323     return E_NOTIMPL;
324 }
325
326 static HRESULT WINAPI dwritetextlayout_SetFontStretch(IDWriteTextLayout *iface, DWRITE_FONT_STRETCH stretch, DWRITE_TEXT_RANGE range)
327 {
328     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
329     FIXME("(%p)->(%d %u:%u): stub\n", This, stretch, range.startPosition, range.length);
330     return E_NOTIMPL;
331 }
332
333 static HRESULT WINAPI dwritetextlayout_SetFontSize(IDWriteTextLayout *iface, FLOAT size, DWRITE_TEXT_RANGE range)
334 {
335     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
336     FIXME("(%p)->(%f %u:%u): stub\n", This, size, range.startPosition, range.length);
337     return E_NOTIMPL;
338 }
339
340 static HRESULT WINAPI dwritetextlayout_SetUnderline(IDWriteTextLayout *iface, BOOL underline, DWRITE_TEXT_RANGE range)
341 {
342     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
343     FIXME("(%p)->(%d %u:%u): stub\n", This, underline, range.startPosition, range.length);
344     return E_NOTIMPL;
345 }
346
347 static HRESULT WINAPI dwritetextlayout_SetStrikethrough(IDWriteTextLayout *iface, BOOL strikethrough, DWRITE_TEXT_RANGE range)
348 {
349     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
350     FIXME("(%p)->(%d %u:%u): stub\n", This, strikethrough, range.startPosition, range.length);
351     return E_NOTIMPL;
352 }
353
354 static HRESULT WINAPI dwritetextlayout_SetDrawingEffect(IDWriteTextLayout *iface, IUnknown* effect, DWRITE_TEXT_RANGE range)
355 {
356     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
357     FIXME("(%p)->(%p %u:%u): stub\n", This, effect, range.startPosition, range.length);
358     return E_NOTIMPL;
359 }
360
361 static HRESULT WINAPI dwritetextlayout_SetInlineObject(IDWriteTextLayout *iface, IDWriteInlineObject *object, DWRITE_TEXT_RANGE range)
362 {
363     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
364     FIXME("(%p)->(%p %u:%u): stub\n", This, object, range.startPosition, range.length);
365     return E_NOTIMPL;
366 }
367
368 static HRESULT WINAPI dwritetextlayout_SetTypography(IDWriteTextLayout *iface, IDWriteTypography* typography, DWRITE_TEXT_RANGE range)
369 {
370     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
371     FIXME("(%p)->(%p %u:%u): stub\n", This, typography, range.startPosition, range.length);
372     return E_NOTIMPL;
373 }
374
375 static HRESULT WINAPI dwritetextlayout_SetLocaleName(IDWriteTextLayout *iface, WCHAR const* locale, DWRITE_TEXT_RANGE range)
376 {
377     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
378     FIXME("(%p)->(%s %u:%u): stub\n", This, debugstr_w(locale), range.startPosition, range.length);
379     return E_NOTIMPL;
380 }
381
382 static FLOAT WINAPI dwritetextlayout_GetMaxWidth(IDWriteTextLayout *iface)
383 {
384     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
385     FIXME("(%p): stub\n", This);
386     return 0.0;
387 }
388
389 static FLOAT WINAPI dwritetextlayout_GetMaxHeight(IDWriteTextLayout *iface)
390 {
391     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
392     FIXME("(%p): stub\n", This);
393     return 0.0;
394 }
395
396 static HRESULT WINAPI dwritetextlayout_layout_GetFontCollection(IDWriteTextLayout *iface, UINT32 pos,
397     IDWriteFontCollection** collection, DWRITE_TEXT_RANGE *range)
398 {
399     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
400     FIXME("(%p)->(%p %p): stub\n", This, collection, range);
401     return E_NOTIMPL;
402 }
403
404 static HRESULT WINAPI dwritetextlayout_layout_GetFontFamilyNameLength(IDWriteTextLayout *iface,
405     UINT32 pos, UINT32* len, DWRITE_TEXT_RANGE *range)
406 {
407     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
408     FIXME("(%p)->(%d %p %p): stub\n", This, pos, len, range);
409     return E_NOTIMPL;
410 }
411
412 static HRESULT WINAPI dwritetextlayout_layout_GetFontFamilyName(IDWriteTextLayout *iface,
413     UINT32 position, WCHAR* name, UINT32 name_size, DWRITE_TEXT_RANGE *range)
414 {
415     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
416     FIXME("(%p)->(%u %p %u %p): stub\n", This, position, name, name_size, range);
417     return E_NOTIMPL;
418 }
419
420 static HRESULT WINAPI dwritetextlayout_layout_GetFontWeight(IDWriteTextLayout *iface,
421     UINT32 position, DWRITE_FONT_WEIGHT *weight, DWRITE_TEXT_RANGE *range)
422 {
423     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
424     FIXME("(%p)->(%u %p %p): stub\n", This, position, weight, range);
425     return E_NOTIMPL;
426 }
427
428 static HRESULT WINAPI dwritetextlayout_layout_GetFontStyle(IDWriteTextLayout *iface,
429     UINT32 currentPosition, DWRITE_FONT_STYLE *style, DWRITE_TEXT_RANGE *range)
430 {
431     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
432     FIXME("(%p)->(%u %p %p): stub\n", This, currentPosition, style, range);
433     return E_NOTIMPL;
434 }
435
436 static HRESULT WINAPI dwritetextlayout_layout_GetFontStretch(IDWriteTextLayout *iface,
437     UINT32 position, DWRITE_FONT_STRETCH *stretch, DWRITE_TEXT_RANGE *range)
438 {
439     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
440     FIXME("(%p)->(%u %p %p): stub\n", This, position, stretch, range);
441     return E_NOTIMPL;
442 }
443
444 static HRESULT WINAPI dwritetextlayout_layout_GetFontSize(IDWriteTextLayout *iface,
445     UINT32 position, FLOAT *size, DWRITE_TEXT_RANGE *range)
446 {
447     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
448     FIXME("(%p)->(%u %p %p): stub\n", This, position, size, range);
449     return E_NOTIMPL;
450 }
451
452 static HRESULT WINAPI dwritetextlayout_GetUnderline(IDWriteTextLayout *iface,
453     UINT32 position, BOOL *has_underline, DWRITE_TEXT_RANGE *range)
454 {
455     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
456     FIXME("(%p)->(%u %p %p): stub\n", This, position, has_underline, range);
457     return E_NOTIMPL;
458 }
459
460 static HRESULT WINAPI dwritetextlayout_GetStrikethrough(IDWriteTextLayout *iface,
461     UINT32 position, BOOL *has_strikethrough, DWRITE_TEXT_RANGE *range)
462 {
463     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
464     FIXME("(%p)->(%u %p %p): stub\n", This, position, has_strikethrough, range);
465     return E_NOTIMPL;
466 }
467
468 static HRESULT WINAPI dwritetextlayout_GetDrawingEffect(IDWriteTextLayout *iface,
469     UINT32 position, IUnknown **effect, DWRITE_TEXT_RANGE *range)
470 {
471     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
472     FIXME("(%p)->(%u %p %p): stub\n", This, position, effect, range);
473     return E_NOTIMPL;
474 }
475
476 static HRESULT WINAPI dwritetextlayout_GetInlineObject(IDWriteTextLayout *iface,
477     UINT32 position, IDWriteInlineObject **object, DWRITE_TEXT_RANGE *range)
478 {
479     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
480     FIXME("(%p)->(%u %p %p): stub\n", This, position, object, range);
481     return E_NOTIMPL;
482 }
483
484 static HRESULT WINAPI dwritetextlayout_GetTypography(IDWriteTextLayout *iface,
485     UINT32 position, IDWriteTypography** typography, DWRITE_TEXT_RANGE *range)
486 {
487     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
488     FIXME("(%p)->(%u %p %p): stub\n", This, position, typography, range);
489     return E_NOTIMPL;
490 }
491
492 static HRESULT WINAPI dwritetextlayout_layout_GetLocaleNameLength(IDWriteTextLayout *iface,
493     UINT32 position, UINT32* length, DWRITE_TEXT_RANGE *range)
494 {
495     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
496     FIXME("(%p)->(%u %p %p): stub\n", This, position, length, range);
497     return E_NOTIMPL;
498 }
499
500 static HRESULT WINAPI dwritetextlayout_layout_GetLocaleName(IDWriteTextLayout *iface,
501     UINT32 position, WCHAR* name, UINT32 name_size, DWRITE_TEXT_RANGE *range)
502 {
503     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
504     FIXME("(%p)->(%u %p %u %p): stub\n", This, position, name, name_size, range);
505     return E_NOTIMPL;
506 }
507
508 static HRESULT WINAPI dwritetextlayout_Draw(IDWriteTextLayout *iface,
509     void *context, IDWriteTextRenderer* renderer, FLOAT originX, FLOAT originY)
510 {
511     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
512     FIXME("(%p)->(%p %p %f %f): stub\n", This, context, renderer, originX, originY);
513     return E_NOTIMPL;
514 }
515
516 static HRESULT WINAPI dwritetextlayout_GetLineMetrics(IDWriteTextLayout *iface,
517     DWRITE_LINE_METRICS *metrics, UINT32 max_count, UINT32 *actual_count)
518 {
519     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
520     FIXME("(%p)->(%p %u %p): stub\n", This, metrics, max_count, actual_count);
521     return E_NOTIMPL;
522 }
523
524 static HRESULT WINAPI dwritetextlayout_GetMetrics(IDWriteTextLayout *iface, DWRITE_TEXT_METRICS *metrics)
525 {
526     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
527     FIXME("(%p)->(%p): stub\n", This, metrics);
528     return E_NOTIMPL;
529 }
530
531 static HRESULT WINAPI dwritetextlayout_GetOverhangMetrics(IDWriteTextLayout *iface, DWRITE_OVERHANG_METRICS *overhangs)
532 {
533     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
534     FIXME("(%p)->(%p): stub\n", This, overhangs);
535     return E_NOTIMPL;
536 }
537
538 static HRESULT WINAPI dwritetextlayout_GetClusterMetrics(IDWriteTextLayout *iface,
539     DWRITE_CLUSTER_METRICS *metrics, UINT32 max_count, UINT32* act_count)
540 {
541     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
542     FIXME("(%p)->(%p %u %p): stub\n", This, metrics, max_count, act_count);
543     return E_NOTIMPL;
544 }
545
546 static HRESULT WINAPI dwritetextlayout_DetermineMinWidth(IDWriteTextLayout *iface, FLOAT* min_width)
547 {
548     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
549     FIXME("(%p)->(%p): stub\n", This, min_width);
550     return E_NOTIMPL;
551 }
552
553 static HRESULT WINAPI dwritetextlayout_HitTestPoint(IDWriteTextLayout *iface,
554     FLOAT pointX, FLOAT pointY, BOOL* is_trailinghit, BOOL* is_inside, DWRITE_HIT_TEST_METRICS *metrics)
555 {
556     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
557     FIXME("(%p)->(%f %f %p %p %p): stub\n", This, pointX, pointY, is_trailinghit, is_inside, metrics);
558     return E_NOTIMPL;
559 }
560
561 static HRESULT WINAPI dwritetextlayout_HitTestTextPosition(IDWriteTextLayout *iface,
562     UINT32 textPosition, BOOL is_trailinghit, FLOAT* pointX, FLOAT* pointY, DWRITE_HIT_TEST_METRICS *metrics)
563 {
564     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
565     FIXME("(%p)->(%u %d %p %p %p): stub\n", This, textPosition, is_trailinghit, pointX, pointY, metrics);
566     return E_NOTIMPL;
567 }
568
569 static HRESULT WINAPI dwritetextlayout_HitTestTextRange(IDWriteTextLayout *iface,
570     UINT32 textPosition, UINT32 textLength, FLOAT originX, FLOAT originY,
571     DWRITE_HIT_TEST_METRICS *metrics, UINT32 max_metricscount, UINT32* actual_metricscount)
572 {
573     struct dwrite_textlayout *This = impl_from_IDWriteTextLayout(iface);
574     FIXME("(%p)->(%u %u %f %f %p %u %p): stub\n", This, textPosition, textLength, originX, originY, metrics,
575         max_metricscount, actual_metricscount);
576     return E_NOTIMPL;
577 }
578
579 static const IDWriteTextLayoutVtbl dwritetextlayoutvtbl = {
580     dwritetextlayout_QueryInterface,
581     dwritetextlayout_AddRef,
582     dwritetextlayout_Release,
583     dwritetextlayout_SetTextAlignment,
584     dwritetextlayout_SetParagraphAlignment,
585     dwritetextlayout_SetWordWrapping,
586     dwritetextlayout_SetReadingDirection,
587     dwritetextlayout_SetFlowDirection,
588     dwritetextlayout_SetIncrementalTabStop,
589     dwritetextlayout_SetTrimming,
590     dwritetextlayout_SetLineSpacing,
591     dwritetextlayout_GetTextAlignment,
592     dwritetextlayout_GetParagraphAlignment,
593     dwritetextlayout_GetWordWrapping,
594     dwritetextlayout_GetReadingDirection,
595     dwritetextlayout_GetFlowDirection,
596     dwritetextlayout_GetIncrementalTabStop,
597     dwritetextlayout_GetTrimming,
598     dwritetextlayout_GetLineSpacing,
599     dwritetextlayout_GetFontCollection,
600     dwritetextlayout_GetFontFamilyNameLength,
601     dwritetextlayout_GetFontFamilyName,
602     dwritetextlayout_GetFontWeight,
603     dwritetextlayout_GetFontStyle,
604     dwritetextlayout_GetFontStretch,
605     dwritetextlayout_GetFontSize,
606     dwritetextlayout_GetLocaleNameLength,
607     dwritetextlayout_GetLocaleName,
608     dwritetextlayout_SetMaxWidth,
609     dwritetextlayout_SetMaxHeight,
610     dwritetextlayout_SetFontCollection,
611     dwritetextlayout_SetFontFamilyName,
612     dwritetextlayout_SetFontWeight,
613     dwritetextlayout_SetFontStyle,
614     dwritetextlayout_SetFontStretch,
615     dwritetextlayout_SetFontSize,
616     dwritetextlayout_SetUnderline,
617     dwritetextlayout_SetStrikethrough,
618     dwritetextlayout_SetDrawingEffect,
619     dwritetextlayout_SetInlineObject,
620     dwritetextlayout_SetTypography,
621     dwritetextlayout_SetLocaleName,
622     dwritetextlayout_GetMaxWidth,
623     dwritetextlayout_GetMaxHeight,
624     dwritetextlayout_layout_GetFontCollection,
625     dwritetextlayout_layout_GetFontFamilyNameLength,
626     dwritetextlayout_layout_GetFontFamilyName,
627     dwritetextlayout_layout_GetFontWeight,
628     dwritetextlayout_layout_GetFontStyle,
629     dwritetextlayout_layout_GetFontStretch,
630     dwritetextlayout_layout_GetFontSize,
631     dwritetextlayout_GetUnderline,
632     dwritetextlayout_GetStrikethrough,
633     dwritetextlayout_GetDrawingEffect,
634     dwritetextlayout_GetInlineObject,
635     dwritetextlayout_GetTypography,
636     dwritetextlayout_layout_GetLocaleNameLength,
637     dwritetextlayout_layout_GetLocaleName,
638     dwritetextlayout_Draw,
639     dwritetextlayout_GetLineMetrics,
640     dwritetextlayout_GetMetrics,
641     dwritetextlayout_GetOverhangMetrics,
642     dwritetextlayout_GetClusterMetrics,
643     dwritetextlayout_DetermineMinWidth,
644     dwritetextlayout_HitTestPoint,
645     dwritetextlayout_HitTestTextPosition,
646     dwritetextlayout_HitTestTextRange
647 };
648
649 HRESULT create_textlayout(IDWriteTextLayout **layout)
650 {
651     struct dwrite_textlayout *This;
652
653     *layout = NULL;
654
655     This = heap_alloc(sizeof(struct dwrite_textlayout));
656     if (!This) return E_OUTOFMEMORY;
657
658     This->IDWriteTextLayout_iface.lpVtbl = &dwritetextlayoutvtbl;
659     This->ref = 1;
660
661     *layout = &This->IDWriteTextLayout_iface;
662
663     return S_OK;
664 }
665
666 static HRESULT WINAPI dwritetextformat_QueryInterface(IDWriteTextFormat *iface, REFIID riid, void **obj)
667 {
668     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
669
670     TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj);
671
672     if (IsEqualIID(riid, &IID_IUnknown) ||
673         IsEqualIID(riid, &IID_IDWriteTextFormat))
674     {
675         *obj = iface;
676         IDWriteTextFormat_AddRef(iface);
677         return S_OK;
678     }
679
680     *obj = NULL;
681
682     return E_NOINTERFACE;
683 }
684
685 static ULONG WINAPI dwritetextformat_AddRef(IDWriteTextFormat *iface)
686 {
687     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
688     ULONG ref = InterlockedIncrement(&This->ref);
689     TRACE("(%p)->(%d)\n", This, ref);
690     return ref;
691 }
692
693 static ULONG WINAPI dwritetextformat_Release(IDWriteTextFormat *iface)
694 {
695     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
696     ULONG ref = InterlockedDecrement(&This->ref);
697
698     TRACE("(%p)->(%d)\n", This, ref);
699
700     if (!ref)
701     {
702         heap_free(This->family_name);
703         heap_free(This->locale);
704         heap_free(This);
705     }
706
707     return S_OK;
708 }
709
710 static HRESULT WINAPI dwritetextformat_SetTextAlignment(IDWriteTextFormat *iface, DWRITE_TEXT_ALIGNMENT alignment)
711 {
712     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
713     FIXME("(%p)->(%d): stub\n", This, alignment);
714     return E_NOTIMPL;
715 }
716
717 static HRESULT WINAPI dwritetextformat_SetParagraphAlignment(IDWriteTextFormat *iface, DWRITE_PARAGRAPH_ALIGNMENT alignment)
718 {
719     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
720     FIXME("(%p)->(%d): stub\n", This, alignment);
721     return E_NOTIMPL;
722 }
723
724 static HRESULT WINAPI dwritetextformat_SetWordWrapping(IDWriteTextFormat *iface, DWRITE_WORD_WRAPPING wrapping)
725 {
726     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
727     FIXME("(%p)->(%d): stub\n", This, wrapping);
728     return E_NOTIMPL;
729 }
730
731 static HRESULT WINAPI dwritetextformat_SetReadingDirection(IDWriteTextFormat *iface, DWRITE_READING_DIRECTION direction)
732 {
733     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
734     FIXME("(%p)->(%d): stub\n", This, direction);
735     return E_NOTIMPL;
736 }
737
738 static HRESULT WINAPI dwritetextformat_SetFlowDirection(IDWriteTextFormat *iface, DWRITE_FLOW_DIRECTION direction)
739 {
740     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
741     FIXME("(%p)->(%d): stub\n", This, direction);
742     return E_NOTIMPL;
743 }
744
745 static HRESULT WINAPI dwritetextformat_SetIncrementalTabStop(IDWriteTextFormat *iface, FLOAT tabstop)
746 {
747     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
748     FIXME("(%p)->(%f): stub\n", This, tabstop);
749     return E_NOTIMPL;
750 }
751
752 static HRESULT WINAPI dwritetextformat_SetTrimming(IDWriteTextFormat *iface, DWRITE_TRIMMING const *trimming,
753     IDWriteInlineObject *trimming_sign)
754 {
755     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
756     FIXME("(%p)->(%p %p): stub\n", This, trimming, trimming_sign);
757     return E_NOTIMPL;
758 }
759
760 static HRESULT WINAPI dwritetextformat_SetLineSpacing(IDWriteTextFormat *iface, DWRITE_LINE_SPACING_METHOD spacing,
761     FLOAT line_spacing, FLOAT baseline)
762 {
763     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
764     FIXME("(%p)->(%d %f %f): stub\n", This, spacing, line_spacing, baseline);
765     return E_NOTIMPL;
766 }
767
768 static DWRITE_TEXT_ALIGNMENT WINAPI dwritetextformat_GetTextAlignment(IDWriteTextFormat *iface)
769 {
770     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
771     FIXME("(%p): stub\n", This);
772     return DWRITE_TEXT_ALIGNMENT_LEADING;
773 }
774
775 static DWRITE_PARAGRAPH_ALIGNMENT WINAPI dwritetextformat_GetParagraphAlignment(IDWriteTextFormat *iface)
776 {
777     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
778     FIXME("(%p): stub\n", This);
779     return DWRITE_PARAGRAPH_ALIGNMENT_NEAR;
780 }
781
782 static DWRITE_WORD_WRAPPING WINAPI dwritetextformat_GetWordWrapping(IDWriteTextFormat *iface)
783 {
784     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
785     FIXME("(%p): stub\n", This);
786     return DWRITE_WORD_WRAPPING_NO_WRAP;
787 }
788
789 static DWRITE_READING_DIRECTION WINAPI dwritetextformat_GetReadingDirection(IDWriteTextFormat *iface)
790 {
791     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
792     FIXME("(%p): stub\n", This);
793     return DWRITE_READING_DIRECTION_LEFT_TO_RIGHT;
794 }
795
796 static DWRITE_FLOW_DIRECTION WINAPI dwritetextformat_GetFlowDirection(IDWriteTextFormat *iface)
797 {
798     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
799     FIXME("(%p): stub\n", This);
800     return DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM;
801 }
802
803 static FLOAT WINAPI dwritetextformat_GetIncrementalTabStop(IDWriteTextFormat *iface)
804 {
805     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
806     FIXME("(%p): stub\n", This);
807     return 0.0;
808 }
809
810 static HRESULT WINAPI dwritetextformat_GetTrimming(IDWriteTextFormat *iface, DWRITE_TRIMMING *options,
811     IDWriteInlineObject **trimming_sign)
812 {
813     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
814     FIXME("(%p)->(%p %p): stub\n", This, options, trimming_sign);
815     return E_NOTIMPL;
816 }
817
818 static HRESULT WINAPI dwritetextformat_GetLineSpacing(IDWriteTextFormat *iface, DWRITE_LINE_SPACING_METHOD *method,
819     FLOAT *spacing, FLOAT *baseline)
820 {
821     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
822     FIXME("(%p)->(%p %p %p): stub\n", This, method, spacing, baseline);
823     return E_NOTIMPL;
824 }
825
826 static HRESULT WINAPI dwritetextformat_GetFontCollection(IDWriteTextFormat *iface, IDWriteFontCollection **collection)
827 {
828     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
829     FIXME("(%p)->(%p): stub\n", This, collection);
830     return E_NOTIMPL;
831 }
832
833 static UINT32 WINAPI dwritetextformat_GetFontFamilyNameLength(IDWriteTextFormat *iface)
834 {
835     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
836     FIXME("(%p): stub\n", This);
837     return 0;
838 }
839
840 static HRESULT WINAPI dwritetextformat_GetFontFamilyName(IDWriteTextFormat *iface, WCHAR *name, UINT32 size)
841 {
842     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
843     FIXME("(%p)->(%p %u): stub\n", This, name, size);
844     return E_NOTIMPL;
845 }
846
847 static DWRITE_FONT_WEIGHT WINAPI dwritetextformat_GetFontWeight(IDWriteTextFormat *iface)
848 {
849     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
850     FIXME("(%p): stub\n", This);
851     return DWRITE_FONT_WEIGHT_NORMAL;
852 }
853
854 static DWRITE_FONT_STYLE WINAPI dwritetextformat_GetFontStyle(IDWriteTextFormat *iface)
855 {
856     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
857     FIXME("(%p): stub\n", This);
858     return DWRITE_FONT_STYLE_NORMAL;
859 }
860
861 static DWRITE_FONT_STRETCH WINAPI dwritetextformat_GetFontStretch(IDWriteTextFormat *iface)
862 {
863     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
864     FIXME("(%p): stub\n", This);
865     return DWRITE_FONT_STRETCH_NORMAL;
866 }
867
868 static FLOAT WINAPI dwritetextformat_GetFontSize(IDWriteTextFormat *iface)
869 {
870     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
871     FIXME("(%p): stub\n", This);
872     return 0.0;
873 }
874
875 static UINT32 WINAPI dwritetextformat_GetLocaleNameLength(IDWriteTextFormat *iface)
876 {
877     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
878     FIXME("(%p): stub\n", This);
879     return 0;
880 }
881
882 static HRESULT WINAPI dwritetextformat_GetLocaleName(IDWriteTextFormat *iface, WCHAR *name, UINT32 size)
883 {
884     struct dwrite_textformat *This = impl_from_IDWriteTextFormat(iface);
885     FIXME("(%p)->(%p %u): stub\n", This, name, size);
886     return E_NOTIMPL;
887 }
888
889 static const IDWriteTextFormatVtbl dwritetextformatvtbl = {
890     dwritetextformat_QueryInterface,
891     dwritetextformat_AddRef,
892     dwritetextformat_Release,
893     dwritetextformat_SetTextAlignment,
894     dwritetextformat_SetParagraphAlignment,
895     dwritetextformat_SetWordWrapping,
896     dwritetextformat_SetReadingDirection,
897     dwritetextformat_SetFlowDirection,
898     dwritetextformat_SetIncrementalTabStop,
899     dwritetextformat_SetTrimming,
900     dwritetextformat_SetLineSpacing,
901     dwritetextformat_GetTextAlignment,
902     dwritetextformat_GetParagraphAlignment,
903     dwritetextformat_GetWordWrapping,
904     dwritetextformat_GetReadingDirection,
905     dwritetextformat_GetFlowDirection,
906     dwritetextformat_GetIncrementalTabStop,
907     dwritetextformat_GetTrimming,
908     dwritetextformat_GetLineSpacing,
909     dwritetextformat_GetFontCollection,
910     dwritetextformat_GetFontFamilyNameLength,
911     dwritetextformat_GetFontFamilyName,
912     dwritetextformat_GetFontWeight,
913     dwritetextformat_GetFontStyle,
914     dwritetextformat_GetFontStretch,
915     dwritetextformat_GetFontSize,
916     dwritetextformat_GetLocaleNameLength,
917     dwritetextformat_GetLocaleName
918 };
919
920 HRESULT create_textformat(const WCHAR *family_name, DWRITE_FONT_WEIGHT weight, DWRITE_FONT_STYLE style,
921     DWRITE_FONT_STRETCH stretch, FLOAT size, const WCHAR *locale, IDWriteTextFormat **format)
922 {
923     struct dwrite_textformat *This;
924
925     This = heap_alloc(sizeof(struct dwrite_textformat));
926     if (!This) return E_OUTOFMEMORY;
927
928     This->IDWriteTextFormat_iface.lpVtbl = &dwritetextformatvtbl;
929     This->ref = 1;
930     This->family_name = heap_strdupW(family_name);
931     This->locale = heap_strdupW(locale);
932     This->weight = weight;
933     This->style = style;
934     This->size = size;
935
936     *format = &This->IDWriteTextFormat_iface;
937
938     return S_OK;
939 }