Create a fp_text() object that uses defaut values defined in the flextable it applies to.

fp_text_default() is a handy function that will allow you to specify certain formatting values to be applied to a piece of text, the formatting values that are not specified will simply be the existing formatting values.

For example, if you set the text in the cell to red previously, using the code fp_text_default(bold = TRUE), the formatting will be 'bold' but it will also be 'red'.

On the other hand, the fp_text() function forces you to specify all the parameters, so we strongly recommend working with fp_text_default() which was created to replace the use of the former.

fp_text_default(
color = flextable_global$defaults$font.color,
font.size = flextable_global$defaults$font.size,
bold = FALSE,
italic = FALSE,
underlined = FALSE,
font.family = flextable_global$defaults$font.family,
cs.family = NULL,
eastasia.family = NULL,
hansi.family = NULL,
vertical.align = "baseline",
)

## Arguments

color

font color - a single character value specifying a valid color (e.g. "#000000" or "black").

font.size

font size (in point) - 0 or positive integer value.

bold

is bold

italic

is italic

underlined

is underlined

font.family

single character value. Specifies the font to be used to format characters in the Unicode range (U+0000-U+007F).

cs.family

optional font to be used to format characters in a complex script Unicode range. For example, Arabic text might be displayed using the "Arial Unicode MS" font.

eastasia.family

optional font to be used to format characters in an East Asian Unicode range. For example, Japanese text might be displayed using the "MS Mincho" font.

hansi.family

optional. Specifies the font to be used to format characters in a Unicode range which does not fall into one of the other categories.

vertical.align

single character value specifying font vertical alignments. Expected value is one of the following : default 'baseline' or 'subscript' or 'superscript'

shading color - a single character value specifying a valid color (e.g. "#000000" or "black").

Other functions for defining formatting properties: fp_border_default()

## Examples

font.size = 11, font.color = "#303030",
padding = 3, table.layout = "autofit")

z <- compose(
x = z,
i = ~ speed < 6,
j = "speed",
value = as_paragraph(
as_chunk("slow... ", props = fp_text_default(color = "red")),
as_chunk(speed, props = fp_text_default(italic = TRUE))
)
)
z
#> a flextable object.
#> col_keys: speed, dist
#> body has 6 row(s)
#> original dataset sample:
#>   speed dist
#> 1     4    2
#> 2     4   10
#> 3     7    4
#> 4     7   22
#> 5     8   16