Open bestchenwu opened 5 years ago
@bestchenwu could you upload the font file?
final FrequencyAnalyzer frequencyAnalyzer = new FrequencyAnalyzer();
frequencyAnalyzer.setWordFrequenciesToReturn(600);
frequencyAnalyzer.setMinWordLength(2);
frequencyAnalyzer.setWordTokenizer(new ChineseWordTokenizer());
final List<WordFrequency> wordFrequencies = frequencyAnalyzer.load("词频汇总.txt");
final Dimension dimension = new Dimension(600, 600);
final WordCloud wordCloud = new WordCloud(dimension, CollisionMode.PIXEL_PERFECT);
wordCloud.setPadding(2);
KumoFont kumoFont = new KumoFont("simsun",FontWeight.PLAIN);
wordCloud.setKumoFont(kumoFont);
wordCloud.setBackground(new CircleBackground(300));
wordCloud.setColorPalette(new ColorPalette(new Color(0xD5CFFA), new Color(0xBBB1FA), new Color(0x9A8CF5), new Color(0x806EF5)));
wordCloud.setFontScalar(new SqrtFontScalar(12, 45));
wordCloud.build(wordFrequencies);
wordCloud.writeToFile("chinese_language_circle.png");
I want to make a chinese word cloud,and the code is
public class ChineseAnalyzeTask {
}
When I run the program,The result is the underlying picture--chinese_language_circle.png
And I am sure,I have moved simsun.ttf to /jre/lib/fonts directory,like this: