[R] How to load fonts in text3d?

olsen o.o.wolf at qmul.ac.uk
Tue Mar 28 12:05:39 CEST 2017


thanks, the fonts seem to be on:
> rglFonts()
$serif
[1] "/usr/lib/R/site-library/rgl/fonts/FreeSerif.ttf"
[2] "/usr/lib/R/site-library/rgl/fonts/FreeSerif.ttf"
[3] "/usr/lib/R/site-library/rgl/fonts/FreeSerif.ttf"
[4] "/usr/lib/R/site-library/rgl/fonts/FreeSerif.ttf"

$sans
[1] "/usr/lib/R/site-library/rgl/fonts/FreeSans.ttf"
[2] "/usr/lib/R/site-library/rgl/fonts/FreeSans.ttf"
[3] "/usr/lib/R/site-library/rgl/fonts/FreeSans.ttf"
[4] "/usr/lib/R/site-library/rgl/fonts/FreeSans.ttf"

$mono
[1] "/usr/lib/R/site-library/rgl/fonts/FreeMono.ttf"
[2] "/usr/lib/R/site-library/rgl/fonts/FreeMono.ttf"
[3] "/usr/lib/R/site-library/rgl/fonts/FreeMono.ttf"
[4] "/usr/lib/R/site-library/rgl/fonts/FreeMono.ttf"

$symbol
[1] "/usr/lib/R/site-library/rgl/fonts/FreeSerif.ttf"
[2] "/usr/lib/R/site-library/rgl/fonts/FreeSerif.ttf"
[3] "/usr/lib/R/site-library/rgl/fonts/FreeSerif.ttf"
[4] "/usr/lib/R/site-library/rgl/fonts/FreeSerif.ttf"

On 27/03/17 20:21, Duncan Murdoch wrote:
> On 27/03/2017 1:09 PM, olsen wrote:
>> 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 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
> 
> What do you see if you run rglFonts()?  It should list the fonts you
> have installed.  On MacOS, I see
> 
>> rglFonts()
> $serif
> [1]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeSerif.ttf"
> 
> [2]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeSerif.ttf"
> 
> [3]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeSerif.ttf"
> 
> [4]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeSerif.ttf"
> 
> 
> $sans
> [1]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeSans.ttf"
> 
> [2]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeSans.ttf"
> 
> [3]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeSans.ttf"
> 
> [4]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeSans.ttf"
> 
> 
> $mono
> [1]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeMono.ttf"
> 
> [2]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeMono.ttf"
> 
> [3]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeMono.ttf"
> 
> [4]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeMono.ttf"
> 
> 
> $symbol
> [1]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeSerif.ttf"
> 
> [2]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeSerif.ttf"
> 
> [3]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeSerif.ttf"
> 
> [4]
> "/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rgl/fonts/FreeSerif.ttf"
> 
> 
> If you don't have Freetype installed on your system, you won't be able
> to use any of those.
> 
> Duncan Murdoch
> 

-- 
Our solar system is the cream of the crop
http://hasa-labs.org



More information about the R-help mailing list