1

I am facing problem using bangla letters as label in the nested list, posted a question, After hours of surfing into the problem myself, I came up with a solution stated to that question.

New problem is that I have seen some gaps between letters shown in the following figure (highlighted). The gaps are unexpected. How to solve it?

enter image description here

Here is my working example:

\documentclass[10pt,a4paper,showtrims]{memoir}

\usepackage{babel}
\babelprovide[main,onchar = fonts ids]{bengali}
\babelfont[bengali]{rm}[
  Renderer=Harfbuzz,
  AutoFakeBold,
  AutoFakeSlant=0.3,
  NFSSFamily=kalpurush,
]{fontkalpurush.ttf}
\babelcharproperty{`।}{locale}{bengali}

\babelprovide[maparabic,alph=alphabetic]{bengali}

% fix `matra` in bangla text
\makeatletter
\AtBeginDocument{%
 \def\bbl@mapdir#1{%
   {\def\languagename{#1}%
    \let\bbl@ifrestoring\@firstoftwo % To avoid font warning
    \bbl@switchfont
    \ifnum\fontid\font>\z@
      \directlua{
        Babel.locale_props[\the\csname bbl@id@@#1\endcsname]%
              ['/\bbl@prefontid'] = \fontid\font\space}%
    \fi}}}%
\makeatother

\begin{document}
\section{প্রথম}
\begin{enumerate}
    \item আইটেম ১
    \begin{enumerate}
        \item নেস্টেড আইটেম ১
        \item নেস্টেড আইটেম ২
    \end{enumerate}
    \item আইটেম ২
\end{enumerate}
\section{প্রথম অধ্যায়}
    \begin{enumerate}
        \item ফু
        \begin{enumerate}
            \item বার আইটেম ১
            \item ফু
        \end{enumerate}
        \item বার
    \end{enumerate}
\end{document}

Note that: I had to face this problem previously and a solution is provided by @Javier Bezos. Link is given here: Answer is here. But the solution is not working now.

2
  • 1
    I'm still not sure, but it seem a problem with the Harfbuzz renderer related to hyphenation. As a workaround, try with \babelprovide[main,onchar = fonts ids,hyphenrules=+]{bengali}. The last option creates an empty set of rules for Bengali. If this works for you, I’ll convert this comment into an answer. Commented Dec 2, 2021 at 8:22
  • @JavierBezos Actually my document is huge (around 300 pages), mainly written in Bengali. Sometimes, I find problems adding new commands. Thanks to you for you kind help previously. Adding hyphenrules=+ options solved the problem for now. You can post your answer here with your explanation (if any) and I will accept it. Thanks again.
    – mmr
    Commented Dec 2, 2021 at 11:27

1 Answer 1

1

When investigating this issue I discovered there was a mistake in the style file for Bengali, because the prehyphenchar is set to 0 instead of keeping the default. I’ve fixed it in the GitHub repository and it should be in CTAN in a few weeks. With this change, the text is correctly rendered.

But—

Even with prehyphenchar = 0 it should be correctly rendered, and I’ve opened an issue in the luaotfload GitHub repository.

Options

1. Assign to the language an empty set of hyphenation pattern, created on the fly. This is the workaround I suggested in my the comment above, which should work with any version of babel adapted to lualatex (several years).

\babelprovide[import, main, hyphenrules=+]{bengali}

2. Fix the prehyphenchar by setting it to empty (which means ‘use the default’). This will work with many versions, and words will by hyphenated. This is done in the following way, when the locale is imported:

\babelprovide[import, main, typography/prehyphenchar=]{bengali}

3. Set the justification mode to unhyphenated. This is essentialy the same as 1, but the number of underfull or overfull hboxes will be dramatically reduced by allowing wide spaces, which may look odd for European typography, but has been a common practice in some scripts. This alternative only works with recent versions.

\babelprovide[import, main, justification=unhyphenated]{bengali}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .