Coder Social home page Coder Social logo

Arabic Language Support ? about questpdf HOT 20 OPEN

questpdf avatar questpdf commented on May 21, 2024
Arabic Language Support ?

from questpdf.

Comments (20)

MarcinZiabek avatar MarcinZiabek commented on May 21, 2024 2

Hello 😁

Unfortunately, you are right. Currently, QuestPDF offers limited support for languages that require more advanced text shaping capability. I am planning to improve this in one of the nearest updates (possibly Q1/Q2 2022) by integrating the SkiaSharp.HarfBuzz nuget. I have never worked with Arabic (or equally complex languages). Therefore, I don't know yet how complex this feature is.

Would you like to help me explore this domain (requirements / use cases) and test the experimental releases? If everything goes well, it may be the February or March release 😁

from questpdf.

MarcinZiabek avatar MarcinZiabek commented on May 21, 2024 2

@MarcinZiabek any update on supporting Arabic language?

This feature is on the roadmap. In the nearest future I am planning to take care of more advanced text related capabilities, including Arabic language support and text shaping. In fact, this is my highest priority at this moment.

Lately, a lot is happening in my personal life (positive yet time-consuminn events) and some plans become slightly delayed. I develop QuestPDF in my spare time so it is usually first to be put on hold whenever needed. However, it is still being fully supported from my side, no need to worry!

from questpdf.

MarcinZiabek avatar MarcinZiabek commented on May 21, 2024 2

@mustafamagdy @megamanhxh @GeeSuth Great news! I have just finished integrating the text-shaping algorithm in QuestPDF. It uses the HarfBuzz library and supports many different languages, including Arabic of course, all depends on the font used. I think this is much more stable and reliable solution, with a very little performance cost.

Please download the QuestPDF 2022.6.0-prerelease, test it in your solutions and let me know if everything is all right 😁

Also, I am hoping to take care of the RTL mode in the next release. I hope that we can cooperate on it. I have a general idea about this mode, not sure about all details involved.

from questpdf.

GeeSuth avatar GeeSuth commented on May 21, 2024 1

@megamanhxh @mustafamagdy
there are a clear different between twice
`

Method Mean Error StdDev Gen 0 Allocated
AraibcPdfExtentionName 17.448 us 0.8517 us 2.4710 us 6.5002 13 KB
ArabicFixerName 7.483 us 0.2679 us 0.7729 us 2.0905 4 KB
`

tested for "بسم الله الرحمن الرحيم"

@MarcinZiabek I don't know if that possible to combine best class to your Library ?

from questpdf.

MarcinZiabek avatar MarcinZiabek commented on May 21, 2024 1

Make sure that your IDE searches also packages with the prerelease tag. For example, there a special checkbox in Visual Studio 😁

from questpdf.

GeeSuth avatar GeeSuth commented on May 21, 2024 1

image

Great Job 👍

from questpdf.

blockhunts avatar blockhunts commented on May 21, 2024

Will this case also applied to chinese/japanese characters?

from questpdf.

MarcinZiabek avatar MarcinZiabek commented on May 21, 2024

Will this case also applied to chinese/japanese characters?

As far as I understand, Chinese/Japanese characters are not connected with each other and do not need to be shaped. Therefore, you should be okey. If anyone knows better and wants to share the knowledge, please do 😀

from questpdf.

blockhunts avatar blockhunts commented on May 21, 2024

@MarcinZiabek Apparently it cannot properly Japanese characters, possibly will be same with Chinese characters.

image

from questpdf.

girlpunk avatar girlpunk commented on May 21, 2024

@blockhunts Does the font you're using contain those characters? That looks like it could be the unicode replacement character getting swapped in, which suggests the Japanese codepages aren't included.

from questpdf.

blockhunts avatar blockhunts commented on May 21, 2024

@girlpunk ahhh, that may be the case. I just tried to follow the getting started tutorial. And haven't fiddle with the other aspects like fonts.

from questpdf.

MarcinZiabek avatar MarcinZiabek commented on May 21, 2024

@blockhunts Does the font you're using contain those characters? That looks like it could be the unicode replacement character getting swapped in, which suggests the Japanese codepages aren't included.

I agree, this may be a potential reason. Unfortunately, QuestPDF does not support font fallback at this moment 😅 I am planning to cover it in one of the future updates but there are a lot of priorities to cover.

from questpdf.

blockhunts avatar blockhunts commented on May 21, 2024

@MarcinZiabek I see, I will patiently wait then 😄
Keep up the good works and cheers 🥂

from questpdf.

ehajri avatar ehajri commented on May 21, 2024

@MarcinZiabek any update on supporting Arabic language?

from questpdf.

mustafamagdy avatar mustafamagdy commented on May 21, 2024

@MarcinZiabek Any plans when Arabic support will be available? can you guide us to do a workaround if it will take time for you to add Arabic support natively in the library?. Much appreciated the great work.

from questpdf.

megamanhxh avatar megamanhxh commented on May 21, 2024

@mustafamagdy You may do a workaround at the moment to solve this issue. A script by @Konash used in Unity & Xamarin managed to apply a unicode fixes to any arabic text. Check out his script on his github repo: https://github.com/Konash/arabic-support-unity/blob/master/Assets/ArabicSupport/Scripts/ArabicSupport.cs

You may import the ArabicSupport.cs to your project and use it statically:

using ArabicSupport;
...
  page.Header().Text(text =>
  {
      text.Span("أهلاً وسهلاً");
      text.Span("\n");
      text.Span(ArabicFixer.Fix("أهلاً وسهلاً"));
      text.AlignCenter();
  });
...

example-resutls

You may have to look for ArabicFixer.Fix overrides to know how to enable "Tanween" and other arabic features. This is only for Arabic workaround, I don't know about other languages.

from questpdf.

mustafamagdy avatar mustafamagdy commented on May 21, 2024

@megamanhxh Thanks a lot. That is a good workaround. I also found simpler one, I had to test it, though.

from questpdf.

GeeSuth avatar GeeSuth commented on May 21, 2024

@MarcinZiabek I think QuestPDF 2022.6.0-prerelease is not uploaded yet ?
I searching about it in tag but not found!

from questpdf.

mseada94 avatar mseada94 commented on May 21, 2024

I find this package which still in development that support better text rendering with SkiaSharp
https://github.com/toptensoftware/RichTextKit

from questpdf.

MarcinZiabek avatar MarcinZiabek commented on May 21, 2024

I find this package which still in development that support better text rendering with SkiaSharp
https://github.com/toptensoftware/RichTextKit

You are correct, the RichTextKit library handles text in a superior way. That being said, improved text handling is one of the most important areas of improvement in the current QuestPDF roadmap. I hope that the recently introduced dual-licensing model will provide some funding and allow me to focus more on those crucial things 😀

from questpdf.

Related Issues (20)

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.