Skip to content

Latest commit

 

History

History
142 lines (110 loc) · 3.92 KB

nf-tom-itextrange-setfont.md

File metadata and controls

142 lines (110 loc) · 3.92 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:tom.ITextRange.SetFont
ITextRange::SetFont (tom.h)
Sets this range's character attributes to those of the specified ITextFont object.
ITextRange interface [Windows Controls]
SetFont method
ITextRange.SetFont
ITextRange::SetFont
SetFont
SetFont method [Windows Controls]
SetFont method [Windows Controls]
ITextRange interface
_win32_ITextRange_SetFont
_win32_ITextRange_SetFont_cpp
controls.ITextRange_SetFont
controls._win32_ITextRange_SetFont
tom/ITextRange::SetFont
controls\ITextRange_SetFont.htm
Controls
VS|Controls|~\controls\richedit\textobjectmodel\textobjectmodelreference\textobjectmodelinterfaces\setfont.htm
12/05/2018
ITextRange interface [Windows Controls],SetFont method, ITextRange.SetFont, ITextRange::SetFont, SetFont, SetFont method [Windows Controls], SetFont method [Windows Controls],ITextRange interface, _win32_ITextRange_SetFont, _win32_ITextRange_SetFont_cpp, controls.ITextRange_SetFont, controls._win32_ITextRange_SetFont, tom/ITextRange::SetFont
tom.h
Windows
Windows Vista [desktop apps only]
Windows Server 2003 [desktop apps only]
Msftedit.dll
Windows
19H1
ITextRange::SetFont
tom/ITextRange::SetFont
c++
APIRef
kbSyntax
COM
Msftedit.dll
ITextRange.SetFont

ITextRange::SetFont

-description

Sets this range's character attributes to those of the specified ITextFont object.

-parameters

-param pFont [in]

Type: ITextFont*

A font object with the desired character format.

-returns

Type: HRESULT

The method returns an HRESULT value. If the method succeeds, it returns S_OK. If the method fails, it returns one of the following error codes. For more information about COM error codes, see Error Handling in COM.

Return code Description
Value
Meaning
E_ACCESSDENIED
Text is protected.
E_INVALIDARG
pFont is null.
E_OUTOFMEMORY
Out of memory.

-remarks

For occasional format changes, use the ITextRange::SetFont method. However, to make a number of character formatting changes, it is more efficient to use a font duplicate. This is because every time you execute a statement like range.font.bold = tomTrue, a font object is allocated and freed. However, a font duplicate can be allocated once and used many times. Furthermore, you can save the font duplicate, reset it to the default or undefined states with the Reset method, and give it values as needed for your rich-text processing. For sample code that shows how to use font duplicates, see Using a Font Duplicate.

-see-also

Conceptual

ITextRange

Reference

Reset

Text Object Model