w:rFonts (Run Fonts)
Specifies the font family to use for the run, with separate settings for ASCII, East Asian, complex script, and high-ANSI characters.
Parent elements
Description
w:rFonts specifies the font family (typeface) for the run. It is defined in ECMA-376 Part 1 §17.3.2.26.
Because a single run can contain characters from multiple Unicode planes (Latin, East Asian, complex script), separate attributes target each category. The font theme attributes (w:asciiTheme, etc.) allow font selection that tracks the document theme, so fonts change automatically when the theme is switched.
Attributes
| Attribute | Type | Possible Values | Description |
|---|---|---|---|
w:ascii |
ST_String |
Any font family name, e.g. Calibri, Times New Roman |
Font for characters in the ASCII range (U+0000–U+007F). |
w:hAnsi |
ST_String |
Any font family name | Font for high-ANSI range characters (U+00A0–U+00FF). |
w:eastAsia |
ST_String |
Any font family name, e.g. MS Mincho, SimSun |
Font for East Asian characters. |
w:cs |
ST_String |
Any font family name, e.g. Arial Unicode MS |
Font for complex-script characters (bidirectional text). |
w:asciiTheme |
ST_Theme |
majorAscii, minorAscii, majorHAnsi, minorHAnsi, majorEastAsia, minorEastAsia, majorBidi, minorBidi |
Theme-slot for ASCII font (overrides w:ascii when the document theme defines it). |
w:hAnsiTheme |
ST_Theme |
Same values as w:asciiTheme |
Theme-slot for high-ANSI font. |
w:eastAsiaTheme |
ST_Theme |
Same values as w:asciiTheme |
Theme-slot for East Asian font. |
w:cstheme |
ST_Theme |
Same values as w:asciiTheme |
Theme-slot for complex-script font. |
Examples
<w:rPr>
<w:rFonts w:ascii="Courier New" w:hAnsi="Courier New"/>
</w:rPr>
new RunProperties(
new RunFonts { Ascii = "Courier New", HighAnsi = "Courier New" });
Notes
- When
w:asciiThemeis set, it takes precedence overw:ascii. - If neither
w:asciinorw:asciiThemeis specified, the font is inherited from the applied style or document defaults.