silnrsi / font-padauk

Padauk pan Myanmar font
Other
28 stars 7 forks source link

Font ligatures not being rendered correctly when generating PDF #30

Closed pmverma closed 4 years ago

pmverma commented 4 years ago

Hi, I wanted to export some Myanmar text to PDF file format. However, after many failed attempts using various programming languages and fonts, I came to conclude that the current Unicode fonts can not be used to render contents to PDF.

One of the issue I have raised to a library tool: https://github.com/prawnpdf/prawn/issues/1125

As you can see from above issue that I would like to print the following text to PDF.

"ပြည်ထောင်စု သမ္မတ မြန်မာနိုင်ငံတော်‌ - Republic of the Union of Myanmar"

Instead the rendered PDF have something like followings.

image

I had the same experience with other Unicode fonts too such as PyiDaungSu,Myanmar3,Padauk,Noto Serif Myanmar, Windows-built-in fonts.

Although word processors, browsers have first class support (or they recognized) for the correct ligatures, it is sad to see that the same thing do not works as expected if we use some medium software (using programming) to render PDF.

I am also not clear that which one is not working/supporting to render the correct ligatures,

I understand that fixing this might not be an easy thing but since you folks are expert in this area, I would like to help in fixing this issue or get a workaround, which I don' think exists.

Regards, Mohan

mhosken commented 4 years ago

Hmm. I'm not sure what is happening for you. What program are you using to enter your text. I enclose a pdf from libreoffice. country.pdf

pmverma commented 4 years ago

Ah..I forgot to mention that exporting PDF from word processors just works fine. The problem is when you use coding to do export, like followings.

require "prawn"

Prawn::Document.generate("hello.pdf") do
  font("Padauk-Regular.ttf") do
    text "ပြည်ထောင်စု သမ္မတ မြန်မာနိုင်ငံတော်‌ - Republic of the Union of Myanmar"
  end
end

Here is a demo repl.it link https://repl.it/repls/PromotedWrathfulArrays

pmverma commented 4 years ago

Hi, @mhosken Did you get a chance to check the repl link? What do you think, is it font problem or library?

mhosken commented 4 years ago

It's almost certainly (99%) a library problem in that it looks like the library is not doing any shaping of the text (reordering or resolving viramas, etc.) You'll find just as much problem with using text from other scripts, I suspect. Given the problem arises for other Burmese fonts, this is certainly not a Padauk font problem on its own.