ITextFont interface (tom.h)
Text Object Model (TOM) rich text-range attributes are accessed through a pair of dual interfaces, ITextFont and ITextPara.
Inheritance
The ITextFont interface inherits from the IUnknown interface. ITextFont also has these types of members:
Methods
The ITextFont interface has these methods.
| Method | Description |
|---|---|
| ITextFont::CanChange | Determines whether the font can be changed. |
| ITextFont::GetAllCaps | Gets whether the characters are all uppercase. |
| ITextFont::GetAnimation | Gets the animation type. |
| ITextFont::GetBackColor | Gets the text background (highlight) color. |
| ITextFont::GetBold | Gets whether the characters are bold. |
| ITextFont::GetDuplicate | Gets a duplicate of this text font object. |
| ITextFont::GetEmboss | Gets whether characters are embossed. |
| ITextFont::GetEngrave | Gets whether characters are displayed as imprinted characters. |
| ITextFont::GetForeColor | Gets the foreground, or text, color. |
| ITextFont::GetHidden | Gets whether characters are hidden. |
| ITextFont::GetItalic | Gets whether characters are in italics. |
| ITextFont::GetKerning | Gets the minimum font size at which kerning occurs. |
| ITextFont::GetLanguageID | Gets the language ID or language code identifier (LCID). |
| ITextFont::GetName | Gets the font name. |
| ITextFont::GetOutline | Gets whether characters are displayed as outlined characters. |
| ITextFont::GetPosition | Gets the amount that characters are offset vertically relative to the baseline. |
| ITextFont::GetProtected | Gets whether characters are protected against attempts to modify them. |
| ITextFont::GetShadow | Gets whether characters are displayed as shadowed characters. |
| ITextFont::GetSize | Gets the font size. |
| ITextFont::GetSmallCaps | Gets whether characters are in small capital letters. |
| ITextFont::GetSpacing | Gets the amount of horizontal spacing between characters. |
| ITextFont::GetStrikeThrough | Gets whether characters are displayed with a horizontal line through the center. |
| ITextFont::GetStyle | Gets the character style handle of the characters in a range. |
| ITextFont::GetSubscript | Gets whether characters are displayed as subscript. |
| ITextFont::GetSuperscript | Gets whether characters are displayed as superscript. |
| ITextFont::GetUnderline | Gets the type of underlining for the characters in a range. |
| ITextFont::GetWeight | Gets the font weight for the characters in a range. |
| ITextFont::IsEqual | Determines whether this text font object has the same properties as the specified text font object. |
| ITextFont::Reset | Resets the character formatting to the specified values. |
| ITextFont::SetAllCaps | Sets whether the characters are all uppercase. |
| ITextFont::SetAnimation | Sets the animation type. |
| ITextFont::SetBackColor | Sets the background color. |
| ITextFont::SetBold | Sets whether characters are bold. |
| ITextFont::SetDuplicate | Sets the character formatting by copying another text font object. |
| ITextFont::SetEmboss | Sets whether characters are embossed. |
| ITextFont::SetEngrave | Sets whether characters are displayed as imprinted characters. |
| ITextFont::SetForeColor | Sets the foreground (text) color. |
| ITextFont::SetHidden | Sets whether characters are hidden. |
| ITextFont::SetItalic | Sets whether characters are in italics. |
| ITextFont::SetKerning | Sets the minimum font size at which kerning occurs. |
| ITextFont::SetLanguageID | Sets the language ID or language code identifier (LCID). |
| ITextFont::SetName | Sets the font name. |
| ITextFont::SetOutline | Sets whether characters are displayed as outlined characters. |
| ITextFont::SetPosition | Sets the amount that characters are offset vertically relative to the baseline. |
| ITextFont::SetProtected | Sets whether characters are protected against attempts to modify them. |
| ITextFont::SetShadow | Sets whether characters are displayed as shadowed characters. |
| ITextFont::SetSize | Sets the font size. |
| ITextFont::SetSmallCaps | Sets whether characters are in small capital letters. |
| ITextFont::SetSpacing | Sets the amount of horizontal spacing between characters. |
| ITextFont::SetStrikeThrough | Sets whether characters are displayed with a horizontal line through the center. |
| ITextFont::SetStyle | Sets the character style handle of the characters in a range. |
| ITextFont::SetSubscript | Sets whether characters are displayed as subscript. |
| ITextFont::SetSuperscript | Sets whether characters are displayed as superscript. |
| ITextFont::SetUnderline | Sets the type of underlining for the characters in a range. |
| ITextFont::SetWeight | Sets the font weight for the characters in a range. |
Remarks
The ITextFont and ITextPara interfaces encapsulate the functionality of the Microsoft Word Format Font and Paragraph dialog boxes, respectively. Both interfaces include a duplicate (Value) property that can return a duplicate of the attributes in a range object or transfer a set of attributes to a range. As such, they act like programmable format painters. For example, you could transfer all attributes from range r1 to range r2 except for making r2 bold and the font size 12 points by using the following subroutine.
Sub AttributeCopy(r1 As ITextRange, r2 As ITextRange)
Dim tf As ITextFont
tf = r1.Font ' Value is the default property
tf.Bold = tomTrue ' You can make some modifications
tf.Size = 12
tf.Animation = tomSparkleText
r2.Font = tf ' Apply font attributes all at once
End Sub
See SetFont for a similar example written in C++.
The ITextFont attribute interface represents the traditional Microsoft Visual Basic for Applications (VBA) way of setting properties and it gives the desired VBA notation.
ITextFont uses the "tomBool" type for rich-text attributes that have binary states. For more information, see The tomBool Type.
The rich edit control is able to accept and return all ITextFont properties intact, that is, without modification, both through TOM and through its Rich Text Format (RTF) converters. However, it cannot display the All Caps, Animation, Embossed, Imprint, Shadow, Small Caps, Hidden, Kerning, Outline, and Style font properties.
Requirements
| Minimum supported client | Windows Vista [desktop apps only] |
| Minimum supported server | Windows Server 2003 [desktop apps only] |
| Target Platform | Windows |
| Header | tom.h |
See also
Conceptual