glyph_polygon: Extracting the glyph outline of a character as polygons

Description Usage Arguments Value Author(s) Examples

View source: R/glyph_outline.R

Description

This function extracts the outline of character glyphs contained in a font, and converts the outline into polygons.

Usage

1
glyph_polygon(ch = "a", family = "sans", face = "regular", nseg = 10)

Arguments

ch

A character whose glyph is to be extracted.

family

The family of the font. See font.families().

face

The font face. Possible values are "regular", "bold", "italic" and "bolditalic".

nseg

The number of line segments to approximate a piece of curve in the outline. The larger nseg is, the smoother text outlines would be. Usually a value between 5~20 would be enough.

Value

A data frame with class "glyph_polygon" that contains two columns, giving the x and y coordinates of the outline. Rows that contain NA represents the start of a new polygon path.

Author(s)

Yixuan Qiu <http://statr.me/>

Examples

1
2
R = glyph_polygon("R", family = "sans", face = "bold")
plot(R)

yixuan/fontr documentation built on May 4, 2019, 5:29 p.m.