raumkundschafter
raumkundschafter

Reputation: 441

How to load fonts in rgl.text3d?

I'm trying to run the example given in ?text3d as follows:

library(rgl)
open3d()
famnum <- rep(1:4, 8)
family <- c("serif", "sans", "mono", "symbol")[famnum]
font <- rep(rep(1:4, each = 4), 2)
cex <- rep(1:2, each = 16)
text3d(font, cex, famnum, text = paste(family, font), adj = 0.5, 
       color = "blue", family = family, font = font, cex = cex)

This results in a couple of warning messages of the following kind:

In rgl.texts(x = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L,  ... :
  font family "serif" not found, using "bitmap"

I would like to use another font instead of bitmap but it seems to switchback to bitmap whatever argument I give as family e.g. family = "FreeSans". Wonder if this is a bug or I'm doing something wrong. This is running on

R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)
with the following rgl version loaded:
[1] rgl_0.96.0

Upvotes: 1

Views: 412

Answers (1)

raumkundschafter
raumkundschafter

Reputation: 441

Solution to the problem is provided by a member in this thread: https://stat.ethz.ch/pipermail/r-help/2017-March/thread.html#445777

To get this working successfully FreeType and FTGL need to be installed

sudo apt-get install libfreetype6-dev
sudo apt-get install libftgl-dev

and then reinstall rgl from within R using

install.packages("rgl", type="source")

Upvotes: 1

Related Questions