zverok / magic_cloud

Simple pretty word cloud for Ruby
MIT License
85 stars 27 forks source link

font setting doens't work #19

Open POPPIN-FUMI opened 2 years ago

POPPIN-FUMI commented 2 years ago

I tried to use Japanese but seems like the font settings do not work.

I tried this code first

words ={"日本語"=>2, "ケール"=>2, "変更"=>2}
font = "ArialUnicode"
cloud.new(words, rotate: :none, scale: :linear, font_family: font)
cloud.draw(500, 250).write("test.png")

but empty img was created.

Also tried with the full path of the font but still the same.

font = "/usr/share/fonts/truetype/takao-gothic/TakaoPGothic.ttf"
cloud = MagicCloud::Cloud.new(words, rotate: :none, scale: :linear, font:)

I tried rmagick directly and it worked.

convert -font  /usr/share/fonts/truetype/takao-gothic/TakaoPGothic.ttf -pointsize 18 -fill black -draw "text 50,50 '表示される'" test.png out.png

Does anyone know how to output Japanese in the image?