glyph_outline: Extracting the glyph outline of a character

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.

Usage

1
glyph_outline(ch = "a", family = "sans", face = "regular")

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".

Value

A data frame with class "glyph_outline". Each row of the data frame contains two numeric values, giving the x and y coordinates of a point, and a character, indicating the action to take on that point in order to draw the outline. The meaning of different characters are given below:

M

Move the pen to the point

L

Draw a straight line to the point

Q

Draw a quadratic Bezier curve to the point, followed by a "B" row that gives the coordinates of the control point

C

Draw a cubic Bezier curve to the point, followed by two "B" rows that give the coordinates of the control points

More details can be found in sections 8.3.2 to 8.3.7 of the SVG specification. (http://www.w3.org/TR/SVG/paths.html)

Author(s)

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

Examples

1
2
R = glyph_outline("R", family = "sans", face = "bold")
head(R, 20)

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