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
When we want to have right-to-left text, such as Persian or Arabic, and the features are set to rtla or rtlm, and we want to set the align to justify, the alignment is applied from the left side. It seems that there is a need for an additional setting to adjust the text direction as well.
Code sample
import{createWriteStream}from"fs";importPDFDocumentfrom"pdfkit";// Create a documentconstdoc=newPDFDocument({size: "A4"});doc.page.margins={top: 100,bottom: 100,left: 100,right: 100};constfonts={regular: "./fonts/DanaFaNum-Regular.ttf",};conststyles={normal: doc.font(fonts.regular).fontSize(15),};doc.pipe(createWriteStream("output.pdf"));consttext="این یک متن فارسی است که ما میخواهیم بدانیم آیا این کتابخانه میتواند این متن را ساپورت کند یا خیر؟ به عبارت دیگر هیچ زبان برنامهنویسی و کتابخانه درستی در دنیا وجود ندارد که از یک متن فارسی یا راست به چپ پشتیبانی کند!";styles.normal.text(text,{features: ["rtla"],align: "justify",});styles.normal.text(text,{features: ["rtla"],align: "right",});doc.end();
Your environment
pdfkit version:0.13.0
Node version:v18.16.0
Browser version (if applicable):
Operating System:ubuntu 22
The text was updated successfully, but these errors were encountered:
Bug Report
When we want to have right-to-left text, such as Persian or Arabic, and the features are set to rtla or rtlm, and we want to set the align to justify, the alignment is applied from the left side. It seems that there is a need for an additional setting to adjust the text direction as well.
Code sample
Your environment
The text was updated successfully, but these errors were encountered: