Font Dialog
- 2 minutes to read
Overview
The Font dialog enables users to specify different font settings: character size, style, color, etc.
Users can click the Font group’s dialog box launcher on the Home ribbon tab to invoke the Font dialog. Refer to the Create a Simple Rich Text Editor topic for details on how to provide the Ribbon UI for the RichEditControl.
You can also press CTRL+D or use the context menu item to invoke this dialog.
The dialog ships with the following tabs:
Font
Options under this tab allow users to change the font name, size and style, enable underline and font effects.
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.AllCaps | Gets or sets whether characters are capital letters. |
CharacterPropertiesBase.Hidden | Specifies whether characters are hidden. |
Advanced
Options under this tab allow users to change character spacing options: scale percentage, spacing between characters, position and kerning.
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. |
Invoke the Dialog in Code
Execute the ShowFontFormCommand command to invoke the Font dialog.
Refer to the How to: Change Formatting of Selected Text article for an example on how to change character properties in code.