-
-
Notifications
You must be signed in to change notification settings - Fork 215
Font configuration
The .font[docs] function overrides the global font configuration.
A font family can be loaded from any of the following sources (case-sensitive):
- From file:
path/to/font.ttf - From URL:
https://example.com/font.ttf - From system fonts:
Arial,Times New Roman - From Google Fonts:
GoogleFonts:Roboto,GoogleFonts:Noto Sans
The function can set custom font families via the following optional parameters:
-
main: font family for all text content. Also applies to headings if the current theme does not specify a different font for them; -
heading: font family for headings (titles). Overridesmain; -
code: font family for code blocks and code spans. Overridesmain.
Example:
.font {fonts/Inter.ttf} heading:{GoogleFonts:Poppins} code:{Courier New}Font resources are processed by the media storage system. This ensures that, for example, HTML output will include local fonts in the output directory for increased portability.
Note that system fonts, on the other hand, may not be installed on all devices. While this shouldn't affect PDF output, it can be problematic when sharing HTML output.
-
size: base font size. Other elements, such as headings, will scale accordingly. For example12px.
Multiple .font calls create overlapped font configurations.
Each font configuration will override the previous one,
as long as it contains glyphs for the characters being rendered.
Otherwise, the previous font configuration will be used as a fallback.
This is particularly useful for multi-language documents, such as documents containing both Latin and CJK (Chinese, Japanese, Korean) characters. For example, you may set a primary font for Latin characters and a fallback font for CJK characters:
.font {GoogleFonts:Ma Shan Zheng}
.font {GoogleFonts:Corinthia}
- Figures
- Image size
- TeX formulae
- Table caption
- Code caption
- Decorative headings
- Alerts (quote types)
- Quotation source
- Cross-references
- Page breaks
- Text symbols (text replacement)
- Emojis
- Document metadata
- Theme
- CSS
- Fonts
- Page format
- Page margin content
- Page counter
- Persistent headings
- Automatic page break
- Numbering
- Paragraph style
- Caption position
- Table of contents
- Bibliography
- Footnotes
- Stacks (row, column, grid)
- Container
- Align
- Float
- Figure
- Clip
- Box
- Collapsible
- Landscape
- Whitespace
- Variables
- Optionality
- Math
- Conditional statements
- Loops
- Let
- Destructuring
- String manipulation
- Table manipulation: sorting, computing, and more
- Table generation
- String
- Number
- Markdown content
- Boolean
- None
- Enumeration entry
- Iterable
- Dictionary
- Range
- Lambda
- Size(s)
- Color
- Dynamic
- Paper: abstract, definitions, theorems, and more