prawnpdf / prawn

Fast, Nimble PDF Writer for Ruby
https://prawnpdf.org
Other
4.65k stars 688 forks source link

Problem with multilingual or translating text to nepali language #829

Closed adhsharad closed 9 years ago

adhsharad commented 9 years ago

Hi,

We have integrated Prawn 1.0.0 in our rails application. The pdf created shows english texts and numbers correctly with default fonts.

But if there are nepali texts, it shows as rectangle only. If you copy those rectangle and paste it in sublime editor, you can see nepali texts. What is the problem? In this case the data is coming from database which was orginally entered in nepali language.

We tried adding nepali fonts, but the problem is worse. Now every english text and numbers are translated to some nepali characters, which does not make any sense.

What should we do to

  1. Show nepali texts as is in pdf, which comes from database. And
  2. Use ne.yml file to translate only translated text.

BR Sharad

P.S I have attached picture which shows nepali characters when we add nepali font. Prawn did change the english character to nepali character but it does not make any sense.

image

bvogel commented 9 years ago

I'm no expert here, but have you tried adding two fonts, an english true-type font and the nepali font and use the english font for english and the nepali font for nepali text. That should work. see also in the closed issues list - there are at least three similar issues with font rendering.

practicingruby commented 9 years ago

@bvogel has the right idea. Please see the section on Fallback fonts in Prawn's manual: http://prawnpdf.org/manual.pdf