font() changes the font family of a selection of cells in a flextable. It supports separate font families for Latin, complex-script (e.g., Arabic), East Asian (e.g., Japanese), and other Unicode ranges in Word and PowerPoint outputs.
Google Fonts can be registered with gdtools::register_gfont() and are automatically embedded in HTML output.
Function signature
Parameters
A
flextable object.Row selector. Accepts integer indices, a one-sided formula (e.g.,
~ col > 5), or a logical vector. NULL selects all rows in the specified part.Column selector. Accepts integer indices, column names, a formula, or a logical vector.
NULL selects all columns.The font family name (e.g.,
"Arial", "Times New Roman"). In Word and PowerPoint output, this applies to characters in the Latin Unicode range (U+0000–U+007F).Which part of the table to target:
"body", "header", "footer", or "all".Font family for complex-script Unicode characters (e.g., Arabic). Applies only to Word and PowerPoint outputs. Defaults to the value of
fontname.Font family for Unicode characters that do not fall into the Latin, complex-script, or East Asian categories. Applies only to Word and PowerPoint outputs. Defaults to the value of
fontname.Font family for East Asian Unicode characters (e.g., Japanese, Chinese). Applies only to Word and PowerPoint outputs. Defaults to the value of
fontname.Return value
The modifiedflextable object.
Examples
Apply a decorative font to the header and a specific column:See also
fontsize()— set font sizebold()italic()style()— apply multiple formatting properties at once