michal-h21 / linebreaker

Some excersises with luatex's line breaking callback
15 stars 1 forks source link

[Bug] Unusable in Arabic documents #6

Closed amarakon closed 1 year ago

amarakon commented 1 year ago

First, thanks for such a useful LaTeX package. But unfortunately, I cannot use it on my Arabic documents because it causes two problems:

  1. Paragraphs are typeset from left to right, instead of from right to left.
  2. The Arabic letters look detached and glitchy.

Here is a minimum working example you can use to test it:

\documentclass{article}

\usepackage{linebreaker}
\usepackage[bidi = basic]{babel}
\babelprovide[main]{arabic}
\babelfont{rm}{Scheherazade New}

\begin{document}
لكن لا بد أن أوضح لك أن كل هذه الأفكار المغلوطة حول استنكار  النشوة وتمجيد الألم
نشأت بالفعل، وسأعرض لك التفاصيل لتكتشف حقيقة وأساس تلك السعادة البشرية، فلا أحد
يرفض أو يكره أو يتجنب الشعور بالسعادة، ولكن بفضل هؤلاء الأشخاص الذين لا يدركون بأن
السعادة لا بد أن نستشعرها بصورة أكثر عقلانية ومنطقية فيعرضهم هذا لمواجهة الظروف
الأليمة، وأكرر بأنه لا يوجد من يرغب في الحب ونيل المنال ويتلذذ بالآلام، الألم هو الألم
ولكن نتيجة لظروف ما قد تكمن السعاده فيما نتحمله من كد وأسي.
\end{document}
hpvd commented 1 year ago

just an addition for when trying to reproduce: Scheherazade New is available at: https://software.sil.org/scheherazade/

hpvd commented 1 year ago

comparison (latest Miktex, Windows, font installed as ttf) 2023-03-06_12h02_43

@amarakon is this screenshot of "without the package" looking the way you would rate it as good? (sorry, I have no experience how arabic should look like)

michal-h21 commented 1 year ago

Thanks for the report. The paragraph direction is lost, which causes both issues. Hopefully, the last commit should fix this issue.

hpvd commented 1 year ago

wow, fast as always. If @amarakon confirms everything looking fine now, -> maybe it's a good reason for a new release to ctan? The last one was one year ago... https://ctan.org/pkg/linebreaker

michal-h21 commented 1 year ago

Yes, I should make an update if everything works. This is a serious issue.

hpvd commented 1 year ago

btw @amarako having you in this discussion is a rare chance.

-> Would you mind giving the combination of

a try for an Arabic document?

And report if everything looks fine to you? Would be awesome!

Background: since both packages are complementing each other in a perfect way, they are often used together

see https://github.com/gucci-on-fleek/lua-widow-control

amarakon commented 1 year ago

@amarakon is this screenshot of "without the package" looking the way you would rate it as good? (sorry, I have no experience how arabic should look like)

Yes, that looks perfect. Thanks for such a quick fix!

wow, fast as always. If @amarakon confirms everything looking fine now, -> maybe it's a good reason for a new release to ctan? The last one was one year ago... https://ctan.org/pkg/linebreaker

I agree, I think this is a good idea.

-> Would you mind giving the combination of

  • this linebreaker package
  • with the lua-widow-control package

a try for an Arabic document?

I tried both of them together, and they both work as expected. linebreaker prevents overfull lines, and lua-widow-control prevents widows and orphans.

hpvd commented 1 year ago

many thanks!

hpvd commented 1 year ago

@michal-h21 thanks for new release on ctan!