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:
- The paragraph direction remains LTR. I can't find anywhere to set this.
- 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}
babel
expects a completeini
file. The values may be empty, but the basic sections and the corresponding keys should be present. Maybebabel
should accept "short"ini
files like this.babel-classicsyriac.tex
file needed? It seems to work without it.