description | title | ms.date | f1_keywords | helpviewer_keywords | ms.assetid | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: CD2DTextLayout Class |
CD2DTextLayout Class |
03/27/2019 |
|
|
724bd13c-f2ef-4e55-a775-8cb04b7b7908 |
A wrapper for IDWriteTextLayout.
class CD2DTextLayout : public CD2DResource;
Name | Description |
---|---|
CD2DTextLayout::CD2DTextLayout | Constructs a CD2DTextLayout object. |
CD2DTextLayout::~CD2DTextLayout | The destructor. Called when a D2D text layout object is being destroyed. |
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 |
Name | Description |
---|---|
CD2DTextLayout::operator IDWriteTextLayout* | Returns IDWriteTextLayout interface |
Name | Description |
---|---|
CD2DTextLayout::m_pTextLayout | A pointer to an IDWriteTextLayout. |
Header: afxrendertarget.h
The destructor. Called when a D2D text layout object is being destroyed.
virtual ~CD2DTextLayout();
Constructs a CD2DTextLayout object.
CD2DTextLayout(
CRenderTarget* pParentTarget,
const CString& strText,
CD2DTextFormat& textFormat,
const CD2DSizeF& sizeMax,
BOOL bAutoDestroy = TRUE);
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).
Creates a CD2DTextLayout.
virtual HRESULT Create(CRenderTarget* */);
If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Destroys a CD2DTextLayout object.
virtual void Destroy();
Returns IDWriteTextLayout interface
IDWriteTextLayout* Get();
Pointer to an IDWriteTextLayout interface or NULL if object is not initialized yet.
Copies the font family name of the text at the specified position.
CString GetFontFamilyName(
UINT32 currentPosition,
DWRITE_TEXT_RANGE* textRange = NULL) const;
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.
CString object that contains the current font family name.
Gets the locale name of the text at the specified position.
CString GetLocaleName(
UINT32 currentPosition,
DWRITE_TEXT_RANGE* textRange = NULL) const;
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.
CString object that contains the current locale name.
Checks resource validity
virtual BOOL IsValid() const;
TRUE if resource is valid; otherwise FALSE.
A pointer to an IDWriteTextLayout.
IDWriteTextLayout* m_pTextLayout;
Returns IDWriteTextLayout interface
operator IDWriteTextLayout*();
Pointer to an IDWriteTextLayout interface or NULL if object is not initialized yet.
Re-creates a CD2DTextLayout.
virtual HRESULT ReCreate(CRenderTarget* */);
If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
Sets null-terminated font family name for text within a specified text range
BOOL SetFontFamilyName(
LPCWSTR pwzFontFamilyName,
DWRITE_TEXT_RANGE textRange);
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
If the method succeeds, it returns TRUE. Otherwise, it returns FALSE
Sets the locale name for text within a specified text range
BOOL SetLocaleName(
LPCWSTR pwzLocaleName,
DWRITE_TEXT_RANGE textRange);
pwzLocaleName
A null-terminated locale name string
textRange
Text range to which this change applies
If the method succeeds, it returns TRUE. Otherwise, it returns FALSE