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
<!-- Standard: monospace font for code -->
<w:rPr>
<w:rFonts w:ascii="Courier New" w:hAnsi="Courier New"/>
</w:rPr>
new RunProperties(
new RunFonts { Ascii = "Courier New", HighAnsi = "Courier New" });
<!-- Theme-based: follows document theme changes -->
<w:rPr>
<w:rFonts w:asciiTheme="majorAscii" w:hAnsiTheme="majorAscii"/>
</w:rPr>
new RunProperties(
new RunFonts { AsciiTheme = ThemeLanguageValues.MajorAscii, HighAnsiTheme = ThemeLanguageValues.MajorAscii });
// Font changes automatically when document theme is changed
<!-- Multilingual: different fonts for Latin, East Asian, and RTL text -->
<w:rPr>
<w:rFonts w:ascii="Calibri" w:hAnsi="Calibri" w:eastAsia="MS Mincho" w:cs="Arial Unicode MS"/>
</w:rPr>
new RunProperties(
new RunFonts
{
Ascii = "Calibri", // Latin characters
HighAnsi = "Calibri",
EastAsia = "MS Mincho", // Japanese, Chinese, Korean
ComplexScript = "Arial Unicode MS" // Arabic, Hebrew, etc.
});
Font Categories
| Font Attribute | Character Range | Use Case | Example |
|---|---|---|---|
w:ascii |
U+0000–U+007F | Latin/ASCII | Calibri, Times New Roman |
w:hAnsi |
U+00A0–U+00FF | Extended Latin | Calibri, Arial |
w:eastAsia |
CJK block | Chinese/Japanese/Korean | MS Mincho, SimSun, Microsoft YaHei |
w:cs |
Complex scripts | Arabic, Hebrew, Devanagari | Arial Unicode MS, Segoe UI |
Theme Slot Options
| Theme Slot | Role |
|---|---|
majorAscii / majorHAnsi |
Primary body/heading font |
minorAscii / minorHAnsi |
Secondary/accent font |
majorEastAsia |
Primary CJK font |
minorEastAsia |
Secondary CJK font |
majorBidi |
Primary RTL font |
minorBidi |
Secondary RTL font |
Extended Font List (Common & Specialized)
Standard Sans-Serif (Recommended for Screen)
| Font | Use Case | Availability | |——|———-|—————| | Calibri | Default modern, professional | Universal | | Arial | Standard sans-serif, fallback | Universal | | Verdana | Screen optimized | Universal | | Tahoma | Clean, narrow | Universal | | Helvetica | Professional, print | Most systems | | Segoe UI | Modern, accessible | Windows/Office |
Standard Serif (Recommended for Print)
| Font | Use Case | Availability | |——|———-|—————| | Times New Roman | Classical, formal documents | Universal | | Georgia | Screen-readable serif | Universal | | Garamond | Elegant, print | Most systems | | Cambria | Math/science documents | Office suites |
Monospace (Code, Technical)
| Font | Use Case | Availability | |——|———-|—————| | Courier New | Typewriter style, code | Universal | | Consolas | Modern code font | Windows/Office | | Monaco | Apple default code font | Mac systems | | Courier | Classic monospace | Universal |
East Asian Fonts
| Font | Script | Use Case | |——|——–|———-| | SimSun | Chinese (Simplified) | Default Chinese | | MS Mincho | Japanese | Print-like Japanese | | Noto Sans CJK | Chinese/Japanese/Korean | Modern, comprehensive | | Microsoft YaHei | Chinese (Modern) | Contemporary Chinese | | Hiragino Sans | Japanese/Mac | Mac Japanese |
Complex Script (RTL, Devanagari, etc.)
| Font | Script | Use Case | |——|——–|———-| | Arial Unicode MS | All Unicode ranges | Universal support | | Segoe UI | Arabic, Hebrew, etc. | Modern, accessible | | Traditional Arabic | Arabic | Arabic-specific | | Simplified Arabic | Arabic | Arabic-specific | | Mangal | Devanagari (Hindi) | Hindi support | | David | Hebrew | Hebrew support |
Theme-Based Font Strategy
Using theme fonts provides automatic consistency:
<!-- Headings use theme's major font -->
<w:rPr>
<w:rFonts w:asciiTheme="majorAscii" w:hAnsiTheme="majorAscii" w:eastAsiaTheme="majorEastAsia"/>
</w:rPr>
<!-- Body uses theme's minor font -->
<w:rPr>
<w:rFonts w:asciiTheme="minorAscii" w:hAnsiTheme="minorAscii" w:eastAsiaTheme="minorEastAsia"/>
</w:rPr>
When document theme is switched, fonts update automatically to maintain brand alignment.
Multilingual Document Example
<w:rPr>
<w:rFonts
w:ascii="Calibri" <!-- English -->
w:hAnsi="Calibri" <!-- Extended Latin -->
w:eastAsia="SimSun" <!-- Chinese -->
w:cs="Arial Unicode MS"/> <!-- Arabic/Hebrew/Devanagari -->
</w:rPr>
This run displays correctly in English, Chinese, Arabic, Hebrew, or mixed text.
Font Fallback Strategy
When specified font is unavailable:
- System attempts to load
w:ascii(ASCII range) - Falls back to
w:hAnsi(if different from ascii) - Falls back to generic sans-serif or system default
- For East Asian:
w:eastAsiaor system CJK font - For RTL:
w:csor system RTL font
Best Practice: Always specify multiple fonts for graceful degradation:
<w:rFonts w:ascii="Segoe UI" w:hAnsi="Arial" />
<!-- If Segoe UI unavailable, use Arial; if both unavailable, use system default -->
Notes
- Theme Precedence: Theme attributes (
w:*Theme) override hard-coded fonts (w:ascii, etc.). - Multilingual Support: Use all four attributes for documents with mixed scripts.
- Font Fallback: If specified font is unavailable, system falls back to default or similar typeface.
- Theme Advantage: Theme-based fonts ensure consistent styling across brand-aligned documents.
- Character Coverage: Ensure chosen fonts cover required character ranges (Latin, CJK, RTL, etc.).
- Web Safety: For documents destined for web, use widely available fonts (Calibri, Arial, Times New Roman, Georgia).
- Performance: Embedding fonts increases file size; use sparingly.
- Accessibility: Ensure font choice is readable at required sizes; avoid decorative fonts for body text.
- Print Consistency: Some fonts render differently in print; test before production.
- Mobile Rendering: Mobile devices may substitute fonts; test on target devices.
- Font Metrics: Different fonts have different metrics (x-height, descender depth); line spacing may vary.
- Complex Script: Always include
w:csfor documents with Arabic, Hebrew, or other complex scripts. - East Asian: Essential for documents with Chinese, Japanese, or Korean text.
- Inheritance: If not specified, font is inherited from applied paragraph style or document defaults.
- Compatibility: Theme fonts render consistently across all Office versions on Office-aware systems.