Skip to main content

Font Dialog

  • 2 minutes to read

Overview

The Font dialog allows users to specify different font settings: character size, style, and color.

Click the Font group’s dialog box launcher on the Home ribbon tab to invoke the Font dialog.

Rich Text Editor - Invoke Font Dialog from Ribbon

Refer to the following topic for information on how to provide the Ribbon UI for the RichEditControl: Create a Simple Rich Text Editor.

You can also press Ctrl + D or use the context menu item to invoke this dialog.

Rich Text Editor - Context Menu

The dialog ships with the following tabs:

Font

Options on this tab allow users to change the font name, size and style, enable underline and font effects.

Rich Text Editor - Font Tab of the Font Dialog

The following API allows you to specify the Font options in code:

Tip

Use the SubDocument.BeginUpdateCharacters and SubDocument.EndUpdateCharacters pair of methods to access the CharacterProperties members and modify character properties in code.

API Description
CharacterPropertiesBase.FontName Gets or sets the font name.
CharacterPropertiesBase.FontSize Specifies the font size.
CharacterPropertiesBase.Italic
CharacterPropertiesBase.Bold
Specify the font style.
CharacterPropertiesBase.ForeColor Gets or sets the font color
CharacterPropertiesBase.Underline Specifies the underline type.
CharacterPropertiesBase.UnderlineColor Specifies the underline color.
CharacterPropertiesBase.Strikeout Gets or sets the strikeout type.
CharacterPropertiesBase.Subscript Gets or sets whether characters are subscript.
CharacterPropertiesBase.Superscript Gets or sets whether characters are superscript.
CharacterPropertiesBase.SmallCaps Gets or sets whether all characters are small capital letters.
CharacterPropertiesBase.AllCaps Gets or sets whether characters are capital letters.
CharacterPropertiesBase.Hidden Specifies whether characters are hidden.

Refer to the following topic for an example on how to change character properties in code: How to: Change Formatting of Selected Text.

Advanced

Options on this tab allow users to change character spacing options: scale percentage, spacing between characters, position and kerning.

Rich Text Editor - Advanced Tab of the Font Dialog

The table below lists API you can use to specify Advanced options:

API Description
CharacterPropertiesBase.Scale Gets or sets the characters’ scaling percentage.
CharacterPropertiesBase.Spacing Specifies the spacing between characters.
CharacterPropertiesBase.Position Gets or sets the characters’ position relative to the base line.
CharacterPropertiesBase.KerningThreshold Specifies the minimum font size for which the kerning is adjusted automatically.
CharacterPropertiesBase.SnapToGrid Gets or sets whether to snap characters to a grid when the grid is defined.

Refer to the following topic for an example on how to change character properties in code: How to: Change Formatting of Selected Text.

Invoke the Dialog in Code

Execute the ShowFontFormCommand command to invoke the Font dialog.