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