dart_pdf
dart_pdf copied to clipboard
English words are not in the correct order when mixed with Arabic and splitted to multiple lines
Describe the bug
When we mix Arabic and English words, the order of the English words is not correct when they split into multiple lines
To reproduce
Future<Uint8List> _generatePdf(PdfPageFormat format, String title) async {
final pdf = pw.Document(version: PdfVersion.pdf_1_5);
final fontStyle = pw.TextStyle(
fontSize: 50,
fontWeight: pw.FontWeight.bold,
font: await PdfGoogleFonts.iBMPlexSansArabicRegular(),
);
pdf.addPage(
pw.Page(
pageFormat: format,
build: (context) {
return pw.Text(
'قررت أن أقوم برحلة استكشافية إلى the historical old town',
style: fontStyle,
textDirection: pw.TextDirection.rtl,
);
},
),
);
return pdf.save();
}
Screenshots
Current behavior:
Expected behavior (To be in the correct order):
Flutter Doctor
[✓] Flutter (Channel stable, 3.13.2, on Linux Mint 21.2 5.15.0-82-generic,
locale en_US.UTF-8)
• Flutter version 3.13.2 on channel stable at
/home/hasan/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ff5b5b5fa6 (2 weeks ago), 2023-08-24 08:12:28 -0500
• Engine revision b20183e040
• Dart version 3.1.0
• DevTools version 2.25.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at /home/hasan/Android/Sdk
• Platform android-33-ext4, build-tools 33.0.2
• Java binary at: /home/hasan/development/android-studio/jbr/bin/java
• Java version OpenJDK Runtime Environment (build
11.0.15+0-b2043.56-8887301)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 13.0.0 (https://github.com/apple/llvm-project.git
c41f13252ed4b49f246729b4d91ff521d5a6bf9d)
• cmake version 3.22.1
• ninja version 1.10.1
• pkg-config version 0.29.2
[✓] Android Studio (version 2022.1)
• Android Studio at /home/hasan/development/android-studio
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
11.0.15+0-b2043.56-8887301)
[✓] VS Code (version 1.81.1)
• VS Code at /usr/share/code
• Flutter extension version 3.72.0
[✓] Connected device (3 available)
• SM N960F (mobile) • 2b32ca38291c7ece • android-arm64 • Android 13 (API
33)
• Linux (desktop) • linux • linux-x64 • Linux Mint 21.2
5.15.0-82-generic
• Chrome (web) • chrome • web-javascript • Google Chrome
116.0.5845.140
[✓] Network resources
• All expected network resources are available.
• No issues found!
Desktop (please complete the following information):
- [ ] iOS
- [X] Android
- [ ] Browser
- [ ] Windows
- [ ] Linux
Smartphone (please complete the following information):
- Device: Galaxy Note 9
- OS: Android 13