1

How do you set up a new RTL language for babel using the new locale ini file system?

e.g., consider trying to set up support for Classical Syriac. I started with babel-ar.ini and modified it to what I think should appear (although really I'm mostly guessing).

However, there are two problems:

  1. The paragraph direction remains LTR. I can't find anywhere to set this.
  2. The font Script and Language is not correctly set.

The MWE below gives this warning:

Package babel Warning: The current font is not a standard family:
(babel)                NotoSansSyriac:mode=node;script=syrc;language=SYR;
(babel)                Script and Language are not applied. Consider
(babel)                defining a new family with \babelfont.
(babel)                Reported on input line 3.

With Arabic the Script and Language are set from the contents of babel-ar.ini. I've assume this is from tag.opentype and script.tag.opentype, but it seems not to work.

The font itself reports:

$ otfinfo -s /usr/share/fonts/truetype/noto/NotoSansSyriac-Regular.ttf 
DFLT        Default
syrc        Syriac
syrc.SYR    Syriac/Syriac
syrc.SYRE   Syriac/<unknown language>
syrc.SYRJ   Syriac/<unknown language>
syrc.SYRN   Syriac/<unknown language>

What am I doing wrong?

MWE

Compile with lualatex.

\documentclass{article}

\usepackage{filecontents}

\begin{filecontents}{babel-classicalsyriac.tex}
\ifx\BabelBeforeIni\undefined
  \PackageError{babel}%
    {This file is a component of babel and cannot\MessageBreak
     be loaded directly. I'll stop immediately}%
    {Just use babel as documented.}%
  \stop
\fi
\BabelBeforeIni{syc}{%
}
\endinput
\end{filecontents}

\begin{filecontents}{babel-syc.ini}
[identification]
charset = utf8
version = 0.1
date = 2019-08-25
name.local = ܠܫܢܐ ܣܘܪܝܝܐ
name.english = Syriac
name.babel = classicalsyriac
tag.bcp47 = syc
tag.opentype = SYR
script.name = Syriac
script.tag.bcp47 = Syrc
script.tag.opentype = syrc
level = 1
encodings = 
derivate = no
\end{filecontents}

\usepackage[nil,bidi=basic-r]{babel}
\babelprovide[import=syc,main]{classicalsyriac}
\babelprovide[import=en,language=Default]{english}
\babelfont[classicalsyriac]{rm}{Noto Sans Syriac}
\babelfont[classicalsyriac]{sf}{Noto Sans Syriac}
\babelfont[classicalsyriac]{tt}{Noto Sans Syriac}
\babelfont{rm}{Latin Modern Sans}
\babelfont{sf}{Latin Modern Sans}
\babelfont{tt}{Latin Modern Mono}

\newfontfamily\sycfont{Noto Sans Syriac}[Script=Syriac, Language=Syriac]

\renewcommand{\familydefault}{\sfdefault}

\begin{document}
ܛܘܼܒܲܝܗܘܿܢ ܠܐܲܝܠܹܝܢ ܕܲܕ݂ܟܹܝܢ ܒܠܸܒ̇ܗܘܿܢ܄ ܕܗܸܢ݂ܘܿܢ ܢܸܚܙܘܿܢ ܠܐܲܠܵܗܵܐ܂

\selectlanguage{english}

Blessed are the pure in heart, for they shall see God.

\bigskip

Correct output:

\pardir TRT \textdir TRT \sycfont
ܛܘܼܒܲܝܗܘܿܢ ܠܐܲܝܠܹܝܢ ܕܲܕ݂ܟܹܝܢ ܒܠܸܒ̇ܗܘܿܢ܄ ܕܗܸܢ݂ܘܿܢ ܢܸܚܙܘܿܢ ܠܐܲܠܵܗܵܐ܂

\end{document}

MWE output

  • 1
    babel expects a complete ini file. The values may be empty, but the basic sections and the corresponding keys should be present. Maybe babel should accept "short" ini files like this. – Javier Bezos Aug 25 '19 at 8:25
  • @JavierBezos, Cool! It does work with just the major sections included. But I still get the font warning. What causes this? – David Purton Aug 25 '19 at 10:00
  • @JavierBezos, and is the babel-classicsyriac.tex file needed? It seems to work without it. – David Purton Aug 25 '19 at 10:04
  • @JavierBezos, feel free to write an answer to this, if you like, otherwise I can. – David Purton Aug 25 '19 at 12:31
0

Thanks to Javier in the comments, it turns out that babel needs all sections added to the language ini file even if they are left empty.

MWE

\documentclass{article}

\usepackage{filecontents}

\begin{filecontents}{babel-syc.ini}
[identification]
charset = utf8
version = 0.1
date = 2019-08-25
name.local = ܠܫܢܐ ܣܘܪܝܝܐ
name.english = Classical Syriac
name.babel = classicalsyriac
tag.bcp47 = syc
tag.opentype = SYR
script.name = Syriac
script.tag.bcp47 = Syrc
script.tag.opentype = syrc
level = 1
encodings = 
derivate = no
[captions]
[date.gregorian]
[date.islamic]
[time.gregorian]
[typography]
[characters]
[numbers]
[counters]
\end{filecontents}

\usepackage[nil,bidi=basic-r]{babel}
\babelprovide[import=syc,main]{classicalsyriac}
\babelprovide[import=en,language=Default]{english}
\babelfont[classicalsyriac]{rm}{Noto Sans Syriac}
\babelfont[classicalsyriac]{sf}{Noto Sans Syriac}
\babelfont[classicalsyriac]{tt}{Noto Sans Syriac}
\babelfont{rm}{Latin Modern Sans}
\babelfont{sf}{Latin Modern Sans}
\babelfont{tt}{Latin Modern Mono}

\renewcommand{\familydefault}{\sfdefault}

\begin{document}
ܛܘܼܒܲܝܗܘܿܢ ܠܐܲܝܠܹܝܢ ܕܲܕ݂ܟܹܝܢ ܒܠܸܒ̇ܗܘܿܢ܄ ܕܗܸܢ݂ܘܿܢ ܢܸܚܙܘܿܢ ܠܐܲܠܵܗܵܐ܂

\selectlanguage{english}

Blessed are the pure in heart, for they shall see God.
\end{document}

MWE output

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.