dart_pdf
dart_pdf copied to clipboard
Arabic chars and English chars and numbers in one string order issue
Hello
When trying to display text which contains Arabic chars and English chars and numbers it shows with wrong order.
Example : "زيت موبيلوب SHC 90W75"
Screenshots
note that I have to set text direction rtl to display Arabic chars in the correct way
@Abanoub-Fouad It's all in this file: https://github.com/DavBfr/dart_pdf/blob/master/pdf/lib/src/pdf/arabic.dart You'll have to fix it. I don't read Arabic writing.
@DavBfr thanks for replaying. the error not on the meaning but in the order of words if the correct order is 1 2 3 4 it displays 3 1 4 2
any update ?
@Shams-Mahmoud may help
import 'package:flutter/material.dart';
// ignore: implementation_imports
import 'package:pdf/src/pdf/font/arabic.dart' as arabic;
String? parseToArabic(
Locale locale,
String? input,
) {
final isLocaleAr = locale.languageCode == 'ar';
if (input != null) {
return isLocaleAr ? arabic.convert(input) : input;
}
return null;
}
@DavBfr who wrote the 'arabic.dart' file? the code causing the issue interrupts the logical flow, there must be a reason for this work around.
Use git blame
to find out.
Hey @anastr, can you help with this?
if (isNewWordArabic) {
isNewWordArabic = false;
for (final notArabicNewWord in notArabicWords) {
yield '${String.fromCharCodes(notArabicNewWord)} ';
}
notArabicWords.clear();
yield String.fromCharCodes(_resolveLigatures(newWord));
} else {
// notArabicWords.insert(0, newWord);
// if I yield the non Arabic word prefixed by a space everything
// seems to work fine but I don't know if it breaks something else
yield ' ${String.fromCharCodes(newWord)}';
}
Hello @DavBfr do you think you could publish the release with #990 pull request soon?
This will help https://www.youtube.com/watch?v=LLBoRBAQIw0
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
Closing this stale issue because it has no activity.