#> [1] "arcade" "gridfont" "gridfont_smooth" "asteroids"
| Type | Name | Sizes | Unicode? | # glyphs |
|---|---|---|---|---|
| Vector | gridfont | Lower case ASCII only | ||
| Vector | gridfont_smooth | Lower case ASCII only | ||
| Vector | arcade | Upper case ASCII only |
vector_text_coords() returns a data.frame of
strokesvector_text_matrix() returns a binary matrix with pixel
locations set to 1vector_text_raster() returns a raster image of the
textText may be rendered with a vector font to
raster object#> char_idx codepoint stroke_idx x y line x0 y0
#> 494 1 104 1 0.0000000 9.000000 0 0.0000000 9.000000
#> 495 1 104 1 0.0000000 3.000000 0 0.0000000 3.000000
#> 496 1 104 2 0.0000000 5.666667 0 0.0000000 5.666667
#> 497 1 104 2 0.1666667 6.333333 0 0.1666667 6.333333
#> 498 1 104 2 0.6666667 6.833333 0 0.6666667 6.833333
#> 499 1 104 2 1.1666667 7.000000 0 1.1666667 7.000000
This is an example of bespoke rendering of the strokes for an example string.
For each character (char_idx) there are 1-or-more
strokes (stroke). Each stroke has at least 2 points
(indicated by idx).
When plotting with ggplot, draw path for the points-within-strokes-within-characters.
#> char_idx codepoint stroke_idx x y line x0 y0
#> 494 1 104 1 0.0000000 9.000000 0 0.0000000 9.000000
#> 495 1 104 1 0.0000000 3.000000 0 0.0000000 3.000000
#> 496 1 104 2 0.0000000 5.666667 0 0.0000000 5.666667
#> 497 1 104 2 0.1666667 6.333333 0 0.1666667 6.333333
#> 498 1 104 2 0.6666667 6.833333 0 0.6666667 6.833333
#> 499 1 104 2 1.1666667 7.000000 0 1.1666667 7.000000
ggplot(coords) +
geom_path(aes(x, y,
group = interaction(char_idx, stroke_idx),
colour = as.factor(char_idx)),
linewidth = 4) +
geom_point(aes(x, y), color = 'yellow') +
theme_bw() +
theme(legend.position = 'none') +
coord_equal()