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

Fix: Only break text into several spans if the font fallback is not the same (in _preProcessSpans) #1744

Open erwamartin opened 2 months ago

erwamartin commented 2 months ago

Right now, when the main font doesn’t support certain characters, it creates a separate span for each one. This causes problems with the Arabic layout processor (and similar scripts), which needs the characters to stay together for proper rendering.

With this fix, we’ll only create a new span if the fallback font is different, allowing the layout to work correctly for complex scripts like Arabic.

Fixes https://github.com/DavBfr/dart_pdf/issues/1743

DavBfr commented 1 month ago

Can you add a test that highlight the fix with a correct rendering?