Skip to contents

Cuts a text short, with an ellipsis, where text_width() says that it would be wider than width.

Usage

fit_text(x, size, width)

Arguments

x

Text.

size

The font size, in pixels.

width

The width that the text must fit, in pixels.

Value

The texts that fit as they are, and the others cut short.

Examples

rghcard:::fit_text(c("rwf", "a-repository-with-a-long-name"), 12, 120)
#> [1] "rwf"              "a-repository-wi…"