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 WINE_DEFAULT_DEBUG_CHANNEL(dwrite
);
33 struct dwrite_textformat_data
{
39 DWRITE_FONT_WEIGHT weight
;
40 DWRITE_FONT_STYLE style
;
41 DWRITE_FONT_STRETCH stretch
;
43 DWRITE_PARAGRAPH_ALIGNMENT paralign
;
44 DWRITE_READING_DIRECTION readingdir
;
45 DWRITE_WORD_WRAPPING wrapping
;
46 DWRITE_TEXT_ALIGNMENT textalignment
;
47 DWRITE_FLOW_DIRECTION flow
;
48 DWRITE_LINE_SPACING_METHOD spacingmethod
;
54 DWRITE_TRIMMING trimming
;
55 IDWriteInlineObject
*trimmingsign
;
57 IDWriteFontCollection
*collection
;
60 struct dwrite_textlayout
{
61 IDWriteTextLayout IDWriteTextLayout_iface
;
66 struct dwrite_textformat_data format
;
71 struct dwrite_textformat
{
72 IDWriteTextFormat IDWriteTextFormat_iface
;
74 struct dwrite_textformat_data format
;
77 struct dwrite_trimmingsign
{
78 IDWriteInlineObject IDWriteInlineObject_iface
;
82 static const IDWriteTextFormatVtbl dwritetextformatvtbl
;
84 static void release_format_data(struct dwrite_textformat_data
*data
)
86 if (data
->collection
) IDWriteFontCollection_Release(data
->collection
);
87 if (data
->trimmingsign
) IDWriteInlineObject_Release(data
->trimmingsign
);
88 heap_free(data
->family_name
);
89 heap_free(data
->locale
);
92 static inline struct dwrite_textlayout
*impl_from_IDWriteTextLayout(IDWriteTextLayout
*iface
)
94 return CONTAINING_RECORD(iface
, struct dwrite_textlayout
, IDWriteTextLayout_iface
);
97 static inline struct dwrite_textformat
*impl_from_IDWriteTextFormat(IDWriteTextFormat
*iface
)
99 return CONTAINING_RECORD(iface
, struct dwrite_textformat
, IDWriteTextFormat_iface
);
102 static inline struct dwrite_textformat
*unsafe_impl_from_IDWriteTextFormat(IDWriteTextFormat
*iface
)
104 return iface
->lpVtbl
== &dwritetextformatvtbl
? impl_from_IDWriteTextFormat(iface
) : NULL
;
107 static inline struct dwrite_trimmingsign
*impl_from_IDWriteInlineObject(IDWriteInlineObject
*iface
)
109 return CONTAINING_RECORD(iface
, struct dwrite_trimmingsign
, IDWriteInlineObject_iface
);
112 static HRESULT WINAPI
dwritetextlayout_QueryInterface(IDWriteTextLayout
*iface
, REFIID riid
, void **obj
)
114 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
116 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), obj
);
118 if (IsEqualIID(riid
, &IID_IUnknown
) ||
119 IsEqualIID(riid
, &IID_IDWriteTextFormat
) ||
120 IsEqualIID(riid
, &IID_IDWriteTextLayout
))
123 IDWriteTextLayout_AddRef(iface
);
129 return E_NOINTERFACE
;
132 static ULONG WINAPI
dwritetextlayout_AddRef(IDWriteTextLayout
*iface
)
134 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
135 ULONG ref
= InterlockedIncrement(&This
->ref
);
136 TRACE("(%p)->(%d)\n", This
, ref
);
140 static ULONG WINAPI
dwritetextlayout_Release(IDWriteTextLayout
*iface
)
142 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
143 ULONG ref
= InterlockedDecrement(&This
->ref
);
145 TRACE("(%p)->(%d)\n", This
, ref
);
149 release_format_data(&This
->format
);
150 heap_free(This
->str
);
157 static HRESULT WINAPI
dwritetextlayout_SetTextAlignment(IDWriteTextLayout
*iface
, DWRITE_TEXT_ALIGNMENT alignment
)
159 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
160 FIXME("(%p)->(%d): stub\n", This
, alignment
);
164 static HRESULT WINAPI
dwritetextlayout_SetParagraphAlignment(IDWriteTextLayout
*iface
, DWRITE_PARAGRAPH_ALIGNMENT alignment
)
166 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
167 FIXME("(%p)->(%d): stub\n", This
, alignment
);
171 static HRESULT WINAPI
dwritetextlayout_SetWordWrapping(IDWriteTextLayout
*iface
, DWRITE_WORD_WRAPPING wrapping
)
173 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
174 FIXME("(%p)->(%d): stub\n", This
, wrapping
);
178 static HRESULT WINAPI
dwritetextlayout_SetReadingDirection(IDWriteTextLayout
*iface
, DWRITE_READING_DIRECTION direction
)
180 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
181 FIXME("(%p)->(%d): stub\n", This
, direction
);
185 static HRESULT WINAPI
dwritetextlayout_SetFlowDirection(IDWriteTextLayout
*iface
, DWRITE_FLOW_DIRECTION direction
)
187 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
188 FIXME("(%p)->(%d): stub\n", This
, direction
);
192 static HRESULT WINAPI
dwritetextlayout_SetIncrementalTabStop(IDWriteTextLayout
*iface
, FLOAT tabstop
)
194 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
195 FIXME("(%p)->(%f): stub\n", This
, tabstop
);
199 static HRESULT WINAPI
dwritetextlayout_SetTrimming(IDWriteTextLayout
*iface
, DWRITE_TRIMMING
const *trimming
,
200 IDWriteInlineObject
*trimming_sign
)
202 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
203 FIXME("(%p)->(%p %p): stub\n", This
, trimming
, trimming_sign
);
207 static HRESULT WINAPI
dwritetextlayout_SetLineSpacing(IDWriteTextLayout
*iface
, DWRITE_LINE_SPACING_METHOD spacing
,
208 FLOAT line_spacing
, FLOAT baseline
)
210 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
211 FIXME("(%p)->(%d %f %f): stub\n", This
, spacing
, line_spacing
, baseline
);
215 static DWRITE_TEXT_ALIGNMENT WINAPI
dwritetextlayout_GetTextAlignment(IDWriteTextLayout
*iface
)
217 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
218 FIXME("(%p): stub\n", This
);
219 return DWRITE_TEXT_ALIGNMENT_LEADING
;
222 static DWRITE_PARAGRAPH_ALIGNMENT WINAPI
dwritetextlayout_GetParagraphAlignment(IDWriteTextLayout
*iface
)
224 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
225 FIXME("(%p): stub\n", This
);
226 return DWRITE_PARAGRAPH_ALIGNMENT_NEAR
;
229 static DWRITE_WORD_WRAPPING WINAPI
dwritetextlayout_GetWordWrapping(IDWriteTextLayout
*iface
)
231 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
232 FIXME("(%p): stub\n", This
);
233 return DWRITE_WORD_WRAPPING_NO_WRAP
;
236 static DWRITE_READING_DIRECTION WINAPI
dwritetextlayout_GetReadingDirection(IDWriteTextLayout
*iface
)
238 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
239 FIXME("(%p): stub\n", This
);
240 return DWRITE_READING_DIRECTION_LEFT_TO_RIGHT
;
243 static DWRITE_FLOW_DIRECTION WINAPI
dwritetextlayout_GetFlowDirection(IDWriteTextLayout
*iface
)
245 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
246 FIXME("(%p): stub\n", This
);
247 return DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM
;
250 static FLOAT WINAPI
dwritetextlayout_GetIncrementalTabStop(IDWriteTextLayout
*iface
)
252 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
253 FIXME("(%p): stub\n", This
);
257 static HRESULT WINAPI
dwritetextlayout_GetTrimming(IDWriteTextLayout
*iface
, DWRITE_TRIMMING
*options
,
258 IDWriteInlineObject
**trimming_sign
)
260 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
261 FIXME("(%p)->(%p %p): stub\n", This
, options
, trimming_sign
);
265 static HRESULT WINAPI
dwritetextlayout_GetLineSpacing(IDWriteTextLayout
*iface
, DWRITE_LINE_SPACING_METHOD
*method
,
266 FLOAT
*spacing
, FLOAT
*baseline
)
268 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
269 FIXME("(%p)->(%p %p %p): stub\n", This
, method
, spacing
, baseline
);
273 static HRESULT WINAPI
dwritetextlayout_GetFontCollection(IDWriteTextLayout
*iface
, IDWriteFontCollection
**collection
)
275 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
276 FIXME("(%p)->(%p): stub\n", This
, collection
);
280 static UINT32 WINAPI
dwritetextlayout_GetFontFamilyNameLength(IDWriteTextLayout
*iface
)
282 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
283 FIXME("(%p): stub\n", This
);
287 static HRESULT WINAPI
dwritetextlayout_GetFontFamilyName(IDWriteTextLayout
*iface
, WCHAR
*name
, UINT32 size
)
289 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
290 FIXME("(%p)->(%p %u): stub\n", This
, name
, size
);
294 static DWRITE_FONT_WEIGHT WINAPI
dwritetextlayout_GetFontWeight(IDWriteTextLayout
*iface
)
296 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
297 FIXME("(%p): stub\n", This
);
298 return DWRITE_FONT_WEIGHT_NORMAL
;
301 static DWRITE_FONT_STYLE WINAPI
dwritetextlayout_GetFontStyle(IDWriteTextLayout
*iface
)
303 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
304 FIXME("(%p): stub\n", This
);
305 return DWRITE_FONT_STYLE_NORMAL
;
308 static DWRITE_FONT_STRETCH WINAPI
dwritetextlayout_GetFontStretch(IDWriteTextLayout
*iface
)
310 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
311 FIXME("(%p): stub\n", This
);
312 return DWRITE_FONT_STRETCH_NORMAL
;
315 static FLOAT WINAPI
dwritetextlayout_GetFontSize(IDWriteTextLayout
*iface
)
317 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
318 FIXME("(%p): stub\n", This
);
322 static UINT32 WINAPI
dwritetextlayout_GetLocaleNameLength(IDWriteTextLayout
*iface
)
324 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
325 TRACE("(%p)\n", This
);
326 return This
->format
.locale_len
;
329 static HRESULT WINAPI
dwritetextlayout_GetLocaleName(IDWriteTextLayout
*iface
, WCHAR
*name
, UINT32 size
)
331 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
333 TRACE("(%p)->(%p %u)\n", This
, name
, size
);
335 if (size
<= This
->format
.locale_len
) return E_NOT_SUFFICIENT_BUFFER
;
336 strcpyW(name
, This
->format
.locale
);
340 static HRESULT WINAPI
dwritetextlayout_SetMaxWidth(IDWriteTextLayout
*iface
, FLOAT maxWidth
)
342 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
343 TRACE("(%p)->(%.1f)\n", This
, maxWidth
);
344 This
->maxwidth
= maxWidth
;
348 static HRESULT WINAPI
dwritetextlayout_SetMaxHeight(IDWriteTextLayout
*iface
, FLOAT maxHeight
)
350 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
351 TRACE("(%p)->(%.1f)\n", This
, maxHeight
);
352 This
->maxheight
= maxHeight
;
356 static HRESULT WINAPI
dwritetextlayout_SetFontCollection(IDWriteTextLayout
*iface
, IDWriteFontCollection
* collection
, DWRITE_TEXT_RANGE range
)
358 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
359 FIXME("(%p)->(%p %s): stub\n", This
, collection
, debugstr_range(&range
));
363 static HRESULT WINAPI
dwritetextlayout_SetFontFamilyName(IDWriteTextLayout
*iface
, WCHAR
const *name
, DWRITE_TEXT_RANGE range
)
365 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
366 FIXME("(%p)->(%s %s): stub\n", This
, debugstr_w(name
), debugstr_range(&range
));
370 static HRESULT WINAPI
dwritetextlayout_SetFontWeight(IDWriteTextLayout
*iface
, DWRITE_FONT_WEIGHT weight
, DWRITE_TEXT_RANGE range
)
372 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
373 FIXME("(%p)->(%d %s): stub\n", This
, weight
, debugstr_range(&range
));
377 static HRESULT WINAPI
dwritetextlayout_SetFontStyle(IDWriteTextLayout
*iface
, DWRITE_FONT_STYLE style
, DWRITE_TEXT_RANGE range
)
379 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
380 FIXME("(%p)->(%d %s): stub\n", This
, style
, debugstr_range(&range
));
384 static HRESULT WINAPI
dwritetextlayout_SetFontStretch(IDWriteTextLayout
*iface
, DWRITE_FONT_STRETCH stretch
, DWRITE_TEXT_RANGE range
)
386 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
387 FIXME("(%p)->(%d %s): stub\n", This
, stretch
, debugstr_range(&range
));
391 static HRESULT WINAPI
dwritetextlayout_SetFontSize(IDWriteTextLayout
*iface
, FLOAT size
, DWRITE_TEXT_RANGE range
)
393 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
394 FIXME("(%p)->(%f %s): stub\n", This
, size
, debugstr_range(&range
));
398 static HRESULT WINAPI
dwritetextlayout_SetUnderline(IDWriteTextLayout
*iface
, BOOL underline
, DWRITE_TEXT_RANGE range
)
400 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
401 FIXME("(%p)->(%d %s): stub\n", This
, underline
, debugstr_range(&range
));
405 static HRESULT WINAPI
dwritetextlayout_SetStrikethrough(IDWriteTextLayout
*iface
, BOOL strikethrough
, DWRITE_TEXT_RANGE range
)
407 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
408 FIXME("(%p)->(%d %s): stub\n", This
, strikethrough
, debugstr_range(&range
));
412 static HRESULT WINAPI
dwritetextlayout_SetDrawingEffect(IDWriteTextLayout
*iface
, IUnknown
* effect
, DWRITE_TEXT_RANGE range
)
414 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
415 FIXME("(%p)->(%p %s): stub\n", This
, effect
, debugstr_range(&range
));
419 static HRESULT WINAPI
dwritetextlayout_SetInlineObject(IDWriteTextLayout
*iface
, IDWriteInlineObject
*object
, DWRITE_TEXT_RANGE range
)
421 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
422 FIXME("(%p)->(%p %s): stub\n", This
, object
, debugstr_range(&range
));
426 static HRESULT WINAPI
dwritetextlayout_SetTypography(IDWriteTextLayout
*iface
, IDWriteTypography
* typography
, DWRITE_TEXT_RANGE range
)
428 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
429 FIXME("(%p)->(%p %s): stub\n", This
, typography
, debugstr_range(&range
));
433 static HRESULT WINAPI
dwritetextlayout_SetLocaleName(IDWriteTextLayout
*iface
, WCHAR
const* locale
, DWRITE_TEXT_RANGE range
)
435 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
436 FIXME("(%p)->(%s %s): stub\n", This
, debugstr_w(locale
), debugstr_range(&range
));
440 static FLOAT WINAPI
dwritetextlayout_GetMaxWidth(IDWriteTextLayout
*iface
)
442 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
443 TRACE("(%p)\n", This
);
444 return This
->maxwidth
;
447 static FLOAT WINAPI
dwritetextlayout_GetMaxHeight(IDWriteTextLayout
*iface
)
449 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
450 TRACE("(%p)\n", This
);
451 return This
->maxheight
;
454 static HRESULT WINAPI
dwritetextlayout_layout_GetFontCollection(IDWriteTextLayout
*iface
, UINT32 pos
,
455 IDWriteFontCollection
** collection
, DWRITE_TEXT_RANGE
*range
)
457 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
458 FIXME("(%p)->(%p %p): stub\n", This
, collection
, range
);
462 static HRESULT WINAPI
dwritetextlayout_layout_GetFontFamilyNameLength(IDWriteTextLayout
*iface
,
463 UINT32 pos
, UINT32
* len
, DWRITE_TEXT_RANGE
*range
)
465 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
466 FIXME("(%p)->(%d %p %p): stub\n", This
, pos
, len
, range
);
470 static HRESULT WINAPI
dwritetextlayout_layout_GetFontFamilyName(IDWriteTextLayout
*iface
,
471 UINT32 position
, WCHAR
* name
, UINT32 name_size
, DWRITE_TEXT_RANGE
*range
)
473 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
474 FIXME("(%p)->(%u %p %u %p): stub\n", This
, position
, name
, name_size
, range
);
478 static HRESULT WINAPI
dwritetextlayout_layout_GetFontWeight(IDWriteTextLayout
*iface
,
479 UINT32 position
, DWRITE_FONT_WEIGHT
*weight
, DWRITE_TEXT_RANGE
*range
)
481 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
482 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, weight
, range
);
486 static HRESULT WINAPI
dwritetextlayout_layout_GetFontStyle(IDWriteTextLayout
*iface
,
487 UINT32 currentPosition
, DWRITE_FONT_STYLE
*style
, DWRITE_TEXT_RANGE
*range
)
489 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
490 FIXME("(%p)->(%u %p %p): stub\n", This
, currentPosition
, style
, range
);
494 static HRESULT WINAPI
dwritetextlayout_layout_GetFontStretch(IDWriteTextLayout
*iface
,
495 UINT32 position
, DWRITE_FONT_STRETCH
*stretch
, DWRITE_TEXT_RANGE
*range
)
497 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
498 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, stretch
, range
);
502 static HRESULT WINAPI
dwritetextlayout_layout_GetFontSize(IDWriteTextLayout
*iface
,
503 UINT32 position
, FLOAT
*size
, DWRITE_TEXT_RANGE
*range
)
505 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
506 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, size
, range
);
510 static HRESULT WINAPI
dwritetextlayout_GetUnderline(IDWriteTextLayout
*iface
,
511 UINT32 position
, BOOL
*has_underline
, DWRITE_TEXT_RANGE
*range
)
513 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
514 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, has_underline
, range
);
518 static HRESULT WINAPI
dwritetextlayout_GetStrikethrough(IDWriteTextLayout
*iface
,
519 UINT32 position
, BOOL
*has_strikethrough
, DWRITE_TEXT_RANGE
*range
)
521 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
522 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, has_strikethrough
, range
);
526 static HRESULT WINAPI
dwritetextlayout_GetDrawingEffect(IDWriteTextLayout
*iface
,
527 UINT32 position
, IUnknown
**effect
, DWRITE_TEXT_RANGE
*range
)
529 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
530 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, effect
, range
);
534 static HRESULT WINAPI
dwritetextlayout_GetInlineObject(IDWriteTextLayout
*iface
,
535 UINT32 position
, IDWriteInlineObject
**object
, DWRITE_TEXT_RANGE
*range
)
537 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
538 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, object
, range
);
542 static HRESULT WINAPI
dwritetextlayout_GetTypography(IDWriteTextLayout
*iface
,
543 UINT32 position
, IDWriteTypography
** typography
, DWRITE_TEXT_RANGE
*range
)
545 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
546 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, typography
, range
);
550 static HRESULT WINAPI
dwritetextlayout_layout_GetLocaleNameLength(IDWriteTextLayout
*iface
,
551 UINT32 position
, UINT32
* length
, DWRITE_TEXT_RANGE
*range
)
553 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
554 FIXME("(%p)->(%u %p %p): stub\n", This
, position
, length
, range
);
558 static HRESULT WINAPI
dwritetextlayout_layout_GetLocaleName(IDWriteTextLayout
*iface
,
559 UINT32 position
, WCHAR
* name
, UINT32 name_size
, DWRITE_TEXT_RANGE
*range
)
561 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
562 FIXME("(%p)->(%u %p %u %p): stub\n", This
, position
, name
, name_size
, range
);
566 static HRESULT WINAPI
dwritetextlayout_Draw(IDWriteTextLayout
*iface
,
567 void *context
, IDWriteTextRenderer
* renderer
, FLOAT originX
, FLOAT originY
)
569 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
570 FIXME("(%p)->(%p %p %f %f): stub\n", This
, context
, renderer
, originX
, originY
);
574 static HRESULT WINAPI
dwritetextlayout_GetLineMetrics(IDWriteTextLayout
*iface
,
575 DWRITE_LINE_METRICS
*metrics
, UINT32 max_count
, UINT32
*actual_count
)
577 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
578 FIXME("(%p)->(%p %u %p): stub\n", This
, metrics
, max_count
, actual_count
);
582 static HRESULT WINAPI
dwritetextlayout_GetMetrics(IDWriteTextLayout
*iface
, DWRITE_TEXT_METRICS
*metrics
)
584 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
585 FIXME("(%p)->(%p): stub\n", This
, metrics
);
589 static HRESULT WINAPI
dwritetextlayout_GetOverhangMetrics(IDWriteTextLayout
*iface
, DWRITE_OVERHANG_METRICS
*overhangs
)
591 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
592 FIXME("(%p)->(%p): stub\n", This
, overhangs
);
596 static HRESULT WINAPI
dwritetextlayout_GetClusterMetrics(IDWriteTextLayout
*iface
,
597 DWRITE_CLUSTER_METRICS
*metrics
, UINT32 max_count
, UINT32
* act_count
)
599 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
600 FIXME("(%p)->(%p %u %p): stub\n", This
, metrics
, max_count
, act_count
);
604 static HRESULT WINAPI
dwritetextlayout_DetermineMinWidth(IDWriteTextLayout
*iface
, FLOAT
* min_width
)
606 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
607 FIXME("(%p)->(%p): stub\n", This
, min_width
);
611 static HRESULT WINAPI
dwritetextlayout_HitTestPoint(IDWriteTextLayout
*iface
,
612 FLOAT pointX
, FLOAT pointY
, BOOL
* is_trailinghit
, BOOL
* is_inside
, DWRITE_HIT_TEST_METRICS
*metrics
)
614 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
615 FIXME("(%p)->(%f %f %p %p %p): stub\n", This
, pointX
, pointY
, is_trailinghit
, is_inside
, metrics
);
619 static HRESULT WINAPI
dwritetextlayout_HitTestTextPosition(IDWriteTextLayout
*iface
,
620 UINT32 textPosition
, BOOL is_trailinghit
, FLOAT
* pointX
, FLOAT
* pointY
, DWRITE_HIT_TEST_METRICS
*metrics
)
622 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
623 FIXME("(%p)->(%u %d %p %p %p): stub\n", This
, textPosition
, is_trailinghit
, pointX
, pointY
, metrics
);
627 static HRESULT WINAPI
dwritetextlayout_HitTestTextRange(IDWriteTextLayout
*iface
,
628 UINT32 textPosition
, UINT32 textLength
, FLOAT originX
, FLOAT originY
,
629 DWRITE_HIT_TEST_METRICS
*metrics
, UINT32 max_metricscount
, UINT32
* actual_metricscount
)
631 struct dwrite_textlayout
*This
= impl_from_IDWriteTextLayout(iface
);
632 FIXME("(%p)->(%u %u %f %f %p %u %p): stub\n", This
, textPosition
, textLength
, originX
, originY
, metrics
,
633 max_metricscount
, actual_metricscount
);
637 static const IDWriteTextLayoutVtbl dwritetextlayoutvtbl
= {
638 dwritetextlayout_QueryInterface
,
639 dwritetextlayout_AddRef
,
640 dwritetextlayout_Release
,
641 dwritetextlayout_SetTextAlignment
,
642 dwritetextlayout_SetParagraphAlignment
,
643 dwritetextlayout_SetWordWrapping
,
644 dwritetextlayout_SetReadingDirection
,
645 dwritetextlayout_SetFlowDirection
,
646 dwritetextlayout_SetIncrementalTabStop
,
647 dwritetextlayout_SetTrimming
,
648 dwritetextlayout_SetLineSpacing
,
649 dwritetextlayout_GetTextAlignment
,
650 dwritetextlayout_GetParagraphAlignment
,
651 dwritetextlayout_GetWordWrapping
,
652 dwritetextlayout_GetReadingDirection
,
653 dwritetextlayout_GetFlowDirection
,
654 dwritetextlayout_GetIncrementalTabStop
,
655 dwritetextlayout_GetTrimming
,
656 dwritetextlayout_GetLineSpacing
,
657 dwritetextlayout_GetFontCollection
,
658 dwritetextlayout_GetFontFamilyNameLength
,
659 dwritetextlayout_GetFontFamilyName
,
660 dwritetextlayout_GetFontWeight
,
661 dwritetextlayout_GetFontStyle
,
662 dwritetextlayout_GetFontStretch
,
663 dwritetextlayout_GetFontSize
,
664 dwritetextlayout_GetLocaleNameLength
,
665 dwritetextlayout_GetLocaleName
,
666 dwritetextlayout_SetMaxWidth
,
667 dwritetextlayout_SetMaxHeight
,
668 dwritetextlayout_SetFontCollection
,
669 dwritetextlayout_SetFontFamilyName
,
670 dwritetextlayout_SetFontWeight
,
671 dwritetextlayout_SetFontStyle
,
672 dwritetextlayout_SetFontStretch
,
673 dwritetextlayout_SetFontSize
,
674 dwritetextlayout_SetUnderline
,
675 dwritetextlayout_SetStrikethrough
,
676 dwritetextlayout_SetDrawingEffect
,
677 dwritetextlayout_SetInlineObject
,
678 dwritetextlayout_SetTypography
,
679 dwritetextlayout_SetLocaleName
,
680 dwritetextlayout_GetMaxWidth
,
681 dwritetextlayout_GetMaxHeight
,
682 dwritetextlayout_layout_GetFontCollection
,
683 dwritetextlayout_layout_GetFontFamilyNameLength
,
684 dwritetextlayout_layout_GetFontFamilyName
,
685 dwritetextlayout_layout_GetFontWeight
,
686 dwritetextlayout_layout_GetFontStyle
,
687 dwritetextlayout_layout_GetFontStretch
,
688 dwritetextlayout_layout_GetFontSize
,
689 dwritetextlayout_GetUnderline
,
690 dwritetextlayout_GetStrikethrough
,
691 dwritetextlayout_GetDrawingEffect
,
692 dwritetextlayout_GetInlineObject
,
693 dwritetextlayout_GetTypography
,
694 dwritetextlayout_layout_GetLocaleNameLength
,
695 dwritetextlayout_layout_GetLocaleName
,
696 dwritetextlayout_Draw
,
697 dwritetextlayout_GetLineMetrics
,
698 dwritetextlayout_GetMetrics
,
699 dwritetextlayout_GetOverhangMetrics
,
700 dwritetextlayout_GetClusterMetrics
,
701 dwritetextlayout_DetermineMinWidth
,
702 dwritetextlayout_HitTestPoint
,
703 dwritetextlayout_HitTestTextPosition
,
704 dwritetextlayout_HitTestTextRange
707 static void layout_format_from_textformat(struct dwrite_textlayout
*layout
, IDWriteTextFormat
*format
)
709 struct dwrite_textformat
*f
;
711 memset(&layout
->format
, 0, sizeof(layout
->format
));
713 if ((f
= unsafe_impl_from_IDWriteTextFormat(format
)))
715 layout
->format
= f
->format
;
716 layout
->format
.locale
= heap_strdupW(f
->format
.locale
);
717 layout
->format
.family_name
= heap_strdupW(f
->format
.family_name
);
718 if (layout
->format
.trimmingsign
)
719 IDWriteInlineObject_AddRef(layout
->format
.trimmingsign
);
723 UINT32 locale_len
, family_len
;
725 layout
->format
.weight
= IDWriteTextFormat_GetFontWeight(format
);
726 layout
->format
.style
= IDWriteTextFormat_GetFontStyle(format
);
727 layout
->format
.stretch
= IDWriteTextFormat_GetFontStretch(format
);
728 layout
->format
.size
= IDWriteTextFormat_GetFontSize(format
);
729 layout
->format
.textalignment
= IDWriteTextFormat_GetTextAlignment(format
);
730 layout
->format
.paralign
= IDWriteTextFormat_GetParagraphAlignment(format
);
731 layout
->format
.wrapping
= IDWriteTextFormat_GetWordWrapping(format
);
732 layout
->format
.readingdir
= IDWriteTextFormat_GetReadingDirection(format
);
733 layout
->format
.flow
= IDWriteTextFormat_GetFlowDirection(format
);
734 IDWriteTextFormat_GetLineSpacing(format
,
735 &layout
->format
.spacingmethod
,
736 &layout
->format
.spacing
,
737 &layout
->format
.baseline
739 IDWriteTextFormat_GetTrimming(format
, &layout
->format
.trimming
, &layout
->format
.trimmingsign
);
741 /* locale name and length */
742 locale_len
= IDWriteTextFormat_GetLocaleNameLength(format
);
743 layout
->format
.locale
= heap_alloc((locale_len
+1)*sizeof(WCHAR
));
744 IDWriteTextFormat_GetLocaleName(format
, layout
->format
.locale
, locale_len
+1);
745 layout
->format
.locale_len
= locale_len
;
747 /* font family name and length */
748 family_len
= IDWriteTextFormat_GetFontFamilyNameLength(format
);
749 layout
->format
.family_name
= heap_alloc((family_len
+1)*sizeof(WCHAR
));
750 IDWriteTextFormat_GetFontFamilyName(format
, layout
->format
.family_name
, family_len
+1);
751 layout
->format
.family_len
= family_len
;
754 IDWriteTextFormat_GetFontCollection(format
, &layout
->format
.collection
);
757 HRESULT
create_textlayout(const WCHAR
*str
, UINT32 len
, IDWriteTextFormat
*format
, FLOAT maxwidth
, FLOAT maxheight
, IDWriteTextLayout
**layout
)
759 struct dwrite_textlayout
*This
;
763 This
= heap_alloc(sizeof(struct dwrite_textlayout
));
764 if (!This
) return E_OUTOFMEMORY
;
766 This
->IDWriteTextLayout_iface
.lpVtbl
= &dwritetextlayoutvtbl
;
768 This
->str
= heap_strdupnW(str
, len
);
770 This
->maxwidth
= maxwidth
;
771 This
->maxheight
= maxheight
;
772 layout_format_from_textformat(This
, format
);
774 *layout
= &This
->IDWriteTextLayout_iface
;
779 static HRESULT WINAPI
dwritetrimmingsign_QueryInterface(IDWriteInlineObject
*iface
, REFIID riid
, void **obj
)
781 struct dwrite_trimmingsign
*This
= impl_from_IDWriteInlineObject(iface
);
783 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), obj
);
785 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IDWriteInlineObject
)) {
787 IDWriteInlineObject_AddRef(iface
);
792 return E_NOINTERFACE
;
796 static ULONG WINAPI
dwritetrimmingsign_AddRef(IDWriteInlineObject
*iface
)
798 struct dwrite_trimmingsign
*This
= impl_from_IDWriteInlineObject(iface
);
799 ULONG ref
= InterlockedIncrement(&This
->ref
);
800 TRACE("(%p)->(%d)\n", This
, ref
);
804 static ULONG WINAPI
dwritetrimmingsign_Release(IDWriteInlineObject
*iface
)
806 struct dwrite_trimmingsign
*This
= impl_from_IDWriteInlineObject(iface
);
807 ULONG ref
= InterlockedDecrement(&This
->ref
);
809 TRACE("(%p)->(%d)\n", This
, ref
);
817 static HRESULT WINAPI
dwritetrimmingsign_Draw(IDWriteInlineObject
*iface
, void *context
, IDWriteTextRenderer
*renderer
,
818 FLOAT originX
, FLOAT originY
, BOOL is_sideways
, BOOL is_rtl
, IUnknown
*drawing_effect
)
820 struct dwrite_trimmingsign
*This
= impl_from_IDWriteInlineObject(iface
);
821 FIXME("(%p)->(%p %p %f %f %d %d %p): stub\n", This
, context
, renderer
, originX
, originY
, is_sideways
, is_rtl
, drawing_effect
);
825 static HRESULT WINAPI
dwritetrimmingsign_GetMetrics(IDWriteInlineObject
*iface
, DWRITE_INLINE_OBJECT_METRICS
*metrics
)
827 struct dwrite_trimmingsign
*This
= impl_from_IDWriteInlineObject(iface
);
828 FIXME("(%p)->(%p): stub\n", This
, metrics
);
832 static HRESULT WINAPI
dwritetrimmingsign_GetOverhangMetrics(IDWriteInlineObject
*iface
, DWRITE_OVERHANG_METRICS
*overhangs
)
834 struct dwrite_trimmingsign
*This
= impl_from_IDWriteInlineObject(iface
);
835 FIXME("(%p)->(%p): stub\n", This
, overhangs
);
839 static HRESULT WINAPI
dwritetrimmingsign_GetBreakConditions(IDWriteInlineObject
*iface
, DWRITE_BREAK_CONDITION
*before
,
840 DWRITE_BREAK_CONDITION
*after
)
842 struct dwrite_trimmingsign
*This
= impl_from_IDWriteInlineObject(iface
);
844 TRACE("(%p)->(%p %p)\n", This
, before
, after
);
846 *before
= *after
= DWRITE_BREAK_CONDITION_NEUTRAL
;
850 static const IDWriteInlineObjectVtbl dwritetrimmingsignvtbl
= {
851 dwritetrimmingsign_QueryInterface
,
852 dwritetrimmingsign_AddRef
,
853 dwritetrimmingsign_Release
,
854 dwritetrimmingsign_Draw
,
855 dwritetrimmingsign_GetMetrics
,
856 dwritetrimmingsign_GetOverhangMetrics
,
857 dwritetrimmingsign_GetBreakConditions
860 HRESULT
create_trimmingsign(IDWriteInlineObject
**sign
)
862 struct dwrite_trimmingsign
*This
;
866 This
= heap_alloc(sizeof(struct dwrite_trimmingsign
));
867 if (!This
) return E_OUTOFMEMORY
;
869 This
->IDWriteInlineObject_iface
.lpVtbl
= &dwritetrimmingsignvtbl
;
872 *sign
= &This
->IDWriteInlineObject_iface
;
877 static HRESULT WINAPI
dwritetextformat_QueryInterface(IDWriteTextFormat
*iface
, REFIID riid
, void **obj
)
879 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
881 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), obj
);
883 if (IsEqualIID(riid
, &IID_IUnknown
) ||
884 IsEqualIID(riid
, &IID_IDWriteTextFormat
))
887 IDWriteTextFormat_AddRef(iface
);
893 return E_NOINTERFACE
;
896 static ULONG WINAPI
dwritetextformat_AddRef(IDWriteTextFormat
*iface
)
898 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
899 ULONG ref
= InterlockedIncrement(&This
->ref
);
900 TRACE("(%p)->(%d)\n", This
, ref
);
904 static ULONG WINAPI
dwritetextformat_Release(IDWriteTextFormat
*iface
)
906 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
907 ULONG ref
= InterlockedDecrement(&This
->ref
);
909 TRACE("(%p)->(%d)\n", This
, ref
);
913 release_format_data(&This
->format
);
920 static HRESULT WINAPI
dwritetextformat_SetTextAlignment(IDWriteTextFormat
*iface
, DWRITE_TEXT_ALIGNMENT alignment
)
922 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
923 TRACE("(%p)->(%d)\n", This
, alignment
);
924 This
->format
.textalignment
= alignment
;
928 static HRESULT WINAPI
dwritetextformat_SetParagraphAlignment(IDWriteTextFormat
*iface
, DWRITE_PARAGRAPH_ALIGNMENT alignment
)
930 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
931 TRACE("(%p)->(%d)\n", This
, alignment
);
932 This
->format
.paralign
= alignment
;
936 static HRESULT WINAPI
dwritetextformat_SetWordWrapping(IDWriteTextFormat
*iface
, DWRITE_WORD_WRAPPING wrapping
)
938 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
939 TRACE("(%p)->(%d)\n", This
, wrapping
);
940 This
->format
.wrapping
= wrapping
;
944 static HRESULT WINAPI
dwritetextformat_SetReadingDirection(IDWriteTextFormat
*iface
, DWRITE_READING_DIRECTION direction
)
946 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
947 TRACE("(%p)->(%d)\n", This
, direction
);
948 This
->format
.readingdir
= direction
;
952 static HRESULT WINAPI
dwritetextformat_SetFlowDirection(IDWriteTextFormat
*iface
, DWRITE_FLOW_DIRECTION direction
)
954 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
955 TRACE("(%p)->(%d)\n", This
, direction
);
956 This
->format
.flow
= direction
;
960 static HRESULT WINAPI
dwritetextformat_SetIncrementalTabStop(IDWriteTextFormat
*iface
, FLOAT tabstop
)
962 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
963 FIXME("(%p)->(%f): stub\n", This
, tabstop
);
967 static HRESULT WINAPI
dwritetextformat_SetTrimming(IDWriteTextFormat
*iface
, DWRITE_TRIMMING
const *trimming
,
968 IDWriteInlineObject
*trimming_sign
)
970 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
971 TRACE("(%p)->(%p %p)\n", This
, trimming
, trimming_sign
);
973 This
->format
.trimming
= *trimming
;
974 if (This
->format
.trimmingsign
)
975 IDWriteInlineObject_Release(This
->format
.trimmingsign
);
976 This
->format
.trimmingsign
= trimming_sign
;
977 if (This
->format
.trimmingsign
)
978 IDWriteInlineObject_AddRef(This
->format
.trimmingsign
);
982 static HRESULT WINAPI
dwritetextformat_SetLineSpacing(IDWriteTextFormat
*iface
, DWRITE_LINE_SPACING_METHOD method
,
983 FLOAT spacing
, FLOAT baseline
)
985 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
986 TRACE("(%p)->(%d %f %f)\n", This
, method
, spacing
, baseline
);
987 This
->format
.spacingmethod
= method
;
988 This
->format
.spacing
= spacing
;
989 This
->format
.baseline
= baseline
;
993 static DWRITE_TEXT_ALIGNMENT WINAPI
dwritetextformat_GetTextAlignment(IDWriteTextFormat
*iface
)
995 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
996 TRACE("(%p)\n", This
);
997 return This
->format
.textalignment
;
1000 static DWRITE_PARAGRAPH_ALIGNMENT WINAPI
dwritetextformat_GetParagraphAlignment(IDWriteTextFormat
*iface
)
1002 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1003 TRACE("(%p)\n", This
);
1004 return This
->format
.paralign
;
1007 static DWRITE_WORD_WRAPPING WINAPI
dwritetextformat_GetWordWrapping(IDWriteTextFormat
*iface
)
1009 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1010 TRACE("(%p)\n", This
);
1011 return This
->format
.wrapping
;
1014 static DWRITE_READING_DIRECTION WINAPI
dwritetextformat_GetReadingDirection(IDWriteTextFormat
*iface
)
1016 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1017 TRACE("(%p)\n", This
);
1018 return This
->format
.readingdir
;
1021 static DWRITE_FLOW_DIRECTION WINAPI
dwritetextformat_GetFlowDirection(IDWriteTextFormat
*iface
)
1023 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1024 TRACE("(%p)\n", This
);
1025 return This
->format
.flow
;
1028 static FLOAT WINAPI
dwritetextformat_GetIncrementalTabStop(IDWriteTextFormat
*iface
)
1030 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1031 FIXME("(%p): stub\n", This
);
1035 static HRESULT WINAPI
dwritetextformat_GetTrimming(IDWriteTextFormat
*iface
, DWRITE_TRIMMING
*options
,
1036 IDWriteInlineObject
**trimming_sign
)
1038 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1039 TRACE("(%p)->(%p %p)\n", This
, options
, trimming_sign
);
1041 *options
= This
->format
.trimming
;
1042 if ((*trimming_sign
= This
->format
.trimmingsign
))
1043 IDWriteInlineObject_AddRef(*trimming_sign
);
1048 static HRESULT WINAPI
dwritetextformat_GetLineSpacing(IDWriteTextFormat
*iface
, DWRITE_LINE_SPACING_METHOD
*method
,
1049 FLOAT
*spacing
, FLOAT
*baseline
)
1051 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1052 TRACE("(%p)->(%p %p %p)\n", This
, method
, spacing
, baseline
);
1054 *method
= This
->format
.spacingmethod
;
1055 *spacing
= This
->format
.spacing
;
1056 *baseline
= This
->format
.baseline
;
1060 static HRESULT WINAPI
dwritetextformat_GetFontCollection(IDWriteTextFormat
*iface
, IDWriteFontCollection
**collection
)
1062 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1064 TRACE("(%p)->(%p)\n", This
, collection
);
1066 *collection
= This
->format
.collection
;
1067 IDWriteFontCollection_AddRef(*collection
);
1072 static UINT32 WINAPI
dwritetextformat_GetFontFamilyNameLength(IDWriteTextFormat
*iface
)
1074 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1075 TRACE("(%p)\n", This
);
1076 return This
->format
.family_len
;
1079 static HRESULT WINAPI
dwritetextformat_GetFontFamilyName(IDWriteTextFormat
*iface
, WCHAR
*name
, UINT32 size
)
1081 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1083 TRACE("(%p)->(%p %u)\n", This
, name
, size
);
1085 if (size
<= This
->format
.family_len
) return E_NOT_SUFFICIENT_BUFFER
;
1086 strcpyW(name
, This
->format
.family_name
);
1090 static DWRITE_FONT_WEIGHT WINAPI
dwritetextformat_GetFontWeight(IDWriteTextFormat
*iface
)
1092 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1093 TRACE("(%p)\n", This
);
1094 return This
->format
.weight
;
1097 static DWRITE_FONT_STYLE WINAPI
dwritetextformat_GetFontStyle(IDWriteTextFormat
*iface
)
1099 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1100 TRACE("(%p)\n", This
);
1101 return This
->format
.style
;
1104 static DWRITE_FONT_STRETCH WINAPI
dwritetextformat_GetFontStretch(IDWriteTextFormat
*iface
)
1106 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1107 TRACE("(%p)\n", This
);
1108 return This
->format
.stretch
;
1111 static FLOAT WINAPI
dwritetextformat_GetFontSize(IDWriteTextFormat
*iface
)
1113 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1114 TRACE("(%p)\n", This
);
1115 return This
->format
.size
;
1118 static UINT32 WINAPI
dwritetextformat_GetLocaleNameLength(IDWriteTextFormat
*iface
)
1120 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1121 TRACE("(%p)\n", This
);
1122 return This
->format
.locale_len
;
1125 static HRESULT WINAPI
dwritetextformat_GetLocaleName(IDWriteTextFormat
*iface
, WCHAR
*name
, UINT32 size
)
1127 struct dwrite_textformat
*This
= impl_from_IDWriteTextFormat(iface
);
1129 TRACE("(%p)->(%p %u)\n", This
, name
, size
);
1131 if (size
<= This
->format
.locale_len
) return E_NOT_SUFFICIENT_BUFFER
;
1132 strcpyW(name
, This
->format
.locale
);
1136 static const IDWriteTextFormatVtbl dwritetextformatvtbl
= {
1137 dwritetextformat_QueryInterface
,
1138 dwritetextformat_AddRef
,
1139 dwritetextformat_Release
,
1140 dwritetextformat_SetTextAlignment
,
1141 dwritetextformat_SetParagraphAlignment
,
1142 dwritetextformat_SetWordWrapping
,
1143 dwritetextformat_SetReadingDirection
,
1144 dwritetextformat_SetFlowDirection
,
1145 dwritetextformat_SetIncrementalTabStop
,
1146 dwritetextformat_SetTrimming
,
1147 dwritetextformat_SetLineSpacing
,
1148 dwritetextformat_GetTextAlignment
,
1149 dwritetextformat_GetParagraphAlignment
,
1150 dwritetextformat_GetWordWrapping
,
1151 dwritetextformat_GetReadingDirection
,
1152 dwritetextformat_GetFlowDirection
,
1153 dwritetextformat_GetIncrementalTabStop
,
1154 dwritetextformat_GetTrimming
,
1155 dwritetextformat_GetLineSpacing
,
1156 dwritetextformat_GetFontCollection
,
1157 dwritetextformat_GetFontFamilyNameLength
,
1158 dwritetextformat_GetFontFamilyName
,
1159 dwritetextformat_GetFontWeight
,
1160 dwritetextformat_GetFontStyle
,
1161 dwritetextformat_GetFontStretch
,
1162 dwritetextformat_GetFontSize
,
1163 dwritetextformat_GetLocaleNameLength
,
1164 dwritetextformat_GetLocaleName
1167 HRESULT
create_textformat(const WCHAR
*family_name
, IDWriteFontCollection
*collection
, DWRITE_FONT_WEIGHT weight
, DWRITE_FONT_STYLE style
,
1168 DWRITE_FONT_STRETCH stretch
, FLOAT size
, const WCHAR
*locale
, IDWriteTextFormat
**format
)
1170 struct dwrite_textformat
*This
;
1174 This
= heap_alloc(sizeof(struct dwrite_textformat
));
1175 if (!This
) return E_OUTOFMEMORY
;
1177 This
->IDWriteTextFormat_iface
.lpVtbl
= &dwritetextformatvtbl
;
1179 This
->format
.family_name
= heap_strdupW(family_name
);
1180 This
->format
.family_len
= strlenW(family_name
);
1181 This
->format
.locale
= heap_strdupW(locale
);
1182 This
->format
.locale_len
= strlenW(locale
);
1183 This
->format
.weight
= weight
;
1184 This
->format
.style
= style
;
1185 This
->format
.size
= size
;
1186 This
->format
.stretch
= stretch
;
1187 This
->format
.textalignment
= DWRITE_TEXT_ALIGNMENT_LEADING
;
1188 This
->format
.paralign
= DWRITE_PARAGRAPH_ALIGNMENT_NEAR
;
1189 This
->format
.wrapping
= DWRITE_WORD_WRAPPING_WRAP
;
1190 This
->format
.readingdir
= DWRITE_READING_DIRECTION_LEFT_TO_RIGHT
;
1191 This
->format
.flow
= DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM
;
1192 This
->format
.spacingmethod
= DWRITE_LINE_SPACING_METHOD_DEFAULT
;
1193 This
->format
.spacing
= 0.0;
1194 This
->format
.baseline
= 0.0;
1195 This
->format
.trimming
.granularity
= DWRITE_TRIMMING_GRANULARITY_NONE
;
1196 This
->format
.trimming
.delimiter
= 0;
1197 This
->format
.trimming
.delimiterCount
= 0;
1198 This
->format
.trimmingsign
= NULL
;
1202 This
->format
.collection
= collection
;
1203 IDWriteFontCollection_AddRef(collection
);
1207 HRESULT hr
= get_system_fontcollection(&This
->format
.collection
);
1210 IDWriteTextFormat_Release(&This
->IDWriteTextFormat_iface
);
1215 *format
= &This
->IDWriteTextFormat_iface
;