2 * Text format and layout
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"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(dwrite
);
35 struct dwrite_textformat_data
{
40 DWRITE_FONT_WEIGHT weight
;
41 DWRITE_FONT_STYLE style
;
42 DWRITE_FONT_STRETCH stretch
;
46 IDWriteFontCollection
*collection
;
49 struct dwrite_textlayout
{
50 IDWriteTextLayout IDWriteTextLayout_iface
;
55 struct dwrite_textformat_data format
;
58 struct dwrite_textformat
{
59 IDWriteTextFormat IDWriteTextFormat_iface
;
61 struct dwrite_textformat_data format
;
64 static void release_format_data(struct dwrite_textformat_data
*data
)
66 if (data
->collection
) IDWriteFontCollection_Release(data
->collection
);
67 heap_free(data
->family_name
);
68 heap_free(data
->locale
);
71 static inline struct dwrite_textlayout
*impl_from_IDWriteTextLayout(IDWriteTextLayout
*iface
)
73 return CONTAINING_RECORD(iface
, struct dwrite_textlayout
, IDWriteTextLayout_iface
);
76 static inline struct dwrite_textformat
*impl_from_IDWriteTextFormat(IDWriteTextFormat
*iface
)
78 return CONTAINING_RECORD(iface
, struct dwrite_textformat
, IDWriteTextFormat_iface
);
81 static HRESULT WINAPI
dwritetextlayout_QueryInterface(IDWriteTextLayout
*iface
, REFIID riid
, void **obj
)
83 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
85 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), obj
);
87 if (IsEqualIID(riid
, &IID_IUnknown
) ||
88 IsEqualIID(riid
, &IID_IDWriteTextFormat
) ||
89 IsEqualIID(riid
, &IID_IDWriteTextLayout
))
92 IDWriteTextLayout_AddRef(iface
);
101 static ULONG WINAPI
dwritetextlayout_AddRef(IDWriteTextLayout
*iface
)
103 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
104 ULONG ref
= InterlockedIncrement(&This
->ref
);
105 TRACE("(%p)->(%d)\n", This
, ref
);
109 static ULONG WINAPI
dwritetextlayout_Release(IDWriteTextLayout
*iface
)
111 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
112 ULONG ref
= InterlockedDecrement(&This
->ref
);
114 TRACE("(%p)->(%d)\n", This
, ref
);
118 release_format_data(&This
->format
);
119 heap_free(This
->str
);
126 static HRESULT WINAPI
dwritetextlayout_SetTextAlignment(IDWriteTextLayout
*iface
, DWRITE_TEXT_ALIGNMENT alignment
)
128 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
129 FIXME("(%p)->(%d): stub\n", This
, alignment
);
133 static HRESULT WINAPI
dwritetextlayout_SetParagraphAlignment(IDWriteTextLayout
*iface
, DWRITE_PARAGRAPH_ALIGNMENT alignment
)
135 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
136 FIXME("(%p)->(%d): stub\n", This
, alignment
);
140 static HRESULT WINAPI
dwritetextlayout_SetWordWrapping(IDWriteTextLayout
*iface
, DWRITE_WORD_WRAPPING wrapping
)
142 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
143 FIXME("(%p)->(%d): stub\n", This
, wrapping
);
147 static HRESULT WINAPI
dwritetextlayout_SetReadingDirection(IDWriteTextLayout
*iface
, DWRITE_READING_DIRECTION direction
)
149 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
150 FIXME("(%p)->(%d): stub\n", This
, direction
);
154 static HRESULT WINAPI
dwritetextlayout_SetFlowDirection(IDWriteTextLayout
*iface
, DWRITE_FLOW_DIRECTION direction
)
156 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
157 FIXME("(%p)->(%d): stub\n", This
, direction
);
161 static HRESULT WINAPI
dwritetextlayout_SetIncrementalTabStop(IDWriteTextLayout
*iface
, FLOAT tabstop
)
163 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
164 FIXME("(%p)->(%f): stub\n", This
, tabstop
);
168 static HRESULT WINAPI
dwritetextlayout_SetTrimming(IDWriteTextLayout
*iface
, DWRITE_TRIMMING
const *trimming
,
169 IDWriteInlineObject
*trimming_sign
)
171 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
172 FIXME("(%p)->(%p %p): stub\n", This
, trimming
, trimming_sign
);
176 static HRESULT WINAPI
dwritetextlayout_SetLineSpacing(IDWriteTextLayout
*iface
, DWRITE_LINE_SPACING_METHOD spacing
,
177 FLOAT line_spacing
, FLOAT baseline
)
179 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
180 FIXME("(%p)->(%d %f %f): stub\n", This
, spacing
, line_spacing
, baseline
);
184 static DWRITE_TEXT_ALIGNMENT WINAPI
dwritetextlayout_GetTextAlignment(IDWriteTextLayout
*iface
)
186 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
187 FIXME("(%p): stub\n", This
);
188 return DWRITE_TEXT_ALIGNMENT_LEADING
;
191 static DWRITE_PARAGRAPH_ALIGNMENT WINAPI
dwritetextlayout_GetParagraphAlignment(IDWriteTextLayout
*iface
)
193 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
194 FIXME("(%p): stub\n", This
);
195 return DWRITE_PARAGRAPH_ALIGNMENT_NEAR
;
198 static DWRITE_WORD_WRAPPING WINAPI
dwritetextlayout_GetWordWrapping(IDWriteTextLayout
*iface
)
200 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
201 FIXME("(%p): stub\n", This
);
202 return DWRITE_WORD_WRAPPING_NO_WRAP
;
205 static DWRITE_READING_DIRECTION WINAPI
dwritetextlayout_GetReadingDirection(IDWriteTextLayout
*iface
)
207 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
208 FIXME("(%p): stub\n", This
);
209 return DWRITE_READING_DIRECTION_LEFT_TO_RIGHT
;
212 static DWRITE_FLOW_DIRECTION WINAPI
dwritetextlayout_GetFlowDirection(IDWriteTextLayout
*iface
)
214 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
215 FIXME("(%p): stub\n", This
);
216 return DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM
;
219 static FLOAT WINAPI
dwritetextlayout_GetIncrementalTabStop(IDWriteTextLayout
*iface
)
221 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
222 FIXME("(%p): stub\n", This
);
226 static HRESULT WINAPI
dwritetextlayout_GetTrimming(IDWriteTextLayout
*iface
, DWRITE_TRIMMING
*options
,
227 IDWriteInlineObject
**trimming_sign
)
229 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
230 FIXME("(%p)->(%p %p): stub\n", This
, options
, trimming_sign
);
234 static HRESULT WINAPI
dwritetextlayout_GetLineSpacing(IDWriteTextLayout
*iface
, DWRITE_LINE_SPACING_METHOD
*method
,
235 FLOAT
*spacing
, FLOAT
*baseline
)
237 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
238 FIXME("(%p)->(%p %p %p): stub\n", This
, method
, spacing
, baseline
);
242 static HRESULT WINAPI
dwritetextlayout_GetFontCollection(IDWriteTextLayout
*iface
, IDWriteFontCollection
**collection
)
244 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
245 FIXME("(%p)->(%p): stub\n", This
, collection
);
249 static UINT32 WINAPI
dwritetextlayout_GetFontFamilyNameLength(IDWriteTextLayout
*iface
)
251 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
252 FIXME("(%p): stub\n", This
);
256 static HRESULT WINAPI
dwritetextlayout_GetFontFamilyName(IDWriteTextLayout
*iface
, WCHAR
*name
, UINT32 size
)
258 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
259 FIXME("(%p)->(%p %u): stub\n", This
, name
, size
);
263 static DWRITE_FONT_WEIGHT WINAPI
dwritetextlayout_GetFontWeight(IDWriteTextLayout
*iface
)
265 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
266 FIXME("(%p): stub\n", This
);
267 return DWRITE_FONT_WEIGHT_NORMAL
;
270 static DWRITE_FONT_STYLE WINAPI
dwritetextlayout_GetFontStyle(IDWriteTextLayout
*iface
)
272 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
273 FIXME("(%p): stub\n", This
);
274 return DWRITE_FONT_STYLE_NORMAL
;
277 static DWRITE_FONT_STRETCH WINAPI
dwritetextlayout_GetFontStretch(IDWriteTextLayout
*iface
)
279 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
280 FIXME("(%p): stub\n", This
);
281 return DWRITE_FONT_STRETCH_NORMAL
;
284 static FLOAT WINAPI
dwritetextlayout_GetFontSize(IDWriteTextLayout
*iface
)
286 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
287 FIXME("(%p): stub\n", This
);
291 static UINT32 WINAPI
dwritetextlayout_GetLocaleNameLength(IDWriteTextLayout
*iface
)
293 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
294 TRACE("(%p)\n", This
);
295 return This
->format
.locale_len
;
298 static HRESULT WINAPI
dwritetextlayout_GetLocaleName(IDWriteTextLayout
*iface
, WCHAR
*name
, UINT32 size
)
300 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
302 TRACE("(%p)->(%p %u)\n", This
, name
, size
);
304 if (size
<= This
->format
.locale_len
) return E_NOT_SUFFICIENT_BUFFER
;
305 strcpyW(name
, This
->format
.locale
);
309 static HRESULT WINAPI
dwritetextlayout_SetMaxWidth(IDWriteTextLayout
*iface
, FLOAT maxWidth
)
311 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
312 FIXME("(%p)->(%f): stub\n", This
, maxWidth
);
316 static HRESULT WINAPI
dwritetextlayout_SetMaxHeight(IDWriteTextLayout
*iface
, FLOAT maxHeight
)
318 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
319 FIXME("(%p)->(%f): stub\n", This
, maxHeight
);
323 static HRESULT WINAPI
dwritetextlayout_SetFontCollection(IDWriteTextLayout
*iface
, IDWriteFontCollection
* collection
, DWRITE_TEXT_RANGE range
)
325 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
326 FIXME("(%p)->(%p %u:%u): stub\n", This
, collection
, range
.startPosition
, range
.length
);
330 static HRESULT WINAPI
dwritetextlayout_SetFontFamilyName(IDWriteTextLayout
*iface
, WCHAR
const *name
, DWRITE_TEXT_RANGE range
)
332 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
333 FIXME("(%p)->(%s %u:%u): stub\n", This
, debugstr_w(name
), range
.startPosition
, range
.length
);
337 static HRESULT WINAPI
dwritetextlayout_SetFontWeight(IDWriteTextLayout
*iface
, DWRITE_FONT_WEIGHT weight
, DWRITE_TEXT_RANGE range
)
339 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
340 FIXME("(%p)->(%d %u:%u): stub\n", This
, weight
, range
.startPosition
, range
.length
);
344 static HRESULT WINAPI
dwritetextlayout_SetFontStyle(IDWriteTextLayout
*iface
, DWRITE_FONT_STYLE style
, DWRITE_TEXT_RANGE range
)
346 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
347 FIXME("(%p)->(%d %u:%u): stub\n", This
, style
, range
.startPosition
, range
.length
);
351 static HRESULT WINAPI
dwritetextlayout_SetFontStretch(IDWriteTextLayout
*iface
, DWRITE_FONT_STRETCH stretch
, DWRITE_TEXT_RANGE range
)
353 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
354 FIXME("(%p)->(%d %u:%u): stub\n", This
, stretch
, range
.startPosition
, range
.length
);
358 static HRESULT WINAPI
dwritetextlayout_SetFontSize(IDWriteTextLayout
*iface
, FLOAT size
, DWRITE_TEXT_RANGE range
)
360 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
361 FIXME("(%p)->(%f %u:%u): stub\n", This
, size
, range
.startPosition
, range
.length
);
365 static HRESULT WINAPI
dwritetextlayout_SetUnderline(IDWriteTextLayout
*iface
, BOOL underline
, DWRITE_TEXT_RANGE range
)
367 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
368 FIXME("(%p)->(%d %u:%u): stub\n", This
, underline
, range
.startPosition
, range
.length
);
372 static HRESULT WINAPI
dwritetextlayout_SetStrikethrough(IDWriteTextLayout
*iface
, BOOL strikethrough
, DWRITE_TEXT_RANGE range
)
374 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
375 FIXME("(%p)->(%d %u:%u): stub\n", This
, strikethrough
, range
.startPosition
, range
.length
);
379 static HRESULT WINAPI
dwritetextlayout_SetDrawingEffect(IDWriteTextLayout
*iface
, IUnknown
* effect
, DWRITE_TEXT_RANGE range
)
381 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
382 FIXME("(%p)->(%p %u:%u): stub\n", This
, effect
, range
.startPosition
, range
.length
);
386 static HRESULT WINAPI
dwritetextlayout_SetInlineObject(IDWriteTextLayout
*iface
, IDWriteInlineObject
*object
, DWRITE_TEXT_RANGE range
)
388 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
389 FIXME("(%p)->(%p %u:%u): stub\n", This
, object
, range
.startPosition
, range
.length
);
393 static HRESULT WINAPI
dwritetextlayout_SetTypography(IDWriteTextLayout
*iface
, IDWriteTypography
* typography
, DWRITE_TEXT_RANGE range
)
395 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
396 FIXME("(%p)->(%p %u:%u): stub\n", This
, typography
, range
.startPosition
, range
.length
);
400 static HRESULT WINAPI
dwritetextlayout_SetLocaleName(IDWriteTextLayout
*iface
, WCHAR
const* locale
, DWRITE_TEXT_RANGE range
)
402 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
403 FIXME("(%p)->(%s %u:%u): stub\n", This
, debugstr_w(locale
), range
.startPosition
, range
.length
);
407 static FLOAT WINAPI
dwritetextlayout_GetMaxWidth(IDWriteTextLayout
*iface
)
409 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
410 FIXME("(%p): stub\n", This
);
414 static FLOAT WINAPI
dwritetextlayout_GetMaxHeight(IDWriteTextLayout
*iface
)
416 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
417 FIXME("(%p): stub\n", This
);
421 static HRESULT WINAPI
dwritetextlayout_layout_GetFontCollection(IDWriteTextLayout
*iface
, UINT32 pos
,
422 IDWriteFontCollection
** collection
, DWRITE_TEXT_RANGE
*range
)
424 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
425 FIXME("(%p)->(%p %p): stub\n", This
, collection
, range
);
429 static HRESULT WINAPI
dwritetextlayout_layout_GetFontFamilyNameLength(IDWriteTextLayout
*iface
,
430 UINT32 pos
, UINT32
* len
, DWRITE_TEXT_RANGE
*range
)
432 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
433 FIXME("(%p)->(%d %p %p): stub\n", This
, pos
, len
, range
);
437 static HRESULT WINAPI
dwritetextlayout_layout_GetFontFamilyName(IDWriteTextLayout
*iface
,
438 UINT32 position
, WCHAR
* name
, UINT32 name_size
, DWRITE_TEXT_RANGE
*range
)
440 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
441 FIXME("(%p)->(%u %p %u %p): stub\n", This
, position
, name
, name_size
, range
);
445 static HRESULT WINAPI
dwritetextlayout_layout_GetFontWeight(IDWriteTextLayout
*iface
,
446 UINT32 position
, DWRITE_FONT_WEIGHT
*weight
, DWRITE_TEXT_RANGE
*range
)
448 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
449 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, weight
, range
);
453 static HRESULT WINAPI
dwritetextlayout_layout_GetFontStyle(IDWriteTextLayout
*iface
,
454 UINT32 currentPosition
, DWRITE_FONT_STYLE
*style
, DWRITE_TEXT_RANGE
*range
)
456 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
457 FIXME("(%p)->(%u %p %p): stub\n", This
, currentPosition
, style
, range
);
461 static HRESULT WINAPI
dwritetextlayout_layout_GetFontStretch(IDWriteTextLayout
*iface
,
462 UINT32 position
, DWRITE_FONT_STRETCH
*stretch
, DWRITE_TEXT_RANGE
*range
)
464 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
465 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, stretch
, range
);
469 static HRESULT WINAPI
dwritetextlayout_layout_GetFontSize(IDWriteTextLayout
*iface
,
470 UINT32 position
, FLOAT
*size
, DWRITE_TEXT_RANGE
*range
)
472 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
473 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, size
, range
);
477 static HRESULT WINAPI
dwritetextlayout_GetUnderline(IDWriteTextLayout
*iface
,
478 UINT32 position
, BOOL
*has_underline
, DWRITE_TEXT_RANGE
*range
)
480 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
481 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, has_underline
, range
);
485 static HRESULT WINAPI
dwritetextlayout_GetStrikethrough(IDWriteTextLayout
*iface
,
486 UINT32 position
, BOOL
*has_strikethrough
, DWRITE_TEXT_RANGE
*range
)
488 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
489 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, has_strikethrough
, range
);
493 static HRESULT WINAPI
dwritetextlayout_GetDrawingEffect(IDWriteTextLayout
*iface
,
494 UINT32 position
, IUnknown
**effect
, DWRITE_TEXT_RANGE
*range
)
496 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
497 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, effect
, range
);
501 static HRESULT WINAPI
dwritetextlayout_GetInlineObject(IDWriteTextLayout
*iface
,
502 UINT32 position
, IDWriteInlineObject
**object
, DWRITE_TEXT_RANGE
*range
)
504 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
505 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, object
, range
);
509 static HRESULT WINAPI
dwritetextlayout_GetTypography(IDWriteTextLayout
*iface
,
510 UINT32 position
, IDWriteTypography
** typography
, DWRITE_TEXT_RANGE
*range
)
512 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
513 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, typography
, range
);
517 static HRESULT WINAPI
dwritetextlayout_layout_GetLocaleNameLength(IDWriteTextLayout
*iface
,
518 UINT32 position
, UINT32
* length
, DWRITE_TEXT_RANGE
*range
)
520 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
521 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, length
, range
);
525 static HRESULT WINAPI
dwritetextlayout_layout_GetLocaleName(IDWriteTextLayout
*iface
,
526 UINT32 position
, WCHAR
* name
, UINT32 name_size
, DWRITE_TEXT_RANGE
*range
)
528 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
529 FIXME("(%p)->(%u %p %u %p): stub\n", This
, position
, name
, name_size
, range
);
533 static HRESULT WINAPI
dwritetextlayout_Draw(IDWriteTextLayout
*iface
,
534 void *context
, IDWriteTextRenderer
* renderer
, FLOAT originX
, FLOAT originY
)
536 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
537 FIXME("(%p)->(%p %p %f %f): stub\n", This
, context
, renderer
, originX
, originY
);
541 static HRESULT WINAPI
dwritetextlayout_GetLineMetrics(IDWriteTextLayout
*iface
,
542 DWRITE_LINE_METRICS
*metrics
, UINT32 max_count
, UINT32
*actual_count
)
544 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
545 FIXME("(%p)->(%p %u %p): stub\n", This
, metrics
, max_count
, actual_count
);
549 static HRESULT WINAPI
dwritetextlayout_GetMetrics(IDWriteTextLayout
*iface
, DWRITE_TEXT_METRICS
*metrics
)
551 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
552 FIXME("(%p)->(%p): stub\n", This
, metrics
);
556 static HRESULT WINAPI
dwritetextlayout_GetOverhangMetrics(IDWriteTextLayout
*iface
, DWRITE_OVERHANG_METRICS
*overhangs
)
558 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
559 FIXME("(%p)->(%p): stub\n", This
, overhangs
);
563 static HRESULT WINAPI
dwritetextlayout_GetClusterMetrics(IDWriteTextLayout
*iface
,
564 DWRITE_CLUSTER_METRICS
*metrics
, UINT32 max_count
, UINT32
* act_count
)
566 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
567 FIXME("(%p)->(%p %u %p): stub\n", This
, metrics
, max_count
, act_count
);
571 static HRESULT WINAPI
dwritetextlayout_DetermineMinWidth(IDWriteTextLayout
*iface
, FLOAT
* min_width
)
573 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
574 FIXME("(%p)->(%p): stub\n", This
, min_width
);
578 static HRESULT WINAPI
dwritetextlayout_HitTestPoint(IDWriteTextLayout
*iface
,
579 FLOAT pointX
, FLOAT pointY
, BOOL
* is_trailinghit
, BOOL
* is_inside
, DWRITE_HIT_TEST_METRICS
*metrics
)
581 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
582 FIXME("(%p)->(%f %f %p %p %p): stub\n", This
, pointX
, pointY
, is_trailinghit
, is_inside
, metrics
);
586 static HRESULT WINAPI
dwritetextlayout_HitTestTextPosition(IDWriteTextLayout
*iface
,
587 UINT32 textPosition
, BOOL is_trailinghit
, FLOAT
* pointX
, FLOAT
* pointY
, DWRITE_HIT_TEST_METRICS
*metrics
)
589 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
590 FIXME("(%p)->(%u %d %p %p %p): stub\n", This
, textPosition
, is_trailinghit
, pointX
, pointY
, metrics
);
594 static HRESULT WINAPI
dwritetextlayout_HitTestTextRange(IDWriteTextLayout
*iface
,
595 UINT32 textPosition
, UINT32 textLength
, FLOAT originX
, FLOAT originY
,
596 DWRITE_HIT_TEST_METRICS
*metrics
, UINT32 max_metricscount
, UINT32
* actual_metricscount
)
598 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
599 FIXME("(%p)->(%u %u %f %f %p %u %p): stub\n", This
, textPosition
, textLength
, originX
, originY
, metrics
,
600 max_metricscount
, actual_metricscount
);
604 static const IDWriteTextLayoutVtbl dwritetextlayoutvtbl
= {
605 dwritetextlayout_QueryInterface
,
606 dwritetextlayout_AddRef
,
607 dwritetextlayout_Release
,
608 dwritetextlayout_SetTextAlignment
,
609 dwritetextlayout_SetParagraphAlignment
,
610 dwritetextlayout_SetWordWrapping
,
611 dwritetextlayout_SetReadingDirection
,
612 dwritetextlayout_SetFlowDirection
,
613 dwritetextlayout_SetIncrementalTabStop
,
614 dwritetextlayout_SetTrimming
,
615 dwritetextlayout_SetLineSpacing
,
616 dwritetextlayout_GetTextAlignment
,
617 dwritetextlayout_GetParagraphAlignment
,
618 dwritetextlayout_GetWordWrapping
,
619 dwritetextlayout_GetReadingDirection
,
620 dwritetextlayout_GetFlowDirection
,
621 dwritetextlayout_GetIncrementalTabStop
,
622 dwritetextlayout_GetTrimming
,
623 dwritetextlayout_GetLineSpacing
,
624 dwritetextlayout_GetFontCollection
,
625 dwritetextlayout_GetFontFamilyNameLength
,
626 dwritetextlayout_GetFontFamilyName
,
627 dwritetextlayout_GetFontWeight
,
628 dwritetextlayout_GetFontStyle
,
629 dwritetextlayout_GetFontStretch
,
630 dwritetextlayout_GetFontSize
,
631 dwritetextlayout_GetLocaleNameLength
,
632 dwritetextlayout_GetLocaleName
,
633 dwritetextlayout_SetMaxWidth
,
634 dwritetextlayout_SetMaxHeight
,
635 dwritetextlayout_SetFontCollection
,
636 dwritetextlayout_SetFontFamilyName
,
637 dwritetextlayout_SetFontWeight
,
638 dwritetextlayout_SetFontStyle
,
639 dwritetextlayout_SetFontStretch
,
640 dwritetextlayout_SetFontSize
,
641 dwritetextlayout_SetUnderline
,
642 dwritetextlayout_SetStrikethrough
,
643 dwritetextlayout_SetDrawingEffect
,
644 dwritetextlayout_SetInlineObject
,
645 dwritetextlayout_SetTypography
,
646 dwritetextlayout_SetLocaleName
,
647 dwritetextlayout_GetMaxWidth
,
648 dwritetextlayout_GetMaxHeight
,
649 dwritetextlayout_layout_GetFontCollection
,
650 dwritetextlayout_layout_GetFontFamilyNameLength
,
651 dwritetextlayout_layout_GetFontFamilyName
,
652 dwritetextlayout_layout_GetFontWeight
,
653 dwritetextlayout_layout_GetFontStyle
,
654 dwritetextlayout_layout_GetFontStretch
,
655 dwritetextlayout_layout_GetFontSize
,
656 dwritetextlayout_GetUnderline
,
657 dwritetextlayout_GetStrikethrough
,
658 dwritetextlayout_GetDrawingEffect
,
659 dwritetextlayout_GetInlineObject
,
660 dwritetextlayout_GetTypography
,
661 dwritetextlayout_layout_GetLocaleNameLength
,
662 dwritetextlayout_layout_GetLocaleName
,
663 dwritetextlayout_Draw
,
664 dwritetextlayout_GetLineMetrics
,
665 dwritetextlayout_GetMetrics
,
666 dwritetextlayout_GetOverhangMetrics
,
667 dwritetextlayout_GetClusterMetrics
,
668 dwritetextlayout_DetermineMinWidth
,
669 dwritetextlayout_HitTestPoint
,
670 dwritetextlayout_HitTestTextPosition
,
671 dwritetextlayout_HitTestTextRange
674 HRESULT
create_textlayout(const WCHAR
*str
, UINT32 len
, IDWriteTextFormat
*format
, IDWriteTextLayout
**layout
)
676 struct dwrite_textlayout
*This
;
681 This
= heap_alloc(sizeof(struct dwrite_textlayout
));
682 if (!This
) return E_OUTOFMEMORY
;
684 This
->IDWriteTextLayout_iface
.lpVtbl
= &dwritetextlayoutvtbl
;
686 This
->str
= heap_strdupnW(str
, len
);
688 memset(&This
->format
, 0, sizeof(This
->format
));
690 /* reference is not kept here, instead copy all underlying data */
691 IDWriteTextFormat_GetFontCollection(format
, &This
->format
.collection
);
693 /* locale name and length */
694 locale_len
= IDWriteTextFormat_GetLocaleNameLength(format
);
695 This
->format
.locale
= heap_alloc((locale_len
+1)*sizeof(WCHAR
));
696 IDWriteTextFormat_GetLocaleName(format
, This
->format
.locale
, locale_len
+1);
697 This
->format
.locale_len
= locale_len
;
699 This
->format
.weight
= IDWriteTextFormat_GetFontWeight(format
);
700 This
->format
.style
= IDWriteTextFormat_GetFontStyle(format
);
701 This
->format
.stretch
= IDWriteTextFormat_GetFontStretch(format
);
702 This
->format
.size
= IDWriteTextFormat_GetFontSize(format
);
704 *layout
= &This
->IDWriteTextLayout_iface
;
709 static HRESULT WINAPI
dwritetextformat_QueryInterface(IDWriteTextFormat
*iface
, REFIID riid
, void **obj
)
711 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
713 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), obj
);
715 if (IsEqualIID(riid
, &IID_IUnknown
) ||
716 IsEqualIID(riid
, &IID_IDWriteTextFormat
))
719 IDWriteTextFormat_AddRef(iface
);
725 return E_NOINTERFACE
;
728 static ULONG WINAPI
dwritetextformat_AddRef(IDWriteTextFormat
*iface
)
730 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
731 ULONG ref
= InterlockedIncrement(&This
->ref
);
732 TRACE("(%p)->(%d)\n", This
, ref
);
736 static ULONG WINAPI
dwritetextformat_Release(IDWriteTextFormat
*iface
)
738 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
739 ULONG ref
= InterlockedDecrement(&This
->ref
);
741 TRACE("(%p)->(%d)\n", This
, ref
);
745 release_format_data(&This
->format
);
752 static HRESULT WINAPI
dwritetextformat_SetTextAlignment(IDWriteTextFormat
*iface
, DWRITE_TEXT_ALIGNMENT alignment
)
754 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
755 FIXME("(%p)->(%d): stub\n", This
, alignment
);
759 static HRESULT WINAPI
dwritetextformat_SetParagraphAlignment(IDWriteTextFormat
*iface
, DWRITE_PARAGRAPH_ALIGNMENT alignment
)
761 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
762 FIXME("(%p)->(%d): stub\n", This
, alignment
);
766 static HRESULT WINAPI
dwritetextformat_SetWordWrapping(IDWriteTextFormat
*iface
, DWRITE_WORD_WRAPPING wrapping
)
768 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
769 FIXME("(%p)->(%d): stub\n", This
, wrapping
);
773 static HRESULT WINAPI
dwritetextformat_SetReadingDirection(IDWriteTextFormat
*iface
, DWRITE_READING_DIRECTION direction
)
775 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
776 FIXME("(%p)->(%d): stub\n", This
, direction
);
780 static HRESULT WINAPI
dwritetextformat_SetFlowDirection(IDWriteTextFormat
*iface
, DWRITE_FLOW_DIRECTION direction
)
782 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
783 FIXME("(%p)->(%d): stub\n", This
, direction
);
787 static HRESULT WINAPI
dwritetextformat_SetIncrementalTabStop(IDWriteTextFormat
*iface
, FLOAT tabstop
)
789 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
790 FIXME("(%p)->(%f): stub\n", This
, tabstop
);
794 static HRESULT WINAPI
dwritetextformat_SetTrimming(IDWriteTextFormat
*iface
, DWRITE_TRIMMING
const *trimming
,
795 IDWriteInlineObject
*trimming_sign
)
797 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
798 FIXME("(%p)->(%p %p): stub\n", This
, trimming
, trimming_sign
);
802 static HRESULT WINAPI
dwritetextformat_SetLineSpacing(IDWriteTextFormat
*iface
, DWRITE_LINE_SPACING_METHOD spacing
,
803 FLOAT line_spacing
, FLOAT baseline
)
805 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
806 FIXME("(%p)->(%d %f %f): stub\n", This
, spacing
, line_spacing
, baseline
);
810 static DWRITE_TEXT_ALIGNMENT WINAPI
dwritetextformat_GetTextAlignment(IDWriteTextFormat
*iface
)
812 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
813 FIXME("(%p): stub\n", This
);
814 return DWRITE_TEXT_ALIGNMENT_LEADING
;
817 static DWRITE_PARAGRAPH_ALIGNMENT WINAPI
dwritetextformat_GetParagraphAlignment(IDWriteTextFormat
*iface
)
819 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
820 FIXME("(%p): stub\n", This
);
821 return DWRITE_PARAGRAPH_ALIGNMENT_NEAR
;
824 static DWRITE_WORD_WRAPPING WINAPI
dwritetextformat_GetWordWrapping(IDWriteTextFormat
*iface
)
826 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
827 FIXME("(%p): stub\n", This
);
828 return DWRITE_WORD_WRAPPING_NO_WRAP
;
831 static DWRITE_READING_DIRECTION WINAPI
dwritetextformat_GetReadingDirection(IDWriteTextFormat
*iface
)
833 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
834 FIXME("(%p): stub\n", This
);
835 return DWRITE_READING_DIRECTION_LEFT_TO_RIGHT
;
838 static DWRITE_FLOW_DIRECTION WINAPI
dwritetextformat_GetFlowDirection(IDWriteTextFormat
*iface
)
840 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
841 FIXME("(%p): stub\n", This
);
842 return DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM
;
845 static FLOAT WINAPI
dwritetextformat_GetIncrementalTabStop(IDWriteTextFormat
*iface
)
847 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
848 FIXME("(%p): stub\n", This
);
852 static HRESULT WINAPI
dwritetextformat_GetTrimming(IDWriteTextFormat
*iface
, DWRITE_TRIMMING
*options
,
853 IDWriteInlineObject
**trimming_sign
)
855 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
856 FIXME("(%p)->(%p %p): stub\n", This
, options
, trimming_sign
);
860 static HRESULT WINAPI
dwritetextformat_GetLineSpacing(IDWriteTextFormat
*iface
, DWRITE_LINE_SPACING_METHOD
*method
,
861 FLOAT
*spacing
, FLOAT
*baseline
)
863 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
864 FIXME("(%p)->(%p %p %p): stub\n", This
, method
, spacing
, baseline
);
868 static HRESULT WINAPI
dwritetextformat_GetFontCollection(IDWriteTextFormat
*iface
, IDWriteFontCollection
**collection
)
870 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
872 TRACE("(%p)->(%p)\n", This
, collection
);
874 *collection
= This
->format
.collection
;
875 IDWriteFontCollection_AddRef(*collection
);
880 static UINT32 WINAPI
dwritetextformat_GetFontFamilyNameLength(IDWriteTextFormat
*iface
)
882 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
883 FIXME("(%p): stub\n", This
);
887 static HRESULT WINAPI
dwritetextformat_GetFontFamilyName(IDWriteTextFormat
*iface
, WCHAR
*name
, UINT32 size
)
889 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
890 FIXME("(%p)->(%p %u): stub\n", This
, name
, size
);
894 static DWRITE_FONT_WEIGHT WINAPI
dwritetextformat_GetFontWeight(IDWriteTextFormat
*iface
)
896 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
897 TRACE("(%p)\n", This
);
898 return This
->format
.weight
;
901 static DWRITE_FONT_STYLE WINAPI
dwritetextformat_GetFontStyle(IDWriteTextFormat
*iface
)
903 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
904 TRACE("(%p)\n", This
);
905 return This
->format
.style
;
908 static DWRITE_FONT_STRETCH WINAPI
dwritetextformat_GetFontStretch(IDWriteTextFormat
*iface
)
910 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
911 TRACE("(%p)\n", This
);
912 return This
->format
.stretch
;
915 static FLOAT WINAPI
dwritetextformat_GetFontSize(IDWriteTextFormat
*iface
)
917 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
918 TRACE("(%p)\n", This
);
919 return This
->format
.size
;
922 static UINT32 WINAPI
dwritetextformat_GetLocaleNameLength(IDWriteTextFormat
*iface
)
924 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
925 TRACE("(%p)\n", This
);
926 return This
->format
.locale_len
;
929 static HRESULT WINAPI
dwritetextformat_GetLocaleName(IDWriteTextFormat
*iface
, WCHAR
*name
, UINT32 size
)
931 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
933 TRACE("(%p)->(%p %u)\n", This
, name
, size
);
935 if (size
<= This
->format
.locale_len
) return E_NOT_SUFFICIENT_BUFFER
;
936 strcpyW(name
, This
->format
.locale
);
940 static const IDWriteTextFormatVtbl dwritetextformatvtbl
= {
941 dwritetextformat_QueryInterface
,
942 dwritetextformat_AddRef
,
943 dwritetextformat_Release
,
944 dwritetextformat_SetTextAlignment
,
945 dwritetextformat_SetParagraphAlignment
,
946 dwritetextformat_SetWordWrapping
,
947 dwritetextformat_SetReadingDirection
,
948 dwritetextformat_SetFlowDirection
,
949 dwritetextformat_SetIncrementalTabStop
,
950 dwritetextformat_SetTrimming
,
951 dwritetextformat_SetLineSpacing
,
952 dwritetextformat_GetTextAlignment
,
953 dwritetextformat_GetParagraphAlignment
,
954 dwritetextformat_GetWordWrapping
,
955 dwritetextformat_GetReadingDirection
,
956 dwritetextformat_GetFlowDirection
,
957 dwritetextformat_GetIncrementalTabStop
,
958 dwritetextformat_GetTrimming
,
959 dwritetextformat_GetLineSpacing
,
960 dwritetextformat_GetFontCollection
,
961 dwritetextformat_GetFontFamilyNameLength
,
962 dwritetextformat_GetFontFamilyName
,
963 dwritetextformat_GetFontWeight
,
964 dwritetextformat_GetFontStyle
,
965 dwritetextformat_GetFontStretch
,
966 dwritetextformat_GetFontSize
,
967 dwritetextformat_GetLocaleNameLength
,
968 dwritetextformat_GetLocaleName
971 HRESULT
create_textformat(const WCHAR
*family_name
, IDWriteFontCollection
*collection
, DWRITE_FONT_WEIGHT weight
, DWRITE_FONT_STYLE style
,
972 DWRITE_FONT_STRETCH stretch
, FLOAT size
, const WCHAR
*locale
, IDWriteTextFormat
**format
)
974 struct dwrite_textformat
*This
;
978 This
= heap_alloc(sizeof(struct dwrite_textformat
));
979 if (!This
) return E_OUTOFMEMORY
;
981 This
->IDWriteTextFormat_iface
.lpVtbl
= &dwritetextformatvtbl
;
983 This
->format
.family_name
= heap_strdupW(family_name
);
984 This
->format
.locale
= heap_strdupW(locale
);
985 This
->format
.locale_len
= strlenW(locale
);
986 This
->format
.weight
= weight
;
987 This
->format
.style
= style
;
988 This
->format
.size
= size
;
992 This
->format
.collection
= collection
;
993 IDWriteFontCollection_AddRef(collection
);
997 HRESULT hr
= get_system_fontcollection(&This
->format
.collection
);
1000 IDWriteTextFormat_Release(&This
->IDWriteTextFormat_iface
);
1005 *format
= &This
->IDWriteTextFormat_iface
;