I'm using ruby, prawn, and prawnto to dynamically generate pdf's containing text in other languages. I can't seem to get any text in languages with non-english characters to show up. It doesn't throw any errors...just shows a bunch of dashes instead of characters. Prawn brags on its homepage about UTF-8 support so I don't see why this is a problem. I'm using ruby 1.8.6 (engineyard).
+2
A:
For Unicode to work you need to load a TTF font that has the characters you require.
The default Helvetica font only supports ASCII (plus a few extras).
James Healy
2010-01-21 00:20:24
I see... I'll try that out.
tybro0103
2010-01-21 03:14:59
Where's a good place to find .ttf files?
tybro0103
2010-01-21 14:58:16
I suggest you try the DejaVu font family, which supports a fairly large chunk of the Unicode standard. You can find it at: http://dejavu-fonts.org/ (The Prawn gem includes DejaVu Sans, specifically in prawn-core/data/fonts/DejaVuSans.ttf)
Shtééf
2010-01-21 18:12:14
The DejaVu had a lot of the characters I needed...didn't have Chinese though. I did find a font called "Arial Unicode MS" already on my mac in the fontbook program that seems to do it all. Thanks!
tybro0103
2010-01-21 19:34:00