Export (0) Print
Expand All

ITextFont interface

Text Object Model (TOM) rich text-range attributes are accessed through a pair of dual interfaces, ITextFont and ITextPara.

When to implement

Applications typically do not implement the ITextFont interface. Microsoft text solutions, such as rich edit controls, implement ITextFont as part of their TOM implementation.

When to use

Applications can retrieve an ITextFont pointer for a text range by calling the GetFont method.

Members

The ITextFont interface inherits from the IUnknown interface. ITextFont also has these types of members:

Methods

The ITextFont interface has these methods.

MethodDescription
CanChange

Determines whether the font can be changed.

GetAllCaps

Gets whether the characters are all uppercase.

GetAnimation

Gets the animation type.

GetBackColor

Gets the text background (highlight) color.

GetBold

Gets whether the characters are bold.

GetDuplicate

Gets a duplicate of this text font object.

GetEmboss

Gets whether characters are embossed.

GetEngrave

Gets whether characters are displayed as imprinted characters.

GetForeColor

Gets the foreground, or text, color.

GetHidden

Gets whether characters are hidden.

GetItalic

Gets whether characters are in italics.

GetKerning

Gets the minimum font size at which kerning occurs.

GetLanguageID

Gets the language ID or LCID.

GetName

Gets the font name.

GetOutline

Gets whether characters are displayed as outlined characters.

GetPosition

Gets the amount that characters are offset vertically relative to the baseline.

GetProtected

Gets whether characters are protected against attempts to modify them.

GetShadow

Gets whether characters are displayed as shadowed characters.

GetSize

Gets the font size.

GetSmallCaps

Gets whether characters are in small capital letters.

GetSpacing

Gets the amount of horizontal spacing between characters.

GetStrikeThrough

Gets whether characters are displayed with a horizontal line through the center.

GetStyle

Gets the character style handle of the characters in a range.

GetSubscript

Gets whether characters are displayed as subscript.

GetSuperscript

Gets whether characters are displayed as superscript.

GetUnderline

Gets the type of underlining for the characters in a range.

GetWeight

Gets the font weight for the characters in a range.

IsEqual

Determines whether this text font object has the same properties as the specified text font object.

Reset

Resets the character formatting to the specified values.

SetAllCaps

Sets whether the characters are all uppercase.

SetAnimation

Sets the animation type.

SetBackColor

Sets the background color.

SetBold

Sets whether characters are bold.

SetDuplicate

Sets the character formatting by copying another text font object.

SetEmboss

Sets whether characters are embossed.

SetEngrave

Sets whether characters are displayed as imprinted characters.

SetForeColor

Sets the foreground (text) color.

SetHidden

Sets whether characters are hidden.

SetItalic

Sets whether characters are in italics.

SetKerning

Sets the minimum font size at which kerning occurs.

SetLanguageID

Sets the language ID or LCID.

SetName

Sets the font name.

SetOutline

Sets whether characters are displayed as outlined characters.

SetPosition

Sets the amount that characters are offset vertically relative to the baseline.

SetProtected

Sets whether characters are protected against attempts to modify them.

SetShadow

Sets whether characters are displayed as shadowed characters.

SetSize

Sets the font size.

SetSmallCaps

Sets whether characters are in small capital letters.

SetSpacing

Sets the amount of horizontal spacing between characters.

SetStrikeThrough

Sets whether characters are displayed with a horizontal line through the center.

SetStyle

Sets the character style handle of the characters in a range.

SetSubscript

Sets whether characters are displayed as subscript.

SetSuperscript

Sets whether characters are displayed as superscript.

SetUnderline

Sets the type of underlining for the characters in a range.

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 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Tom.h

DLL

Msftedit.dll

See also

Conceptual
Text Object Model
Using The Text Object Model

 

 

Community Additions

ADD
Show:
© 2014 Microsoft