How to know the sources supported by commonality.cloud?

3

I would like to know which fonts are supported by wordcloud or commonality.cloud.

I imported some fonts with the package below but many of them do not work.

install.packages("extrafont")
library(extrafont)
font_import()

Below is an example code for the word cloud.

commonality.cloud(mydata, 
                  colors = "black", 
                  scale= c(32,4) ,
                  random.order=FALSE,
                  vfont=c("Fontes_suportadas","plain"))
    
asked by anonymous 07.08.2014 / 16:21

1 answer

1

The only fonts supported by commonality.cloud (as well as wordclouds) are the Hershey family fonts, which have the advantage that each character is described as a set of points (the vector fonts), and render this character means to join these points with a line. With this, we avoid the size problem (as there is no pixelization effect) and when plotting a rotated character the appearance gets better.

The following typefaces and fontindex are supported:

  • typeface: 'serif' | fontindex: {'plain', 'italic', 'bold', 'bold italic', 'cyrillic', 'oblique cyrillic', 'EUC'}

  • typeface: 'sans serif' | fontindex: {'plain', 'italic', 'bold', 'bold italic'}

  • typeface: 'script' | fontindex: {'plain', 'italic', 'bold'}

  • typeface: 'gothic english' | fontindex: {'plain'}

  • typeface: 'gothic german' | fontindex: {'plain'}

  • typeface: 'gothic italian' | fontindex: {'plain'}

  • typeface: 'serif symbol' | fontindex: {'plain', 'italic', 'bold'}

  • typeface: 'sans serif symbol' | fontindex: {'plain', 'italic'}

Example:

library(tm)
library(wordcloud)

data(SOTU)
corp <- SOTU

term.matrix <- TermDocumentMatrix(corp)
term.matrix <- as.matrix(term.matrix)
commonality.cloud(term.matrix, 
                  colors = "black", 
                  scale= c(32,4) ,
                  random.order=FALSE,
                  vfont=c("sans serif","plain"))

For more information, ?Hershey

    
22.01.2015 / 14:24