wezterm.font()
Constructs a font configuration for a single named font with optional style attributes.Signature
Parameters
The font family name. Can be one of:
- Family name (recommended):
"JetBrains Mono"- doesn’t include style info - Full name:
"JetBrains Mono Regular"- includes sub-family - PostScript name: Unique identifier encoded by font designer
Optional table specifying font style attributes:
Font weight. Options:
"Thin""ExtraLight""Light""DemiLight""Book""Regular"(default)"Medium""DemiBold""Bold""ExtraBold""Black""ExtraBlack"
Font stretch. Options:
"UltraCondensed""ExtraCondensed""Condensed""SemiCondensed""Normal"(default)"SemiExpanded""Expanded""ExtraExpanded""UltraExpanded"
Font style. Options:
"Normal"(default)"Italic"- distinctive design at an angle"Oblique"- similar to Normal but skewed
HarfBuzz font shaping features to enable/disable.
Example:
{ 'calt=0', 'clig=0', 'liga=0' } to disable ligaturesFreeType load target hint setting
FreeType render target setting
FreeType load flags
Control whether font is considered to have emoji presentation glyphs
Return Value
A text style object containing font configuration that can be assigned to config.font
Basic Examples
Advanced Features
Disable Ligatures
You can disable ligatures for specific fonts:Emoji Presentation
Control whether a font is considered to have emoji glyphs:wezterm.font_with_fallback()
Constructs a font configuration with fallback fonts. Glyphs are looked up in the first font, but if missing, the next font is checked, and so on.Signature
Parameters
Array of font families in preferred order. Each element can be:
- A string font family name
- A table with family and per-font attributes
Optional attributes applied to all fonts (unless overridden per-font)
Return Value
A text style object with multiple fonts configured in fallback order
Examples
Fallback Font Scaling
When mixing different font families, glyphs may appear to have different heights. WezTerm provides two ways to handle this:Automatic Scaling
Use theuse_cap_height_to_scale_fallback_fonts config option:
Manual Scaling
For CJK fonts or when automatic scaling doesn’t work well, manually specify the scale factor:Manual scaling cannot influence font metrics, so you may also need to adjust
line_height for better appearance.Font Resolution
WezTerm follows CSS Fonts Level 3 compatible font matching when resolving fonts:- Exact match: Tries to find a font that exactly matches the specified attributes
- Close match: If no exact match, finds a close match within the font family
- Fallback: If a glyph is missing, tries the next font in the fallback list
Important Notes
- Use family names: The family name (without style info) is the most compatible
- Install all variants: If you want condensed, bold, or italic fonts, install those font files
- Implicit fallbacks: WezTerm adds its own default fallback fonts to your list
- Font files required: All fonts must be installed on your system
Related Configuration
font_size- Set the font point sizefont_dirs- Additional directories to search for fontsline_height- Adjust line height multiplieruse_cap_height_to_scale_fallback_fonts- Automatic fallback scaling
Source Reference
Implementation:config/src/lua.rs:552-641