magic_cloud icon indicating copy to clipboard operation
magic_cloud copied to clipboard

font setting doens't work

Open POPPIN-FUMI opened this issue 3 years ago • 0 comments

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?

POPPIN-FUMI avatar Sep 18 '22 14:09 POPPIN-FUMI