latex3 / babel

The babel system for LaTeX, LuaLaTeX and XeLaTeX
LaTeX Project Public License v1.3c
124 stars 34 forks source link

Tibetan line breaks (old) #250

Closed BenjaminGalliot closed 11 months ago

BenjaminGalliot commented 11 months ago

I have many problems with line breaks (and justification) for Tibetan, especially with LuaLaTeX but not only...

From what I've noticed:

My goal is to keep LuaLaTeX, but I have no clue how to go about it...

MWE:

\documentclass{book}

\usepackage{multicol}
\usepackage[french]{babel}

\babelprovide[import]{tibetan}

\babelfont[french]{rm}{Liberation Serif}
\babelfont[tibetan]{rm}{Noto Serif Tibetan}
\babelfont[chinese]{rm}{Noto Serif CJK TC}

\setlength{\parindent}{0pt}

\begin{document}

% \XeTeXlinebreaklocale "bo"

\begin{multicols}{3}

\selectlanguage{french}

Test : bonjour !

% \selectlanguage{chinese}

% 中文

\selectlanguage{tibetan}

སྒོ་ར་འདིའི་ནང་རྒྱ་རིགས་དང་། བོད་རིགས། ཁ་ཆེ་ཚང་མ་འདྲེས་བསྡད་ཡོད་རེད།སྒོ་ར་འདིའི་ནང་རྒྱ་རིགས་དང་། བོད་རིགས། ཁ་ཆེ་ཚང་མ་འདྲེས་བསྡད་ཡོད་རེད།སྒོ་ར་འདིའི་ནང་རྒྱ་རིགས་དང་། བོད་རིགས། ཁ་ཆེ་ཚང་མ་འདྲེས་བསྡད་ཡོད་རེད།སྒོ་ར་འདིའི་ནང་རྒྱ་རིགས་དང་། བོད་རིགས། ཁ་ཆེ་ཚང་མ་འདྲེས་བསྡད་ཡོད་རེད།སྒོ་ར་འདིའི་ནང་རྒྱ་རིགས་དང་། བོད་རིགས། ཁ་ཆེ་ཚང་མ་འདྲེས་བསྡད་ཡོད་རེད།

\end{multicols}

\end{document}

Have I missed something?

Edit 1:

For information, with Polyglossia, it works with both engines (without using CJK language nor the XeTeXlinebreaklocale command beforehand), but the management of justified lines (and spaces) is much less pretty with LuaLaTeX than with XeLaTeX.

MWE (Polyglossia):

\documentclass{book}

\usepackage{multicol}
\usepackage[french]{babel}

\usepackage{polyglossia}
\setdefaultlanguage{french}
\setotherlanguages{tibetan}

\newfontfamily\tibetanfont{Noto Serif Tibetan}

\setlength{\parindent}{0pt}

\begin{document}

% \XeTeXlinebreaklocale "bo"

\begin{multicols}{3}

\selectlanguage{french}

Test : bonjour !

% \selectlanguage{chinese}

% 中文

\selectlanguage{tibetan}

སྒོ་ར་འདིའི་ནང་རྒྱ་རིགས་དང་། བོད་རིགས། ཁ་ཆེ་ཚང་མ་འདྲེས་བསྡད་ཡོད་རེད།སྒོ་ར་འདིའི་ནང་རྒྱ་རིགས་དང་། བོད་རིགས། ཁ་ཆེ་ཚང་མ་འདྲེས་བསྡད་ཡོད་རེད།སྒོ་ར་འདིའི་ནང་རྒྱ་རིགས་དང་། བོད་རིགས། ཁ་ཆེ་ཚང་མ་འདྲེས་བསྡད་ཡོད་རེད།སྒོ་ར་འདིའི་ནང་རྒྱ་རིགས་དང་། བོད་རིགས། ཁ་ཆེ་ཚང་མ་འདྲེས་བསྡད་ཡོད་རེད།སྒོ་ར་འདིའི་ནང་རྒྱ་རིགས་དང་། བོད་རིགས། ཁ་ཆེ་ཚང་མ་འདྲེས་བསྡད་ཡོད་རེད།

\end{multicols}

\end{document}
jbezos commented 11 months ago

With the following font setup (just to adapt the mwe to my configuration and to use Harfbuzz):

\babelfont[french]{rm}{Liberation Serif}
\babelfont[tibetan]{rm}[Renderer=Harfbuzz]{NotoSerifTibetan-Regular.ttf}

I’m getting with luatex: image

And with xetex (note the tshegs are slightly displaced to the left and spacing with shads is irregular): image

jbezos commented 11 months ago

Also— Have a look at https://latex3.github.io/babel/news/whats-new-in-babel-3.81.html.

BenjaminGalliot commented 11 months ago

At first, it didn't change anything with what you said, which allowed me to see that I was still using Texlive 2021 (due to other tests). With Texlive 2023, it works fine (which is consistent with your last link, which dates from the end of 2022), and [Renderer=Harfbuzz] option changes indeed very finely some details that I do not notice with the eye.

Thank you!

jbezos commented 11 months ago

Glad it helped. If you need further help, just continue this thread.