dart_pdf icon indicating copy to clipboard operation
dart_pdf copied to clipboard

Arabic chars and English chars and numbers in one string order issue

Open Abanoub-Fouad opened this issue 3 years ago • 8 comments

Hello

When trying to display text which contains Arabic chars and English chars and numbers it shows with wrong order.

Example : "زيت موبيلوب SHC 90W75"

Screenshots image

note that I have to set text direction rtl to display Arabic chars in the correct way

Abanoub-Fouad avatar Jun 25 '21 17:06 Abanoub-Fouad

@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 avatar Jun 25 '21 17:06 DavBfr

@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

Abanoub-Fouad avatar Jun 25 '21 19:06 Abanoub-Fouad

any update ?

Shams-Mahmoud avatar Feb 20 '22 08:02 Shams-Mahmoud

@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;
}

a-eniou-pvotal avatar Mar 08 '22 18:03 a-eniou-pvotal

@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.

Milad-Akarie avatar Mar 22 '22 10:03 Milad-Akarie

Use git blame to find out.

DavBfr avatar Mar 22 '22 11:03 DavBfr

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)}';
    }

Milad-Akarie avatar Mar 22 '22 11:03 Milad-Akarie

Hello @DavBfr do you think you could publish the release with #990 pull request soon?

Milad-Akarie avatar Apr 13 '22 18:04 Milad-Akarie

This will help https://www.youtube.com/watch?v=LLBoRBAQIw0

myselfuser1 avatar Mar 17 '23 12:03 myselfuser1

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

github-actions[bot] avatar Apr 15 '23 00:04 github-actions[bot]

Closing this stale issue because it has no activity.

github-actions[bot] avatar Apr 21 '23 00:04 github-actions[bot]