Using external TTF fonts to generate PDF with Japanese text using prawn
cjk, prawn, ruby, ruby-on-rails-4
Solution
Here I want to share with the solution.
I have also posted the issue here https://github.com/prawnpdf/prawn/issues/595 and the advice was:
The TTF fonts that ship with Prawn are for testing and use with the manual... they're not meant for regular use. Do a web search for "Free Japanese TTF font" and I'm sure you'll probably find something.
So, I have googled and found http://www.wazu.jp/gallery/Fonts_Japanese.html and tested mona.ttf, in particular, and this worked.
Problem
Prawn has a limited number of fonts under `Prawn::BASEDIR}/data/fonts/` I have tried `gkai00mp.ttf`, but generated PDF shows only the 1st letter "千" of 千葉, for example. I feel like this font is good for Chinese characters. ``` font("#{Prawn::BASEDIR}/data/fonts/gkai00mp.ttf") do text "千葉" end ``` Is it possible to upload and use external fonts? If yes, where that fonts can be obtained from? My environment: Latest Ruby and Rails. Prawn version 0.12.0