[R] How to load fonts in text3d?

olsen o.o.wolf at qmul.ac.uk
Tue Mar 28 15:19:47 CEST 2017


Following these pointers given by Duncan Murdoch is the key to success,
at least on my system.

Many thanks!
olsen



On 28/03/17 13:49, Duncan Murdoch wrote:
> On 28/03/2017 6:39 AM, olsen wrote:
>> I think I found the fly in the ointment, running the same text3d() lines
>> with 'useFreeType=TRUE' returns:
>> "FreeType not supported in this build"
> 
> You need to install FreeType and FTGL.  I think this is how to do it on
> Trusty.  Don't know if it will work on your Ubuntu version.
> 
> 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")
> 
> Duncan Murdoch
> 
>>
>>
>> On 28/03/17 11:05, olsen wrote:
>>> 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
>>>>
>>>
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>



More information about the R-help mailing list