Page tree
Skip to end of metadata
Go to start of metadata

Description

The Font class is used to specify formatting that should be applied to a character run. It also represents the fonts of named styles in the document.

C#
vb.net

Remarks

There are two ways to obtain an instance of this class. The Document.CreateFont() method creates a new Font object based on the Normal style. Alternately, using NamedStyle.Font, you can create a Font object that is a copy of a particular style's font. The Font object that is returned can then be used in conjunction with methods in the Element class to create character runs, paragraphs, etc, with specific fonts.

The following example demonstrates both ways of getting a font, first by retrieving the Normal style's font from the document, second by retrieving a copy of the Heading1 style's font.

Examples

C#
vb.net

Properties

Name

Description

Animation

Sets or returns a Font.TextAnimation object that represents the text animation for a character run.

Bold

Sets or returns a boolean that represents if a character run is bolded.

Border

Returns a Border object on which you can manipulate the border properties of a character run.

Caps

Sets or returns a boolean that represents if a character run has the All caps effect, formatting lowercase text as capital letters and reducing their size. All caps formatting does not affect numbers, punctutation, non-alphabetic chacters, or uppercase letters.

CharacterScaling

Sets or returns an int that represents the character scaling, stretching or compressing text horizontally as a percentage of its current size. CharacterScaling can be set to a value between 1 and 600 percent. Values beyond these will be automatically adjusted.

CharacterSpacing

Sets or returns an int that represents the spacing between characters in a character run in twips. One twip = (1/20 pt) or ( 1/1440 in). This number can be negative (decreased spacing) or positive (increased spacing).

DoubleStrike

Sets or returns a boolean that represents if a character run has the Double strikethrough effect, displaying a double line through the text.

Embossed

Sets or returns a boolean that represents if a character run has the Emboss effect, displaying the text as if it is raised off the page in relief.

Engraved

Sets or returns a boolean that represents if a character run has the Engrave effect, making the text to be imprinted or pressed into the page.

FontName

Sets or returns a String that represents the name of the font used in this formatting.

FontSize

Sets or returns an float that represents the font size for a character run. The font size will always be a multiple of 0.5.

Hidden

Sets or returns a boolean that represents if a character run has the Hidden effect set. If set to true, this font will only be displayed when the display hidden flag is turned on for the containing document.

Highlight

Sets or returns the highlight color for a character run as a Color object.

HyphenationRule

Sets or returns a Font.Hyphenation object that represents the hyphenation rule for a character run.

Italic

Sets or returns a boolean that represents if a character run is italicized.

Kerning

Sets or returns a double that represents the kerning threshold for a character run in points.

NoProofChecking

Sets or returns a boolean that represents if Word will not perform grammar and spell checking on a character run when the document is opened.

Outlined

Sets or returns a boolean that represents if a character run has the the Outline effect, displaying the inner and outer borders of each character. (This effect is not available for all fonts.)

Shading

Returns a Shading object which on which you can manipulate the shading (fill color and/or pattern) properties of a character run.

Shadow

Sets or returns a boolean that represents if a character run has the Shadow effect, displaying a shadow behind, beneath and to the right of each character.

SmallCaps

Sets or returns a boolean that represents if a character run has the Small caps effect, formatting lowercase text as capital letters and reducing their size. Small caps formatting does not affect numbers, punctutation, non-alphabetic chacters, or uppercase letters.

SuperSubScript

Sets or returns a ScriptType object that represents whether the text in this formatting is set to superscript, subscript, or none.

Strike

Sets or returns a boolean that represents if a character run has the Strikethrough effect, displaying a single line through the text.

TextColor

Sets or returns the color of the text in a character run as a Color object.

Underline

Sets or returns a Font.UnderlineType object that represents the underline type for this formatting.

UnderlineColor

Sets or returns the underline color for a character run as a Color object.

VerticalPosition

Sets or returns a double that represents the vertical position for a character run in half points, lowering or raising the text in relation to the baseline. (For example, 2 points would be 4 half points.)

Nested Classes

Name

Description

Hyphenation

Types of hyphenation rules that can be applied to a character run.

ScriptType

Values used to represent whether a character run is formatting as superscript, subscript, or neither.

TextAnimation

Types of text animation that can be set on a character run.

UnderlineType

Types of underlines that can be applied to a character run.
  • No labels