reingart / pyfpdf

Simple PDF generation for Python (FPDF PHP port)
https://code.google.com/p/pyfpdf/
GNU Lesser General Public License v3.0
857 stars 523 forks source link

In FPDF Kannada fonts are not displaying correctly. #202

Open gksathyarao opened 2 years ago

gksathyarao commented 2 years ago

In Python and FPDF , Kannada fonts are not displaying properly. Tried different Kannada /Uni code fonts but having same issue. characters jumbled and does not show it properly .
Code : example from fpdf import FPDF

pdf = FPDF() pdf.add_page() pdf.add_font('kan','','/Users/sathyarao/Library/Fonts/AnekKannada-VariableFont_wdth,wght.ttf') pdf.set_font("kan",size=30) ktext='ಕನ್ನಡ ರಾಜ್ಯ ಹೇಮ್ಮೇಯ ನಾಡು' pdf.cell(150, 30, txt = ktext , align='c') pdf.ln(30) pdf.output('font.pdf') print(ktext)

Correct way to display kannada is 'ಕನ್ನಡ ರಾಜ್ಯ ಹೇಮ್ಮೇಯ ನಾಡು' but in FPDF we see it as

image

print(ktext) - shows it correctly only issue with fpdf

ಕನ್ನಡ ರಾಜ್ಯ ಹೇಮ್ಮೇಯ ನಾಡು

Please help us to display Kannada words properly. Looks like this is issue will Indian languages.

Lucas-C commented 2 years ago

pyfpdf is not maintained anymore, have you tried using fpdf2? https://pyfpdf.github.io/fpdf2/