DavBfr / dart_pdf

Pdf creation module for dart/flutter
https://pub.dev/packages/pdf
Apache License 2.0
1.42k stars 632 forks source link

Incorrect Arabic text rendering when using Arabic font as fallback in PDF export #1743

Open erwamartin opened 2 months ago

erwamartin commented 2 months ago

Describe the bug Hello, My Dart app is primarily used by English-speaking users, but we also support multiple languages, including Arabic. We've encountered an issue where, when the Arabic font is used as a fallback, the exported PDF renders Arabic characters incorrectly. The characters are spaced apart and do not appear connected as they should in the Arabic script.

However, when the Arabic font is set as the main font, the rendering works perfectly, and the text appears as expected.

To Reproduce

  1. Generate a PDF that contains Arabic text using an Arabic font as a fallback (not as the main font).
  2. Observe the output where Arabic characters are not correctly rendered (characters are spaced apart).

Expected behavior The output should render Arabic text correctly, whether the Arabic font is used as a fallback or as the main font.

Screenshots Arabic font as fallback: image

Arabic font as main font image

Desktop (please complete the following information):