font_info: Font metrics

Description Usage Arguments Examples

View source: R/freetypeharfbuzz.R

Description

* 'font_info()' returns the typographical metrics (ascent, descent, linegap) for a font.

* 'str_info()' returns the metrics (width, height, ascent, descent) for a string. 'str_width()' only returns the width.

Usage

1
2
3
4
5
font_info(font_size = 12, font_file = NULL)

str_info(string, font_size = 12, font_file = NULL)

str_width(string, font_size = 12, font_file = NULL)

Arguments

font_size

Font size in point.

font_file

Path to a ttf or otf file.

string

A string whose metrics will be computed.

Examples

1
2
3
4
5
6
file <- fontquiver::font("Liberation", "serif", "bold")$ttf
font_info(font_size = 13, font_file = file)

str_width("foobar", font_size = 13)
str_info("foobar", font_size = 13)
str_info("foobar", font_size = 13, font_file = file)

freetypeharfbuzz documentation built on Jan. 13, 2021, 3:15 p.m.