-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
I am trying to print some Arabic text, and since we need to support bidirectional text, we are using bidi algorithm and Arabic Resharper. We are getting an exception to say
assert cid is not None, "Font %s can not represent '%s'" % (
AssertionError: Font HSNIbtisam can not represent 'ﺕ'
Knowing that the font support all Arabic characters.
def format(self, delivery_voucher: DeliveryVoucher):
document = Document()
page = Page()
document.add_page(page)
layout: PageLayout = SingleColumnLayout(page)
font_path = Path(__file__).parent / 'misc/fonts/Ibtisam.ttf'
custom_font = TrueTypeFont.true_type_font_from_file(font_path)
print(font_path)
arabic_text= "ابتثجحخدذرزسشصضطظعغفقكلمنهوي"
reshaped_text = arabic_reshaper.reshape(arabic_text)
bidirectional_text = algorithm.get_display(reshaped_text)
# add a Paragraph
layout.add(borb.pdf.Paragraph(bidirectional_text, font=custom_font))
# store
with open("output.pdf", "wb") as pdf_file_handle:
PDF.dumps(pdf_file_handle, document)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels