2

When I use \XeTeXlinebreaklocale "my_MM" \XeTeXinterwordspaceshaping=2 options in XeLaTex, I could get my paragraph properly justified. How can I get similar justification using LuaLaTex. I've tried \normalsize \emergencystretch=100pt option, but the result doesn't look as good as XeLaTex output. I've attached the output of both XeLaTex and LuaLaTex below for comparison purpose.

%%%% XeLaTex
\documentclass[landscape]{memoir}

\usepackage{fontspec,polyglossia,url}

\newfontfamily{\burmeseFamily} {Padauk Book}[Renderer=Harfbuzz,Script=Myanmar]

\begin{document} \burmeseFamily

%Important of the desired justification \XeTeXlinebreaklocale "my_MM" %Myanmar line and character breaks \XeTeXinterwordspaceshaping=2

\begin{sloppypar} \section{ကားရဲလ်နဲ့ မိတ်ဆက်ခြင်း} ဒါကြောင့် စက်ရုပ်ကားရဲလ်ကို သူရောက်နေတဲ့ ကမ္ဘာမှာ အလုပ်တွေ လုပ်ခိုင်းဖို့ လေးတွေ အရင်ဆုံး ရေးကြည့်ကြမယ်။ မှာ ပြထားတာက ကားရဲလ် ရောက်ရှိနေမဲဲ့ နမူနာ ကမ္ဘာပါ။ ကားရဲလ်ရဲ့ ကမ္ဘာထဲက မီးခိုးရောင် ဆနွင်းမကင်းကွက်ပုံ အရာကို လို့ ခေါ်တယ်။ ကားရဲလ်ကို အပြောစကားနဲ့ ခိုင်းလို့မရဘူး။ သူနားလည်တဲ့ တွေကို ရေးပြီးပဲ ခိုင်းလို့ရတယ်။ ကမ္ဘာ့ \section{ကားရဲလ်နားလည်တဲ့ လေးခု} ကားရဲလ်က အခြေခံအားဖြင့် လေးခုကိုပဲ နားလည်တယ်။ တို့ ဖြစ်တယ်။ ကွန်မန်းက သူရပ်နေတဲ့ ကနေ ရှေ့တည့်တည့် ကပ်ရပ် ကို ရွှေ့ခိုင်းတာ။ ‌တွေကို အပေါင်းသင်္ကေတ လေးတွေနဲ့ ပြထားတယ်။ ပုံထဲမှာ သေးနေတဲ့အတွက် အစက်လေးတွေလို့ ထင်ရတယ်။ ကားရဲလ်ကို ကွန်မန်းပေးလိုက်ရင်တော့ ကားရဲလ်က သူရှိနေတဲ့ ကွန်နာမှာ အတုံးလေး တစ်ခု ချထားလိမ့်မယ်။ ကွန်မန်းက ဘိပါကောက်ခိုင်းတာပါ။ ကားရဲလ်ရောက်နေတဲ့ ကွန်နာမှာ ဘိပါရှိရင် ဒီကွန်မန်းနဲ့ ကောက်ခိုင်းလို့ရတယ်။ \end{sloppypar} \end{document}

This is LuaLaTex code I've tried for reference:

\documentclass[landscape]{memoir}

\usepackage{fontspec,polyglossia,url}

\newfontfamily{\burmeseFamily} {Padauk Book}[Renderer=Harfbuzz,Script=Myanmar]

\begin{document} \burmeseFamily

%Important of the desired justification %\XeTeXlinebreaklocale "my_MM" %Myanmar line and character breaks %\XeTeXinterwordspaceshaping=2

\normalsize \emergencystretch=100pt

\section{ကားရဲလ်နဲ့ မိတ်ဆက်ခြင်း} ဒါကြောင့် စက်ရုပ်ကားရဲလ်ကို သူရောက်နေတဲ့ ကမ္ဘာမှာ အလုပ်တွေ လုပ်ခိုင်းဖို့ လေးတွေ အရင်ဆုံး ရေးကြည့်ကြမယ်။ မှာ ပြထားတာက ကားရဲလ် ရောက်ရှိနေမဲဲ့ နမူနာ ကမ္ဘာပါ။ ကားရဲလ်ရဲ့ ကမ္ဘာထဲက မီးခိုးရောင် ဆနွင်းမကင်းကွက်ပုံ အရာကို လို့ ခေါ်တယ်။ ကားရဲလ်ကို အပြောစကားနဲ့ ခိုင်းလို့မရဘူး။ သူနားလည်တဲ့ တွေကို ရေးပြီးပဲ ခိုင်းလို့ရတယ်။ ကမ္ဘာ့ \section{ကားရဲလ်နားလည်တဲ့ လေးခု} ကားရဲလ်က အခြေခံအားဖြင့် လေးခုကိုပဲ နားလည်တယ်။ တို့ ဖြစ်တယ်။ ကွန်မန်းက သူရပ်နေတဲ့ ကနေ ရှေ့တည့်တည့် ကပ်ရပ် ကို ရွှေ့ခိုင်းတာ။ ‌တွေကို အပေါင်းသင်္ကေတ လေးတွေနဲ့ ပြထားတယ်။ ပုံထဲမှာ သေးနေတဲ့အတွက် အစက်လေးတွေလို့ ထင်ရတယ်။ ကားရဲလ်ကို ကွန်မန်းပေးလိုက်ရင်တော့ ကားရဲလ်က သူရှိနေတဲ့ ကွန်နာမှာ အတုံးလေး တစ်ခု ချထားလိမ့်မယ်။ ကွန်မန်းက ဘိပါကောက်ခိုင်းတာပါ။ ကားရဲလ်ရောက်နေတဲ့ ကွန်နာမှာ ဘိပါရှိရင် ဒီကွန်မန်းနဲ့ ကောက်ခိုင်းလို့ရတယ်။ \end{document}

XeLaTex output: enter image description here

This is LuaLaTex output. To me, the spacing of words doesn't look as good as XeLaTex. enter image description here

Pyi Soe
  • 310
  • I don't know your script and the rules you need. You could make a feature request for babel to implement these rules, (it already has a number of linebreaking options). – Ulrike Fischer Jul 17 '22 at 16:53
  • @UlrikeFischer thanks for the suggestion again! Frankly, I don't think I am up to the task to specify the rules for babel implementors. My own language and similar ones like Khmer, have complicated line braking rules. I know which line breaking makes sense and which doesn't only when I see the paragraph and the lines. I am just hoping that some expert submits the specification and request the feature for babel in the near future. – Pyi Soe Jul 18 '22 at 05:17
  • According to this link , it seems there are some algorithms for Burmese language line breaking rules. – Pyi Soe Jul 18 '22 at 05:34
  • as far as I can see it isn't really the spacing that is the issue, the stretched spaces are just the result of not splitting words. xetex is splitting အရင်ဆုံး luatex is not so has to take the whole word over, causing word spaces to be stretched. – David Carlisle Jul 18 '22 at 08:24
  • Hi @DavidCarlisle, you are right. XeTex can split our phrases appropriately for line breaking and justification whereas LuaTex cannot. By the way, in our language, not all individual words are always separated by spaces. Most of the time, words are combined into a unit ( I think I can call that unit a phrase) and only those phrases are separated by spaces. And those units are again allowed to be splitted when it comes to line breaking. It seems XeTex understands this whereas LuaTex doesn't. – Pyi Soe Jul 18 '22 at 08:58
  • XeTeX provides its own (hardcoded) mechanism to deal with linebreaking in some languages, while LuaTeX relies on the TeX standard hyphenation algorithm. Sadly, it seems no hyphenation patterns have been devised for Burmese, and I haven't been able to find any. – Javier Bezos Jul 18 '22 at 14:47
  • @JavierBezos, thanks for the info. I'll have to use whatever Tex variant that produces the results I'd like to see. Currently, it seems XeTex can fulfill my needs so far. By the way, to my knowledge, we have no such thing as hyphenation in our language. But as I mentioned in the previous comment, words are combined and treated as a unit mostly, and only for line breaking, words in a unit are allowed to flow into the next line. I tend to think it is like hyphenation of the phrases (the unit) rather than hyphenation of the words themselves. – Pyi Soe Jul 18 '22 at 15:15
  • Sure, but even if no hyphens are inserted, the line breaking is still based on the TeX hyphenation algorithm. A similar case is Thai (see an example with babel here: https://latex3.github.io/babel/guides/locale-thai.html ). – Javier Bezos Jul 18 '22 at 15:37
  • @JavierBezos I got your point. I guess there have been more efforts to get Thai and Khmer languages right. Probably because there are more users using those languages, and thus more feature requests and collaboration too as a result. – Pyi Soe Jul 18 '22 at 16:34

0 Answers0