CD2DTextFormat Class
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at CD2DTextFormat Class.
A wrapper for IDWriteTextFormat.
Syntax
class CD2DTextFormat : public CD2DResource;
Members
Public Constructors
Name | Description |
---|---|
CD2DTextFormat::CD2DTextFormat | Constructs a CD2DTextFormat object. |
CD2DTextFormat::~CD2DTextFormat | The destructor. Called when a D2D text format object is being destroyed. |
Public Methods
Name | Description |
---|---|
CD2DTextFormat::Create | Creates a CD2DTextFormat. (Overrides CD2DResource::Create.) |
CD2DTextFormat::Destroy | Destroys a CD2DTextFormat object. (Overrides CD2DResource::Destroy.) |
CD2DTextFormat::Get | Returns IDWriteTextFormat interface |
CD2DTextFormat::GetFontFamilyName | Gets a copy of the font family name. |
CD2DTextFormat::GetLocaleName | Gets a copy of the locale name. |
CD2DTextFormat::IsValid | Checks resource validity (Overrides CD2DResource::IsValid.) |
CD2DTextFormat::ReCreate | Re-creates a CD2DTextFormat. (Overrides CD2DResource::ReCreate.) |
Public Operators
Name | Description |
---|---|
CD2DTextFormat::operator IDWriteTextFormat* | Returns IDWriteTextFormat interface |
Protected Data Members
Name | Description |
---|---|
CD2DTextFormat::m_pTextFormat | A pointer to an IDWriteTextFormat. |
Inheritance Hierarchy
Requirements
Header: afxrendertarget.h
CD2DTextFormat::~CD2DTextFormat
The destructor. Called when a D2D text format object is being destroyed.
virtual ~CD2DTextFormat();
CD2DTextFormat::CD2DTextFormat
Constructs a CD2DTextFormat object.
CD2DTextFormat(
CRenderTarget* pParentTarget,
const CString& strFontFamilyName,
FLOAT fontSize,
DWRITE_FONT_WEIGHT fontWeight = DWRITE_FONT_WEIGHT_NORMAL,
DWRITE_FONT_STYLE fontStyle = DWRITE_FONT_STYLE_NORMAL,
DWRITE_FONT_STRETCH fontStretch = DWRITE_FONT_STRETCH_NORMAL,
const CString& strFontLocale = _T(""),
IDWriteFontCollection* pFontCollection = NULL,
BOOL bAutoDestroy = TRUE);
Parameters
pParentTarget
A pointer to the render target.
strFontFamilyName
A CString object that contains the name of the font family.
fontSize
The logical size of the font in DIP ("device-independent pixel") units. A DIPequals 1/96 inch.
fontWeight
A value that indicates the font weight for the text object.
fontStyle
A value that indicates the font style for the text object.
fontStretch
A value that indicates the font stretch for the text object.
strFontLocale
A CString object that contains the locale name.
pFontCollection
A pointer to a font collection object. When this is NULL, indicates the system font collection.
bAutoDestroy
Indicates that the object will be destroyed by owner (pParentTarget).
CD2DTextFormat::Create
Creates a CD2DTextFormat.
virtual HRESULT Create(CRenderTarget* */);
Return Value
If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
CD2DTextFormat::Destroy
Destroys a CD2DTextFormat object.
virtual void Destroy();
CD2DTextFormat::Get
Returns IDWriteTextFormat interface
IDWriteTextFormat* Get();
Return Value
Pointer to an IDWriteTextFormat interface or NULL if object is not initialized yet.
CD2DTextFormat::GetFontFamilyName
Gets a copy of the font family name.
CString GetFontFamilyName() const;
Return Value
CString object that contains the current font family name.
CD2DTextFormat::GetLocaleName
Gets a copy of the locale name.
CString GetLocaleName() const;
Return Value
CString object that contains the current locale name.
CD2DTextFormat::IsValid
Checks resource validity
virtual BOOL IsValid() const;
Return Value
TRUE if resource is valid; otherwise FALSE.
CD2DTextFormat::m_pTextFormat
A pointer to an IDWriteTextFormat.
IDWriteTextFormat* m_pTextFormat;
CD2DTextFormat::operator IDWriteTextFormat*
Returns IDWriteTextFormat interface
operator IDWriteTextFormat*();
Return Value
Pointer to an IDWriteTextFormat interface or NULL if object is not initialized yet.
CD2DTextFormat::ReCreate
Re-creates a CD2DTextFormat.
virtual HRESULT ReCreate(CRenderTarget* */);
Return Value
If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.