question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

With Custom fonts Arabic text is breaking

See original GitHub issue

document.autoTable({ head, body, startY: XX, styles: { lineColor: '#c7c7c7', lineWidth: 0, cellPadding: 2}, headStyles: { fillColor: '#ffffff', textColor: '#333333', font: '**Helvetica**' }, bodyStyles: { fillColor: '#f5f5f5', textColor: '#333333', fontSize: 7, lineColor: '#c7c7c7', lineWidth: 0 } });

head am passing as below: const head = [{ content: "طيران الإمارات", styles: { valign: 'centre', cellPadding: {top: 3}, fontSize: 9, fontStyle: 'bold', cellWidth: 110.6 }, }, { content: 'Miles', styles: { fontSize: 9, fontStyle: 'normal', valign: 'centre', cellWidth: 35 }, }, { content: 'Tier Miles', styles: { fontSize: 9, fontStyle: 'normal', valign: 'centre', cellWidth: 35 }, } ];

with Helvetica Font, Head Text showing as Special characters.

With Custom font Its showing in Arabic but word is breaking I have passed as header this “طيران الإمارات” but in pdf its showing as this طير لإما ArabicBrakWord SpecialChar

** Breaking word

Can you please me help on this

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
mmghvcommented, Mar 23, 2020

Here you go :

custom-font.zip

  • I first downloaded the font files (example font : Amiri from google fonts)
  • Then, using jsPDF font-converter I converted the font file to js file
  • then simply imported the font js file after importing both jsPDF and jsPDF-AutoTable

Just one thing, I noticed that some fonts may have small problems with some of the letters (letters compilations or tashkeel) , so you will need to test couple of fonts before deciding on a good font to use.

1reaction
mmghvcommented, Mar 22, 2020

Check if it does the same with jsPDF then it’s a font problem, otherwise create a codepen replicating the problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

Arabic Font Break - android - Stack Overflow
I am working on an Arabic App. I am wondering that my S3 is showing Arabic text correctly. But when I see the...
Read more >
Arabic word breaks when changing a letter's weight using a ...
Arabic word breaks when changing a letter's weight using a variable font. How can I keep the letters connected when using variable features?...
Read more >
How to Fix Arabic and Hebrew typing Problems in Adobe ...
How to Fix Arabic and Hebrew typing Problems in Adobe Illustrator CC.Fix Arabic letters are not joined together in Illustrator CC / CS6....
Read more >
some arabic text breaks while exporting to PDF
I have Arabic text on report but for some text font breaks whiles exporting to pdf but on viewer it appears correct.
Read more >
Reference — xhtml2pdf 0.2.7 documentation
We're working on fixing this. However, it works by using the @font-face tag in the CSS definition and defining a custom font. Therefore...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found