Git Product home page Git Product logo

dart_bidi's Issues

Using Arabic letters basic from in favor of isolated form

Hey, @xclud
context: There are two letter forms in Arabic that render exactly the same, the basic form and the isolated form.

Notices how the following Arabic letter LAM has the same glyph for both basic and isolated form.
image

currently, the algorithm maps to the isolated form which might be the right thing to do but unfortunately Arabic Google fonts seem to have a problem with this, this issue can be fixed by always mapping to the basic form when an isolated form is required.

even dart seems to work with the basic form in such cases

 final letter = 'ل';
 print(letter.codeUnits); // prints [1604]
 print(bidi.logicalToVisual(letter)); // prints [65245]

I'm willing the make a PR, but do you think we should introduce this change as an optional change or just hard-code it?

P.s I'll be changing the mappings inside of shapping_resolver._charForms

Null safety

Hi, any plans to convert this code to null-safe?

Incorrect Handling of Specific Kurdish Characters in Dart Bidi Package

I am facing an issue with the Dart Bidi package related to the incorrect handling and rendering of specific Kurdish characters. The issue arises when using the Bidi algorithm to manage and display text that contains these characters:

U+06B5 (Kurdish LAM WITH SMALL V: ڵ)
U+06CE (Kurdish FARSI YEH WITH THREE DOTS BELOW: ێ)
U+06D5 (Kurdish AE: ە)

Untitled

Context

I have used several fonts that support Kurdish, including NotoSansArabic and NotoSansKurdish. These fonts work perfectly in the FlutterFlow UI and in other environments like MS Word.

Initially, I suspected that the problem was related to the dart_pdf package, and I spent considerable time investigating and debugging the issue. After cloning the dart_pdf repository and reviewing the code extensively, I found that the bug was not in dart_pdf itself, but in the Dart Bidi package, specifically in how the bidi algorithm processes these Kurdish characters.

Additionally, I discovered a related issue on the dart_pdf GitHub repository from 2013 (Issue #1408: Bug in bidi text rendering), which describes a similar problem with the Bidi algorithm not handling certain character sets correctly. This bug still affects current projects, and it is essential for this issue to be addressed.

What I Have Tried
Cloned and investigated dart_pdf: I initially thought the issue was due to dart_pdf. After spending time cloning the repository and reviewing the Bidi implementation within dart_pdf, I realized that the root of the problem was in how the Dart Bidi package processes these Kurdish characters. Because i found that dart_pdf Applies THE BIDIRECTIONAL ALGORITHM using (https://pub.dev/packages/bidi)
4f

Modified various Bidi settings: I experimented with different configurations within the dart_bidi package, including altering character shaping logic and adjusting text handling strategies. However, the incorrect shaping of Kurdish characters persisted.

Despite these efforts, I have been unable to find a solution to this issue, and it appears to be a bug within the dart_bidi package itself.

Similar Issues:
I noticed that similar issues have been reported in other frameworks, which may help better understand the problem because they are exactly the same. (e.g., Stimulsoft and Aspose), so it seems like a broader Unicode rendering issue.

Just for making the problem easier to fix:
In kurdish ڵ is just treated as ل in arabic
In kurdish ێ is just treated as ئ in arabic
In kurdish ە is just treated as ة in arabic

[Bug] When Arabic letter has a HAMZA-form reshaping throws an error

first of all, thank you for this great package.
I've noticed that when a letter of the sentence has a HAMZA an error occurs.
I think the problem is letters with Hamza should be reshaped not decomposed into a base letter and a diacritic.

All of these throw an out of range error

  bidi.logicalToVisual('أ');
  bidi.logicalToVisual('إ');
  bidi.logicalToVisual('ؤ');
  bidi.logicalToVisual('ئ');

stacktrace

RangeError (index): Invalid value: Only valid value is 0: 1
dart:core                               List.[]
package:bidi/src/paragraph.dart 752:24  Paragraph.internalCompose
package:bidi/src/paragraph.dart 113:5   Paragraph.normalizeText
package:bidi/src/paragraph.dart 42:5    Paragraph.text=
package:bidi/src/paragraph.dart 13:10   new Paragraph
package:bidi/src/bidi.dart 73:13        splitStringToParagraphs
package:bidi/src/bidi.dart 9:16         logicalToVisual
test/arabic_test.dart 40:8              main

these don't throw an error but the result is incorrect

  bidi.logicalToVisual('خطأ');
  bidi.logicalToVisual('كؤ');
  bidi.logicalToVisual('مئ');

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.