# Tags for polytonic Greek with babel

Composing with Lualatex + fontspec + babel, the options to pass for the Greek language (if I'm not wrong) should be: greek, greek.polutoniko and greek.ancient.

Now, as you know, there are substitution mechanisms (some types of lookups) inside the fonts that are activated either with certain options in the text (for example RawFeature=+calt), or simply by calling a certain language. An example is the mechanism whereby by setting the language to Turkish with \selectlanguage{turkish} the command \MakeLowercase{II} transforms the capital letter < I > into a lowercase dottless letter < ı >. This is because in the font there is a replacement lookup valid for latn{ TRK}.

I have created in the font a replacement lookup valid for grek{ PGR} = for polytonic Greek, so that monotonic uses vowels with the acute accent tonos, while polytonic uses vowels with the acute accent oxia. This lookup (a single substitution or 'locl') should be activated when Greek is not monotonic.

The problem is that if I set \usepackage[greek.polutoniko]{babel} the mechanism does not work, ie in this case Lualatex does not seem to recognize that, being the polytonic Greek language, it should apply the substitution rule. In short, the font tag latn{ TRK} triggers the substitution when the language is Turkish, but the font tag grek{ PGR} does not trigger it when the language is polytonic Greek.

I ask (if I was clear enough) how it's possible to tag the text in a way that invokes inside the text the PGR language system feature lookups which is present inside the font.

Thank you

Minimal (not) working example

\documentclass{article}
\usepackage{fontspec}
\usepackage[italian]{babel}
\babelprovide[import]{polytonicgreek}
\newfontlanguage{Polutoniko}{PGR}
\babelfont[italian]{rm}[Numbers={Proportional,OldStyle},RawFeature=+supkern,RawFeature=+calt]{SimonciniGaramondPro}
\babelfont[greek]{rm}[Language=Polutoniko,RawFeature=+calt]{SimonciniGaramondPro}

\begin{document}

quel ramo del lago di Como

\selectlanguage{greek}

ά ὰ έ ὲ

\end{document}


Exit:

! Package babel Error: You haven't defined the language nil yet.
(babel)                Perhaps you misspelled it or your installation
(babel)                is not complete.


Thanks to your indications, it seems that I managed to solve. I apologize if I have not always understood these indications immediately. Furthermore, the matter was complicated by the fact that I had to create the right interaction between the font lookups and the Lualatex code.

This is the final code:

\documentclass{article}
\usepackage{fontspec}
\usepackage[italian]{babel}
%\babelprovide[import, main]{italian}
\babelprovide[import]{polytonicgreek}
\babelprovide[import]{greek}
\babelfont{rm}[Numbers={Proportional,OldStyle},RawFeature=+calt]{SimonciniGaramondPro}
\babelfont[polytonicgreek]{rm}[RawFeature=+calt]{SimonciniGaramondPro}
\babelfont[greek]{rm}[RawFeature=+calt]{SimonciniGaramondPro}

\begin{document}

\selectlanguage{greek}

ά έ ή ί ό ώ ύ

\selectlanguage{polytonicgreek}

ά έ ή ί ό ώ ύ

ά ὰ έ ὲ

\end{document}


As you can see from the image, on the left Adobe Garamond Premiere Pro itself presents the problem of using in the polytonic the acute accents of the monotonic, slightly different from the polytonic causing a lack of homogeneity in the rendering (see the third line). On the right the final rendering of the font I'm working on.

One last question: since the main language is Italian, is it correct to enter it directly as a babel option without using \babelprovide?

• Please, edit your post to add a MWE. Without it it's difficult to say and to propose a solution, but with the alternative \babelprovide[import,main]{polytonicgreek] babel does set the language to PGR (or at least it attempts to do so). It looks much like a problem in the font side. – Javier Bezos May 8 '20 at 15:24
• All right, Javier Bezos seems to have figured it out, but the MNWE wasn’t compiling because it defines polutonicgreek but uses greek. However, polutonicgreek should not need the workaround. – Davislor May 8 '20 at 17:42
• do you mean to use \babelfont[polytonicgreek]{rm}[Language=Polutoniko,RawFeature=+calt]{SimonciniGaramondPro}? It produces the same error – user41063 May 8 '20 at 18:46
• in some cases I don't know how to move and I work by trial and error, not being able to interpret your suggestions well. You recommend me to use {polytonicgreek}: but I don't find it in the babel manual: where does it come from? You recommend me to use \newfontlanguage{Polutoniko}{PGR}, but in the fontspec manual (8.2) Iread \ newfontlanguage {Zulu} {ZUL} The first argument is the fontspec name, the second the OpenType tag. And Polutoniko is not a fontspec name. So I don't understand how to proceed... – user41063 May 8 '20 at 19:27
• @user41063 (1) As to the problem with 'nil', try deleting the aux file; if it still fails, very likely your system in broken. (2) As to the original question, is there any reason to ignore my answer altogether? – Javier Bezos May 9 '20 at 6:07

Well, I've realized your question was related to Greek alphabet: tonos and oxia . Please, don't forget to include a MWE and links to related questions:

\documentclass{article}

\usepackage{babel}

\babelprovide[import, main]{polytonicgreek}
\babelprovide[import]{greek}

\directlua {
name = "tonosoxia",
features = {grek = {pgr = true}},
type = "substitution",
data = {
Alphatonos = 0x1FBB,
Epsilontonos = 0x1FC9,
Etatonos = 0x1FCB,
Iotatonos = 0x1FDB,
Omicrontonos = 0x1FF9,
Omegatonos = 0x1FFB,
Upsilontonos = 0x1FEB,
alphatonos = 0x1F71,
epsilontonos = 0x1F73,
etatonos = 0x1F75,
iotatonos = 0x1F77,
omicrontonos = 0x1F79,
omegatonos = 0x1F7D,
upsilontonos = 0x1F7B,
upsilondieresistonos = 0x1FE3,
},
}
}

\babelfont{rm}[RawFeature=+calt;+tonosoxia]{EB Garamond}
\babelfont[greek]{rm}[RawFeature=+calt]{EB Garamond}

\begin{document}

ά έ ή ί ό ώ ύ

\selectlanguage{greek}

ά έ ή ί ό ώ ύ

\end {document}


Unfortunately, the standard Greek style loads the languages is a somewhat tricky way which the babel core is unable to catch to set the font language system, but the alternative based on \babelprovide sets it correctly.

### Edit

Javier Bezos, the maintainer of babel, showed up in the comments to recommend the command

\babelprovide[import,main]{polytonicgreek}


This should set the language tag correctly. Remove main if it should not be the main language.

If you have font-specific features, you can select them as options when you load that font through \babelfont. If every Greek font in your program should load the same OpenType language tag, you can also load the Greek language with \babelprovide[import, language=...].

Since there is no predefined interface in fontspec for the language tag PGR, you would want to define it with a command like:

\usepackage{fontspec}
\newfontlanguage{Polutoniko}{PGR}


after loading babel and before invoking

\babelfont[greek]{rm}
[Language=Polutoniko]{MyCustomFont.otf}

• Du you mean something like the following code, but which is not working? Or have I misunderstood your solution: \documentclass{article} \usepackage{fontspec} \usepackage[greek.polutoniko]{babel} \newfontlanguage{Polutoniko}{PGR} \babelfont[greek.polutoniko]{rm}[Language=Polutoniko,Numbers={Proportional,OldStyle},RawFeature=+calt]{EB Garamond} Garamond} \begin{document} ά έ ή ί ό ώ ύ \end{document} – user41063 May 8 '20 at 13:39
• It looks like you might have an extra Garamond in there, and as of last I heard it was preferable to load fontspec after babel, but something like that. Does it work? I don’t have the custom font to test with. – Davislor May 8 '20 at 14:48
• You're right, a error in copy/past. The following code \documentclass{article} \usepackage[greek.ancient]{babel} \usepackage{fontspec} \newfontlanguage{Greek}{PGR} \babelfont[greek.ancient]{rm}[Language=Greek,RawFeature=+calt]{EB Garamond} \begin{document} ά ὰ έ ὲ \end{document} produces an error: ! Package babel Error: You haven't defined the language nil yet. – user41063 May 8 '20 at 15:38
• Javier Bezos, the maintainer of babel, says that the Language= tag should not have been the issue. Unfortunately, without the MWE or the font, I cannot troubleshoot your issue. – Davislor May 8 '20 at 15:42
• However, your second example sets Language=Greek instead of the Language=Polutoniko you just defined. – Davislor May 8 '20 at 15:44