I​Text​Character​Format I​Text​Character​Format I​Text​Character​Format Interface

Definition

Defines the default character formatting attributes of a document, or the current character formatting attributes of a text range.

public interface ITextCharacterFormatpublic interface ITextCharacterFormatPublic Interface ITextCharacterFormat
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Properties

AllCaps AllCaps AllCaps

Gets or sets whether the characters are all uppercase.

public FormatEffect AllCaps { get; set; }public FormatEffect AllCaps { get; set; }Public ReadWrite Property AllCaps As FormatEffect
Value
FormatEffect FormatEffect FormatEffect

The uppercase state.

Attributes

BackgroundColor BackgroundColor BackgroundColor

Gets or sets the text background (highlight) color.

public Color BackgroundColor { get; set; }public Color BackgroundColor { get; set; }Public ReadWrite Property BackgroundColor As Color
Value
Color Color Color

The text background color.

Attributes

Bold Bold Bold

Gets or sets whether the characters are bold.

public FormatEffect Bold { get; set; }public FormatEffect Bold { get; set; }Public ReadWrite Property Bold As FormatEffect
Value
FormatEffect FormatEffect FormatEffect

The bold state.

Attributes

FontStretch FontStretch FontStretch

Gets or sets the degree to which the font is stretched, compared to the normal aspect ratio of the font.

public FontStretch FontStretch { get; set; }public FontStretch FontStretch { get; set; }Public ReadWrite Property FontStretch As FontStretch
Value
FontStretch FontStretch FontStretch

The degree to which the font is stretched.

Attributes

FontStyle FontStyle FontStyle

Gets or sets the style of the font face, such as normal or italic.

public FontStyle FontStyle { get; set; }public FontStyle FontStyle { get; set; }Public ReadWrite Property FontStyle As FontStyle
Value
FontStyle FontStyle FontStyle

The font style.

Attributes

ForegroundColor ForegroundColor ForegroundColor

Gets or sets the foreground, or text, color.

public Color ForegroundColor { get; set; }public Color ForegroundColor { get; set; }Public ReadWrite Property ForegroundColor As Color
Value
Color Color Color

The foreground color.

Attributes

Hidden Hidden Hidden

Gets or sets whether characters are hidden.

public FormatEffect Hidden { get; set; }public FormatEffect Hidden { get; set; }Public ReadWrite Property Hidden As FormatEffect
Value
FormatEffect FormatEffect FormatEffect

The hidden state.

Attributes

Italic Italic Italic

Gets or sets whether characters are in italics.

public FormatEffect Italic { get; set; }public FormatEffect Italic { get; set; }Public ReadWrite Property Italic As FormatEffect
Value
FormatEffect FormatEffect FormatEffect

The italicized state.

Attributes

Kerning Kerning Kerning

Gets or sets the minimum font size at which kerning occurs.

public float Kerning { get; set; }public float Kerning { get; set; }Public ReadWrite Property Kerning As float
Value
float float float

The kerning size, in floating-point points.

Attributes

Remarks

If the value is zero, kerning is turned off. Positive values turn on pair kerning for font point sizes greater than or equal to the kerning value. For example, the value 1 turns on kerning for all legible sizes, whereas 16 turns on kerning only for font sizes of 16 points and larger.

LanguageTag LanguageTag LanguageTag

Gets or sets the Internet Engineering Task Force (IETF) language tag (BCP 47 standard) that identifies the language currently associated with the characters.

public string LanguageTag { get; set; }public string LanguageTag { get; set; }Public ReadWrite Property LanguageTag As string
Value
string string string

The language tag.

Attributes

LinkType LinkType LinkType

Gets the link type of the text.

public LinkType LinkType { get; }public LinkType LinkType { get; }Public ReadOnly Property LinkType As LinkType
Value
LinkType LinkType LinkType

The link type.

Attributes

Name Name Name

Gets or sets the font name.

public string Name { get; set; }public string Name { get; set; }Public ReadWrite Property Name As string
Value
string string string

The font name.

Attributes

Outline Outline Outline

Gets or sets whether characters are displayed as outlined characters.

public FormatEffect Outline { get; set; }public FormatEffect Outline { get; set; }Public ReadWrite Property Outline As FormatEffect
Value
FormatEffect FormatEffect FormatEffect

The outlined state.

Attributes

Position Position Position

Gets or sets the character offset relative to the baseline.

public float Position { get; set; }public float Position { get; set; }Public ReadWrite Property Position As float
Value
float float float

The character offset, in floating-point points.

Attributes

Remarks

Typically, the value of this property is zero. Positive values raise the characters relative to the baseline, and negative values lower them.

ProtectedText ProtectedText ProtectedText

Gets or sets whether the characters are protected against attempts to modify them.

public FormatEffect ProtectedText { get; set; }public FormatEffect ProtectedText { get; set; }Public ReadWrite Property ProtectedText As FormatEffect
Value
FormatEffect FormatEffect FormatEffect

The protected state.

Attributes

Remarks

In general, calling methods in the Windows.UI.Text namespace that attempt to change the formatting or content of a text range will fail if any part of the range is protected, or if the document is read-only. To change protected text, an app should attempt to turn off the protection of the text to be modified. The owner of the document might permit this to happen.

Size Size Size

Gets or sets the font size.

public float Size { get; set; }public float Size { get; set; }Public ReadWrite Property Size As float
Value
float float float

The font size, in floating-point points.

Attributes

SmallCaps SmallCaps SmallCaps

Gets or sets whether characters are in small capital letters.

public FormatEffect SmallCaps { get; set; }public FormatEffect SmallCaps { get; set; }Public ReadWrite Property SmallCaps As FormatEffect
Value
FormatEffect FormatEffect FormatEffect

The small capitals state.

Attributes

Spacing Spacing Spacing

Gets or sets the amount of horizontal spacing between characters.

public float Spacing { get; set; }public float Spacing { get; set; }Public ReadWrite Property Spacing As float
Value
float float float

The amount of horizontal spacing, in floating-point points.

Attributes

Remarks

Typically, the value of this property is zero. Positive values increase the horizontal spacing between characters, and negative values decrease it.

Strikethrough Strikethrough Strikethrough

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

public FormatEffect Strikethrough { get; set; }public FormatEffect Strikethrough { get; set; }Public ReadWrite Property Strikethrough As FormatEffect
Value
FormatEffect FormatEffect FormatEffect

The strikethrough state.

Attributes

Subscript Subscript Subscript

Gets or sets whether characters are displayed as subscript.

public FormatEffect Subscript { get; set; }public FormatEffect Subscript { get; set; }Public ReadWrite Property Subscript As FormatEffect
Value
FormatEffect FormatEffect FormatEffect

The subscript state.

Attributes

Superscript Superscript Superscript

Gets or sets whether characters are displayed as superscript.

public FormatEffect Superscript { get; set; }public FormatEffect Superscript { get; set; }Public ReadWrite Property Superscript As FormatEffect
Value
FormatEffect FormatEffect FormatEffect

The superscript state.

Attributes

TextScript TextScript TextScript

Gets or sets the character repertoire.

public TextScript TextScript { get; set; }public TextScript TextScript { get; set; }Public ReadWrite Property TextScript As TextScript
Value
TextScript TextScript TextScript

The character repertoire.

Attributes

Remarks

To learn more about character repertoires, see RichEdit Font Binding. Character repertoires are typically scripts like Arabic and Latin, but there are also character repertoires for symbols and Emoji.

Underline Underline Underline

Gets or sets the type of underlining that the characters use.

public UnderlineType Underline { get; set; }public UnderlineType Underline { get; set; }Public ReadWrite Property Underline As UnderlineType
Value
UnderlineType UnderlineType UnderlineType

The type of underlining.

Attributes

Weight Weight Weight

Gets or sets the font weight of the characters.

public int Weight { get; set; }public int Weight { get; set; }Public ReadWrite Property Weight As int
Value
int int int

The font weight expressed as a numeric value. See Remarks.

Attributes

Remarks

In standard typography API, the weight of a font is typically expressed as a constant name, such as "Bold". Using constant names to set the Weight property is supported through type converter behaviors and by the FontWeights support class.

The FontWeights values correspond to the "usWeightClass" definition in the OpenType specification. The "usWeightClass" represents an integer value between 1 and 999. Lower values indicate lighter weights; higher values indicate heavier weights.

Methods

GetClone() GetClone() GetClone()

Creates a new object that is identical to this character format object.

public ITextCharacterFormat GetClone()public ITextCharacterFormat GetClone()Public Function GetClone() As ITextCharacterFormat
Returns

The duplicate character format object.

Attributes

IsEqual(ITextCharacterFormat) IsEqual(ITextCharacterFormat) IsEqual(ITextCharacterFormat)

Determines whether this character format object has the same properties as the specified character format object.

public bool IsEqual(ITextCharacterFormat format)public bool IsEqual(ITextCharacterFormat format)Public Function IsEqual(format As ITextCharacterFormat) As bool
Parameters
format
ITextCharacterFormat ITextCharacterFormat ITextCharacterFormat

The character format object to compare against.

Returns
bool bool bool

True if the objects have the same properties, or false if they don't.

Attributes

SetClone(ITextCharacterFormat) SetClone(ITextCharacterFormat) SetClone(ITextCharacterFormat)

Sets the character formatting by copying another text character formatting object.

public void SetClone(ITextCharacterFormat value)public void SetClone(ITextCharacterFormat value)Public Function SetClone(value As ITextCharacterFormat) As void
Parameters
value
ITextCharacterFormat ITextCharacterFormat ITextCharacterFormat

The character formatting to apply.

Attributes

Remarks

Any character formatting values that are undefined in value have no effect.