Skip to content

Latest commit

 

History

History
270 lines (175 loc) · 7.81 KB

cd2dtextlayout-class.md

File metadata and controls

270 lines (175 loc) · 7.81 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: CD2DTextLayout Class
CD2DTextLayout Class
03/27/2019
CD2DTextLayout
AFXRENDERTARGET/CD2DTextLayout
AFXRENDERTARGET/CD2DTextLayout::CD2DTextLayout
AFXRENDERTARGET/CD2DTextLayout::Create
AFXRENDERTARGET/CD2DTextLayout::Destroy
AFXRENDERTARGET/CD2DTextLayout::Get
AFXRENDERTARGET/CD2DTextLayout::GetFontFamilyName
AFXRENDERTARGET/CD2DTextLayout::GetLocaleName
AFXRENDERTARGET/CD2DTextLayout::IsValid
AFXRENDERTARGET/CD2DTextLayout::ReCreate
AFXRENDERTARGET/CD2DTextLayout::SetFontFamilyName
AFXRENDERTARGET/CD2DTextLayout::SetLocaleName
AFXRENDERTARGET/CD2DTextLayout::m_pTextLayout
CD2DTextLayout [MFC], CD2DTextLayout
CD2DTextLayout [MFC], Create
CD2DTextLayout [MFC], Destroy
CD2DTextLayout [MFC], Get
CD2DTextLayout [MFC], GetFontFamilyName
CD2DTextLayout [MFC], GetLocaleName
CD2DTextLayout [MFC], IsValid
CD2DTextLayout [MFC], ReCreate
CD2DTextLayout [MFC], SetFontFamilyName
CD2DTextLayout [MFC], SetLocaleName
CD2DTextLayout [MFC], m_pTextLayout
724bd13c-f2ef-4e55-a775-8cb04b7b7908

CD2DTextLayout Class

A wrapper for IDWriteTextLayout.

Syntax

class CD2DTextLayout : public CD2DResource;

Members

Public Constructors

Name Description
CD2DTextLayout::CD2DTextLayout Constructs a CD2DTextLayout object.
CD2DTextLayout::~CD2DTextLayout The destructor. Called when a D2D text layout object is being destroyed.

Public Methods

Name Description
CD2DTextLayout::Create Creates a CD2DTextLayout. (Overrides CD2DResource::Create.)
CD2DTextLayout::Destroy Destroys a CD2DTextLayout object. (Overrides CD2DResource::Destroy.)
CD2DTextLayout::Get Returns IDWriteTextLayout interface
CD2DTextLayout::GetFontFamilyName Copies the font family name of the text at the specified position.
CD2DTextLayout::GetLocaleName Gets the locale name of the text at the specified position.
CD2DTextLayout::IsValid Checks resource validity (Overrides CD2DResource::IsValid.)
CD2DTextLayout::ReCreate Re-creates a CD2DTextLayout. (Overrides CD2DResource::ReCreate.)
CD2DTextLayout::SetFontFamilyName Sets null-terminated font family name for text within a specified text range
CD2DTextLayout::SetLocaleName Sets the locale name for text within a specified text range

Public Operators

Name Description
CD2DTextLayout::operator IDWriteTextLayout* Returns IDWriteTextLayout interface

Protected Data Members

Name Description
CD2DTextLayout::m_pTextLayout A pointer to an IDWriteTextLayout.

Inheritance Hierarchy

CObject

CD2DResource

CD2DTextLayout

Requirements

Header: afxrendertarget.h

CD2DTextLayout::~CD2DTextLayout

The destructor. Called when a D2D text layout object is being destroyed.

virtual ~CD2DTextLayout();

CD2DTextLayout::CD2DTextLayout

Constructs a CD2DTextLayout object.

CD2DTextLayout(
    CRenderTarget* pParentTarget,
    const CString& strText,
    CD2DTextFormat& textFormat,
    const CD2DSizeF& sizeMax,
    BOOL bAutoDestroy = TRUE);

Parameters

pParentTarget
A pointer to the render target.

strText
A CString object that contains the string to create a new CD2DTextLayout object from.

textFormat
A CString object that contains the format to apply to the string.

sizeMax
The size of the layout box.

bAutoDestroy
Indicates that the object will be destroyed by owner (pParentTarget).

CD2DTextLayout::Create

Creates a CD2DTextLayout.

virtual HRESULT Create(CRenderTarget* */);

Return Value

If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

CD2DTextLayout::Destroy

Destroys a CD2DTextLayout object.

virtual void Destroy();

CD2DTextLayout::Get

Returns IDWriteTextLayout interface

IDWriteTextLayout* Get();

Return Value

Pointer to an IDWriteTextLayout interface or NULL if object is not initialized yet.

CD2DTextLayout::GetFontFamilyName

Copies the font family name of the text at the specified position.

CString GetFontFamilyName(
    UINT32 currentPosition,
    DWRITE_TEXT_RANGE* textRange = NULL) const;

Parameters

currentPosition
The position of the text to examine.

textRange
The range of text that has the same formatting as the text at the position specified by currentPosition. This means the run has the exact formatting as the position specified, including but not limited to the font family name.

Return Value

CString object that contains the current font family name.

CD2DTextLayout::GetLocaleName

Gets the locale name of the text at the specified position.

CString GetLocaleName(
    UINT32 currentPosition,
    DWRITE_TEXT_RANGE* textRange = NULL) const;

Parameters

currentPosition
The position of the text to inspect.

textRange
The range of text that has the same formatting as the text at the position specified by currentPosition. This means the run has the exact formatting as the position specified, including but not limited to the locale name.

Return Value

CString object that contains the current locale name.

CD2DTextLayout::IsValid

Checks resource validity

virtual BOOL IsValid() const;

Return Value

TRUE if resource is valid; otherwise FALSE.

CD2DTextLayout::m_pTextLayout

A pointer to an IDWriteTextLayout.

IDWriteTextLayout* m_pTextLayout;

CD2DTextLayout::operator IDWriteTextLayout*

Returns IDWriteTextLayout interface

operator IDWriteTextLayout*();

Return Value

Pointer to an IDWriteTextLayout interface or NULL if object is not initialized yet.

CD2DTextLayout::ReCreate

Re-creates a CD2DTextLayout.

virtual HRESULT ReCreate(CRenderTarget* */);

Return Value

If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

CD2DTextLayout::SetFontFamilyName

Sets null-terminated font family name for text within a specified text range

BOOL SetFontFamilyName(
    LPCWSTR pwzFontFamilyName,
    DWRITE_TEXT_RANGE textRange);

Parameters

pwzFontFamilyName
The font family name that applies to the entire text string within the range specified by textRange

textRange
Text range to which this change applies

Return Value

If the method succeeds, it returns TRUE. Otherwise, it returns FALSE

CD2DTextLayout::SetLocaleName

Sets the locale name for text within a specified text range

BOOL SetLocaleName(
    LPCWSTR pwzLocaleName,
    DWRITE_TEXT_RANGE textRange);

Parameters

pwzLocaleName
A null-terminated locale name string

textRange
Text range to which this change applies

Return Value

If the method succeeds, it returns TRUE. Otherwise, it returns FALSE

See also

Classes