andrewtimberlake / elixir-pdf

An attempt to get a nice API for PDF generation in Elixir
MIT License
77 stars 14 forks source link

Support cyrillic characters #20

Open focused opened 4 years ago

focused commented 4 years ago

I tried to render Cyrillic text in document, but it renders nothing. How can I do it with current implementation? If there is no support, is it possible to implement this feature, how can I contribute?

andrewtimberlake commented 4 years ago

I have not added UTF-8 support. The PDF format does not have intuitive support for UTF-8, at least not as easy as Elixir ;-) Right now the only character support I have included is support for WinANSI encoding and the code translates the UTF-8 characters that are supported into that encoding. Feel free to tackle any aspect of encoding, font-mapping, or UTF-8 support.

focused commented 4 years ago

If I understand you correctly we need the module that supports UTF-8 in addition to Pdf.Encoding.WinAnsi. Can you give me a direction where I can start?

andrewtimberlake commented 4 years ago

I’m sorry I don’t have time at this point. The PDF spec is available online but it is quite a monster. One of the things I’m sure would be needed is TTF font support in order to be able to handle the UTF-8 characters but I haven’t really looked into it in depth.

Hermanverschooten commented 3 years ago

I am currently working on an TTF parser, based on the ttfunk gem. But it is a lot of work. You can check my progress in the repo. Once this is complete, we can see how to integrate it.