You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having an issue when using multi_cell with a unicode font, it seems like I get corrupted characters when a line break occurs and the line contains a parenthesis before the line break. This doesn't occur when I use pdf.write.
Python: 3.9.2
fpdf2: 2.3.1
I've been able to reproduce the issue with a sample project:
#!/usr/bin/env python# -*- coding: utf-8 -*-fromfpdfimportFPDFpdf=FPDF()
pdf.add_page()
# Add a DejaVu Unicode font (uses UTF-8)# Supports more than 200 languages. For a coverage status see:# http://dejavu.svn.sourceforge.net/viewvc/dejavu/trunk/dejavu-fonts/langcover.txtpdf.add_font('DejaVu', '', 'DejaVuSans.ttf', uni=True)
pdf.set_font('DejaVu', '', 14)
text="""Line wrap : lorem () dolor sit amet, consectetur sit amet adipiscing elit et doloreNo wrap : ipsum () dolor sit amet, consectetur sit amet adipiscingParenthesis after line break : ipsum dolor sit amet, consectetur adipiscing et dolore elit () lorem"""pdf.set_font('helvetica', '', 18)
pdf.write(8, "using pdf.multi_cell with built in font")
pdf.ln(0)
pdf.multi_cell(w=0, h=8, txt=text, ln=1)
pdf.ln(8)
pdf.add_font('DejaVu', '', 'DejaVuSans.ttf', uni=True)
pdf.set_font('DejaVu', '', 14)
pdf.write(8, "using pdf.multi_cell with unicode font")
pdf.ln(0)
pdf.multi_cell(w=0, h=8, txt=text, ln=1)
pdf.ln(8)
pdf.write(10, "using pdf.write, line by line with unicode font")
forlineintext.split('\n'):
pdf.write(8, line)
pdf.ln(8)
pdf.write(8, "using pdf.write for whole literal with unicode font")
pdf.write(8, text)
pdf.ln(8)
pdf.output("unicode.pdf")
I'm having an issue when using multi_cell with a unicode font, it seems like I get corrupted characters when a line break occurs and the line contains a parenthesis before the line break. This doesn't occur when I use pdf.write.
Python: 3.9.2
fpdf2: 2.3.1
I've been able to reproduce the issue with a sample project:
The code outputs this pdf:
unicode.pdf
Any help you could provide would be greatly appreciated. Thanks.
The text was updated successfully, but these errors were encountered: