a:font (Font Specification)
Specifies a font name and script type for text rendering.
Description
\:font\ is the DrawingML element that specifies a font name for text rendering. It is defined in ECMA-376 Part 1 §21.1.2.3.4.
Font elements provide:
- Font family selection: Choose which typeface renders text
- Script support: Support for Latin, East Asian, Complex Script, Symbol fonts
- Fallback behavior: Define preferred font with alternatives
- Cross-platform consistency: Ensure text renders identically
- Semantic font roles: Differentiate font purposes (body, heading, code)
Font elements are typically used within:
- a:latin — Latin script font (Western text)
- a:ea — East Asian font (CJK text)
- a:cs — Complex Script font (Arabic, Hindi, etc.)
- a:sym — Symbol font (special characters)
Fonts differ from:
- Font reference (\:fontRef) — Theme-based font reference
- Bullet font (\:buFont) — Font for bullet characters
- Text properties (\:txPr) — Container for font and formatting
Attributes
| Attribute | Type | Description |
|---|---|---|
| \ ypeface\ | String | Font family name (e.g., “Arial”, “Times New Roman”) |
| \pitchFamily\ | Byte | Font pitch/family (0 = default, 1 = fixed, 2 = variable) |
| \charset\ | Byte | Character set identifier (0-255) |
Content Model
\:font\ has no child elements. It is a self-closing element.
xml
<a:font typeface="Arial" pitchFamily="2"/>
Examples
Standard Arial Font
<a:rPr>
<a:latin typeface="Arial" pitchFamily="2"/>
</a:rPr>
<a:t>Standard text</a:t>
using DocumentFormat.OpenXml.Drawing;
var rPr = new RunProperties();
var latin = new LatinFont { Typeface = "Arial", PitchFamily = 2 };
rPr.Append(latin);
var run = new Run { Properties = rPr };
run.Append(new Text { Text = "Standard text" });
Times New Roman (Serif) Font
<a:rPr>
<a:latin typeface="Times New Roman" pitchFamily="2"/>
<a:sz val="2400"/>
</a:rPr>
<a:t>Formal text</a:t>
var rPr = new RunProperties();
var latin = new LatinFont { Typeface = "Times New Roman", PitchFamily = 2 };
rPr.Append(latin);
rPr.Append(new FontSize { Val = 2400 });
var run = new Run { Properties = rPr };
run.Append(new Text { Text = "Formal text" });
Courier New (Monospace/Fixed) Font
<a:rPr>
<a:latin typeface="Courier New" pitchFamily="1"/>
</a:rPr>
<a:t>Code text</a:t>
var rPr = new RunProperties();
var latin = new LatinFont { Typeface = "Courier New", PitchFamily = 1 };
rPr.Append(latin);
var run = new Run { Properties = rPr };
run.Append(new Text { Text = "Code text" });
East Asian Font (Chinese)
<a:rPr>
<a:latin typeface="Calibri"/>
<a:ea typeface="SimSun" pitchFamily="2"/>
</a:rPr>
<a:t>English and 中文</a:t>
var rPr = new RunProperties();
var latin = new LatinFont { Typeface = "Calibri" };
rPr.Append(latin);
var ea = new EastAsianFont { Typeface = "SimSun", PitchFamily = 2 };
rPr.Append(ea);
var run = new Run { Properties = rPr };
run.Append(new Text { Text = "English and 中文" });
Complex Script Font (Arabic/Hebrew)
<a:rPr>
<a:latin typeface="Calibri"/>
<a:cs typeface="Calibri" pitchFamily="2"/>
</a:rPr>
<a:t>English and العربية</a:t>
var rPr = new RunProperties();
var latin = new LatinFont { Typeface = "Calibri" };
rPr.Append(latin);
var cs = new ComplexScriptFont { Typeface = "Calibri", PitchFamily = 2 };
rPr.Append(cs);
var run = new Run { Properties = rPr };
run.Append(new Text { Text = "English and العربية" });
Symbol Font (Special Characters)
<a:rPr>
<a:sym typeface="Wingdings" pitchFamily="2"/>
</a:rPr>
<a:t>✓ ★ ◆</a:t>
var rPr = new RunProperties();
var sym = new SymbolFont { Typeface = "Wingdings", PitchFamily = 2 };
rPr.Append(sym);
var run = new Run { Properties = rPr };
run.Append(new Text { Text = "✓ ★ ◆" });
Font Categories
Serif Fonts (Traditional)
| Font | Typeface | Use |
|---|---|---|
| Times New Roman | Serif | Formal documents |
| Georgia | Serif | Web-safe serif |
| Garamond | Serif | Professional printing |
| Cambria | Serif | Modern serif |
Sans-Serif Fonts (Modern)
| Font | Typeface | Use |
|---|---|---|
| Arial | Sans-serif | Standard, universal |
| Verdana | Sans-serif | Web-safe sans |
| Calibri | Sans-serif | Default Office font |
| Helvetica | Sans-serif | Clean, professional |
| Segoe UI | Sans-serif | Windows modern |
Monospace Fonts (Fixed-width)
| Font | Typeface | Use |
|---|---|---|
| Courier New | Fixed | Code/terminal |
| Consolas | Fixed | Modern code |
| Monaco | Fixed | Mac code |
| Liberation Mono | Fixed | Linux code |
Symbol/Dingbat Fonts
| Font | Typeface | Characters |
|---|---|---|
| Wingdings | Symbol | ★✓◆→ |
| Wingdings 2 | Symbol | Extended symbols |
| Wingdings 3 | Symbol | Specialized |
| Symbol | Symbol | Greek/Math |
| Marlett | Symbol | UI elements |
East Asian Fonts
| Font | Language | Coverage |
|---|---|---|
| SimSun | Chinese (Simplified) | CJK |
| SimHei | Chinese (Simplified) | Simplified boldface |
| MingLiU | Chinese (Traditional) | CJK |
| MS Gothic | Japanese | CJK |
| Malgun Gothic | Korean | CJK |
Middle East/Complex Scripts
| Font | Language | Coverage |
|---|---|---|
| Calibri | Arabic/Hebrew | RTL scripts |
| Traditional Arabic | Arabic | Arabic-specific |
| Simplified Arabic | Arabic | Simplified |
| Miriam Fixed | Hebrew | Hebrew |
| Mangal | Hindi/Devanagari | Indic |
Pitch Family Attribute
| Value | Type | Characteristic | Use |
|---|---|---|---|
| 0 | Default | Automatic selection | Standard text |
| 1 | Fixed Pitch | Monospace (Courier, Consolas) | Code, technical |
| 2 | Variable Pitch | Proportional spacing (Arial, Times) | General text |
Note: Pitch family 0 allows the renderer to substitute appropriate fonts.
Character Set Attribute
| Value | Charset | Characters | Use |
|---|---|---|---|
| 0 | ANSI | ASCII 0-127, 128-255 | Western European |
| 1 | DEFAULT | System default | Auto-detect |
| 2 | SYMBOL | Symbol fonts | Special characters |
| 77 | MAC | Macintosh | Legacy |
| 128 | SHIFTJIS | Japanese | CJK |
| 129 | HANGEUL | Korean | CJK |
| 134 | GB2312 | Chinese Simplified | CJK |
| 136 | CHINESEBIG5 | Chinese Traditional | CJK |
| 161 | GREEK | Greek | European |
| 162 | TURKISH | Turkish | European |
| 177 | HEBREW | Hebrew | Middle East |
| 178 | ARABIC | Arabic | Middle East |
| 186 | VIETNAMESE | Vietnamese | Asian |
Font Hierarchy in Run Properties
Typical text formatting structure:
xml
<a:rPr>
<a:latin typeface="Calibri"/>
<a:ea typeface="SimSun"/>
<a:cs typeface="Calibri"/>
<a:sym typeface="Wingdings"/>
</a:rPr>
Office uses these fonts based on text script type:
- Latin characters → \:latin\ font
- CJK characters (Chinese/Japanese/Korean) → \:ea\ font
- Complex scripts (Arabic/Hebrew/Hindi) → \:cs\ font
- Special symbols → \:sym\ font
Font Fallback Behavior
When specified font unavailable:
- Exact match: Use requested font
- Family substitute: Use similar font (Arial → Helvetica)
- Pitch substitute: Monospace ↔ Proportional
- System default: Use OS default font
Best practice: Always specify fallback fonts in themes/defaults.
Web-Safe Fonts
Fonts reliably available on most systems:
| Font | Category | Availability |
|---|---|---|
| Arial | Sans-serif | Windows, Mac, Web |
| Times New Roman | Serif | Windows, Mac, Web |
| Courier New | Monospace | Windows, Mac, Web |
| Verdana | Sans-serif | Windows, Mac, Web |
| Georgia | Serif | Windows, Mac, Web |
| Calibri | Sans-serif | Office applications |
| Segoe UI | Sans-serif | Windows/Office |
Common Patterns
Standard Body Text
xml
<a:rPr>
<a:latin typeface="Calibri"/>
<a:sz val="2000"/>
</a:rPr>
Heading Font
xml
<a:rPr>
<a:latin typeface="Calibri Light"/>
<a:sz val="4400"/>
<a:b/>
</a:rPr>
Code Font
xml
<a:rPr>
<a:latin typeface="Consolas" pitchFamily="1"/>
<a:sz val="1800"/>
</a:rPr>
Multilingual Text
xml
<a:rPr>
<a:latin typeface="Calibri"/>
<a:ea typeface="SimSun"/>
<a:cs typeface="Calibri"/>
</a:rPr>
Compatibility Matrix
| Feature | PowerPoint | Word | Excel | Notes |
|---|---|---|---|---|
| Latin fonts | ✓ | ✓ | ✓ | Full support |
| East Asian fonts | ✓ | ✓ | ✓ | Full support |
| Complex Script | ✓ | ✓ | ✓ | Full support |
| Symbol fonts | ✓ | ✓ | ✓ | Full support |
| Font fallback | ✓ | ✓ | ✓ | System-dependent |
| Embedded fonts | ✓ | ✓ | ✓ | File size impact |
Font Embedding
When fonts embedded in document:
- File size: Increases significantly (100KB-500KB+ per font)
- Portability: Document renders identically on all systems
- Licensing: Embedding may violate font licensing
- Subsetting: Office can subset fonts (embed only used chars)
Relation: \:font\ specifies font name; embedding configured separately.
Notes
Element Characteristics
- Typeface specification: Identifies font by name
- Script-aware: Different fonts for different scripts
- Self-closing: No child elements
- Fallback-aware: Pitch family helps system select appropriate substitute
- Legacy: Charset attribute mostly historical; Unicode handles encoding
Best Practices
- Always specify \:latin\ font (most common)
- Include \:ea\ for any documents with CJK text
- Include \:cs\ for documents with Arabic/Hebrew/Indic
- Use web-safe fonts for maximum compatibility
- Test font rendering on target platforms
- Document font requirements in templates
- Consider font licensing for embedded scenarios
- Use theme fonts for consistency
Font Selection Strategy
- Corporate documents: Use branded fonts or web-safe alternatives
- Web content: Use web-safe fonts (Arial, Times, Verdana)
- Multilingual: Specify script-specific fonts
- Printing: Use print-optimized fonts (serif for body, sans for headings)
- Accessibility: Use highly readable fonts (sans-serif for screen)
Rendering
- Font rendering platform-dependent
- Character substitution occurs automatically
- Kerning and ligatures depend on font/OS
- Fallback fonts may affect layout
- Web rendering may use different fonts
Performance
- Font selection minimal file size impact
- Embedded fonts significantly increase file (avoid when possible)
- Font loading affects render time (minimal on modern systems)
- Caching reduces font lookup overhead