for a school assignment I need to display some Lepcha. This is what I had initially:
\documentclass[12pt]{article}
\usepackage[a4paper]{geometry}
\usepackage{fontspec}
\setmainfont{Gentium Plus}
\usepackage{parskip}
\usepackage{multicol}
\usepackage{vowel}
\usepackage{pifont}
\newcommand{\BlankCell}{}
\usepackage{polyglossia}
\setdefaultlanguage{german}
\setotherlanguages{bengali, hindi, malayalam, khmer, french, greek, russian, thai, armenian, tibetan, lepcha}
\overfullrule=2cm % displays black bars where the line extends over the edge of the page.
%THE OTHER SCRIPTS ARE DEFINED LIKE THIS, SO I FIGURED I CAN DO THE SAME WITH LEPCHA.
\newfontfamily\lepchafont[Script=Lepcha]{Noto Sans Lepcha}
\newfontfamily\bengalifont[Script=Bengali]{Shonar Bangla}
\newfontfamily\hindifont[Scr... and so on
The other scripts are defined like this, so I figured I could just add another one.
Now, this is a header file that is loaded into another file, but the error redirects here directly and I suppose it has to do with Lepcha not being defined in the polyglossia package, but I don't know how to define it separately. This is the error I got:
LaTeX error: "kernel/key-choice-unknown" Key 'fontspec/Script' accepts
only a fixed set of choices. For immediate help type H .
…epchafont[Script=Lepcha]{Noto Sans Lepcha}
I tried adding it in a similar fashion as Kana and Hangul, but that also didn't do the trick. This is what that miserable attempt looks like:
\usepackage{xeCJK}
\xeCJKDeclareSubCJKBlock{Kana}{"3040 -> "309F, "30A0 -> "30FF, "31F0 -> "31FF, "1B000 -> "1B0FF}
\xeCJKDeclareSubCJKBlock{Hangul}{"1100 -> "11FF, "3130 -> "318F, "A960 -> "A97F, "AC00 -> "D7AF, "D7B0 -> "D7FF}
\xeCJKDeclareSubCJKBlock{Lepcha}{"1C00 -> "1C4F}
The following code is supposed to output like in the picture below, but doesn't as of now.
...
\definelingstyle{Lepcha}{}
...
\ex[lingstyle=Lepcha]<lepcha>
\begingl
\glpreamble \rightcomment{[Lepcha]} ᰃᰨ ᰎᰥᰨᰜᰤᰦᰵ ᰀᰩᰰ ᰍᰩᰵᰡᰨ //
\gla go proljaŋ-kɔn nɔŋ-ʃo//
\glb 1\textsc{sg} Bhutan-side go-\textsc{nprt}//
\glft `I am going in the direction of Bhutan.’ (Plaisier 2007:82)} //
\endgl
\xe
What other information do you need?
Best Answer
There are multiple issues here (and the error message isn't for the reason you guessed):
fontspec
The package
fontspec
lets you use any font (installed on your computer) in the (now) standard OpenType format (such as Noto Sans Lepcha in this case), in XeTeX or LuaTeX.Generally, LaTeX and its packages are not exactly known for helpful error messages, but
fontspec
is excellent in this respect. If your file starts withand you compile it with
xelatex
, you get the error message:If you've used LaTeX much you've probably despaired of ever getting anything useful by typing that
H
, but this case is an exception: typing H at that prompt gives:which is perfectly clear: it means that fontspec doesn't recognize the
[Script=Lepcha]
in yourIf you look up the fontspec documentation by invoking
texdoc fontspec
(or by finding it online), you'll see in section 10.18 "OpenType scripts and languages" that the list of supported scripts is quite small, and Lepcha isn't in the list:There are two directions we can go from here:
Path 1: Making "Script=Lepcha" work
You'll also see in section 10.18.2 "Defining new scripts and languages" the way to define new scripts not included in the table: for example,
where the first argument is the fontspec name, and the second is the OpenType tag.
What is the OpenType tag to use? The OpenType specification says it's
lepc
, so let's try that. Here's a minimal working example:produces:
The compilation also produces this warning:
but the output is fine so we can ignore it. But should we?
Path 2: Understanding what's going on
If you actually read the
fontspec
documentation, you'll understand what the commandis supposed to mean: it asks to load, whenever you write
\lepchafont
, the OpenType font "Noto Sans Lepcha", with the further information that you wish to use the font's OpenType features for script "Lepcha". This further information is intended for good multilingual fonts that contain different font features for different scripts.In this case, if you get Noto Sans Lepcha in its released version and examine the font with ttx, you'll find that nowhere does the font contain any features specific to script tag
lepc
. Even the early-access version of Noto Sans Lepcha mentionslepc
only in the font's GPOS table and not in its GSUB table as is the case with other fonts like, say, Noto Sans Kannada. In other words, Noto Sans Lepcha implements its complex text layout not using the new Lepcha-aware way, but using the default way with ligatures, under script tag "DFLT". You can also see this in the.log
file produced by xelatex, which has this information fromfontspec
:Why does the font do things this way? You can see illuminating discussions here:
lepc
tag; older shaping engines don't.Anyway, the point is that as Noto Sans Lepcha does not contain the script tag
lepc
, you should not use what was written in Path 1: you can use(as "DFLT" (for "default") is the script tag used), but the more sensible thing to do is to simply load the font without specifying the additional information, which means that the below is the correct minimal example, one line shorter than earlier:
polyglossia
The package polyglossia (see documentation by invoking
texdoc polyglossia
, or find it online) helps with a bunch of things that you may want to do when you switch languages in a document: change hyphenation patterns, change fonts and typographical conventions, change date and number formats, etc. For changing fonts for a particular language or script, it relies on the assumption that you defined it under the convention\<script>font
or\<language>font
.Thus for example, instead of
one can write
and get further benefits (in longer texts) beyond changing fonts, such as hyphenation patterns and so on. It turns out that
polyglossia
recognizes even fewer languages (and Lepcha isn't in the list):but that is not a big problem for you: just remove "lepcha" (and if you have an older version of polyglossia, "khmer") from your list
expex
Finally, there seem to be errors in your example with expex:
}
in(Plaisier 2007:82)}
\lepchafont
(but see "bonus" section below).With those fixed, here is a minimal working example:
which produces
as in your question.
Bonus: ucharclasses
If you dislike having to explicitly set
\lepchafont
for the Lepcha text, you can use the packageucharclasses
. As usual, you can see its documentation withtexdoc ucharclasses
or online: this package detects when some text in your input comes from a different Unicode block, and can execute a custom command for that text. You can use this to automate switching the font (or more, e.g. switch language for a language supported by polyglossia). So you can give your input as below, to get the same output as above: